-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add smartglass api's to server component
- Loading branch information
1 parent
7b93ff7
commit 4d1b886
Showing
6 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import UsersController from './users' | ||
import GamepassController from './gamepass' | ||
import SmartglassController from './smartglass' | ||
|
||
export default { | ||
Users: UsersController, | ||
Gamepass: GamepassController | ||
Gamepass: GamepassController, | ||
Smartglass: SmartglassController, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Controller from './controller' | ||
import WebApi from '@greenlight/webapi' | ||
|
||
export default class SmartglassController extends Controller { | ||
|
||
private _webApi:WebApi|undefined | ||
|
||
async loadApis() { | ||
if(this._webApi === undefined){ | ||
const token = await this.getServer().controllers.Users.getWebtoken() | ||
|
||
this._webApi = new WebApi({ | ||
token: { | ||
Token: token.data.Token, | ||
NotAfter: token.data.NotAfter | ||
}, | ||
uhs: this.getServer().controllers.Users.getUserHash() | ||
}) | ||
} | ||
} | ||
|
||
async getConsoles() { | ||
await this.loadApis() | ||
|
||
return await this._webApi?.provider.smartglass.getConsolesList() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters