diff --git a/CHANGELOG.md b/CHANGELOG.md index 14d47f2b..2a970132 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## v1.2.0-beta6 - 2022-07-16 - Fix error retrieving xCloud token 'InvalidCountry' #300 (credits to `award` on the OpenXbox discord) - Fix message 'No friends online' when no friends are online +- Added `--fullscreen` argumments to launch app in fullscreen #312 +- Added switch `--connect=F400000000000000` argumments to auto-connect to a console #312 - Updated dependencies ## v1.2.0-beta5 - 2022-07-06 diff --git a/package.json b/package.json index dd42ebfc..70057fe2 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "main": ".webpack/main", "scripts": { "start": "ISDEV=true electron-forge start", + "startfullscreen": "ISDEV=true electron-forge start -- --fullscreen", + "startconnect": "ISDEV=true electron-forge start -- --connect=F400000000000000", "compile": "electron-forge make", "test": "echo \"Error: no test specified\" && exit 1", "package": "electron-forge package", diff --git a/src/frontend/application.ts b/src/frontend/application.ts index f8bbbcb7..e6664d02 100644 --- a/src/frontend/application.ts +++ b/src/frontend/application.ts @@ -177,6 +177,7 @@ export default class Application { const inputxCloudStreamingToken = document.getElementById('token_xcloud_streaming_token') const inputxCloudStreamingHost = document.getElementById('token_xcloud_streaming_host') const inputxCloudMSALToken = document.getElementById('token_xcloud_msal_token') + const inputAutoconnect = document.getElementById('switch_autoconnect') const inputWebTokenInterval = setInterval(() => { const valueUhs = (inputWebUhs).value @@ -231,6 +232,12 @@ export default class Application { this._tokenStore.addEventListener('onstreamingtoken', (token) => { if(this._tokenStore._web.uhs !== '' && this._tokenStore._streamingToken !== ''){ this._router.setView('app') + + // Check if we have an auto-connect token + const consoleId = (inputAutoconnect).value + if(consoleId !== ''){ + this.startStream('xhome', consoleId) + } } }) diff --git a/src/index.html b/src/index.html index d2263ab5..7015c99d 100644 --- a/src/index.html +++ b/src/index.html @@ -19,6 +19,9 @@ function setxCloudMSALToken(token){ document.getElementById('token_xcloud_msal_token').value = token } + function setAutoconnect(consoleId){ + document.getElementById('switch_autoconnect').value = consoleId + } window.addEventListener('resize', () => { if(document.getElementById('videoHolder') !== null && document.querySelector("#videoHolder video") !== null) { var videoRender = document.querySelector("#videoHolder video") @@ -37,6 +40,7 @@ +
diff --git a/src/index.ts b/src/index.ts index d2e29a53..280b9ac2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,6 +14,12 @@ import * as path from 'path'; declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string; declare const MAIN_WINDOW_WEBPACK_ENTRY: string; +const switches = { + fullscreen: false, + autoconnect: false, + connectConsoleId: '' +} + // Handle creating/removing shortcuts on Windows when installing/uninstalling. if (require('electron-squirrel-startup')) { // eslint-disable-line global-require app.quit(); @@ -31,6 +37,7 @@ const createWindow = (): void => { mainWindow = new BrowserWindow({ width: 1500, height: 875, + fullscreen: switches.fullscreen, webPreferences: { nodeIntegration: true, @@ -107,6 +114,13 @@ app.on('ready', () => { tokenStore.addEventListener('onstreamingtoken', (token:any) => { mainWindow.webContents.executeJavaScript("setStreamingToken('"+token+"');"); console.log('xhome tokens set') + + // Lets set the consoleid of the console we want to connect to + if(switches.autoconnect === true && switches.connectConsoleId != ''){ + mainWindow.webContents.executeJavaScript("setAutoconnect('"+switches.connectConsoleId+"');"); + // mainWindow.webContents.executeJavaScript("startStream('"+switches.connectConsoleId+"');"); + // .startStream('xhome', consoles[device].serverId) + } }) tokenStore.addEventListener('onxcloudstreamingtoken', (token:any) => { @@ -183,6 +197,26 @@ app.on('activate', () => { } }); +console.log('Bootstrapping Xbox-xCloud-Client using args:', process.argv) + +// Read fullscreen switch +if(process.argv.includes('--fullscreen')){ + console.log('- Fullscreen switch acive') + switches.fullscreen = true +} + +// Read auto-connect switch +// if(process.argv.includes('--connect')){ + for(const arg in process.argv){ + if(process.argv[arg].includes('--connect')){ + // got value: + console.log('- Connect switch active, value:', process.argv[arg].substring(10)) + switches.autoconnect = true + switches.connectConsoleId = process.argv[arg].substring(10) + } + } +// } + // appMenu().renderMenu() const menu = new appMenu()