diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b44d994..1cb973b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,5 +28,14 @@ If applicable, add screenshots to help explain your problem. - Installation package [deb, rpm, snap, AppImage, tar.gz, source...] - Version [e.g. 0.1.17] +**Debug** +When possible, please run the application from the terminal using `--webDebug` and try to reproduce the error. + +The provide in this section the output from both the terminal and the browser debug console. + +```bash +teams-for-linux --webDebug --appLogLevels=error,info,warn,debug +``` + **Additional context** Add any other context about the problem here. diff --git a/app/appConfiguration/index.js b/app/appConfiguration/index.js index b7defbb..c05ce23 100644 --- a/app/appConfiguration/index.js +++ b/app/appConfiguration/index.js @@ -47,4 +47,4 @@ class AppConfiguration { } } -module.exports = { AppConfiguration }; \ No newline at end of file +module.exports = { AppConfiguration }; diff --git a/app/browser/tools/activityHub.js b/app/browser/tools/activityHub.js index 2976ca4..5864943 100644 --- a/app/browser/tools/activityHub.js +++ b/app/browser/tools/activityHub.js @@ -1,4 +1,5 @@ const instance = require('./instance'); +const ReactHandler = require('./reactHandler'); /** * @type {Array<{handler:(data)=>void,event:string,handle:number}>} */ @@ -56,7 +57,7 @@ class ActivityHub { * @param {number} state */ setMachineState(state) { - const teams2IdleTracker = instance.getTeams2IdleTracker(); + const teams2IdleTracker = ReactHandler.getTeams2IdleTracker(); if (teams2IdleTracker) { try { console.log(`setMachineState teams2 state=${state}`); diff --git a/app/browser/tools/instance.js b/app/browser/tools/instance.js index c64a623..2939c0d 100644 --- a/app/browser/tools/instance.js +++ b/app/browser/tools/instance.js @@ -15,18 +15,6 @@ class Instance { return await this.whenReady(tries + 1); } } - - getTeams2ReactElement() { - return document.getElementById('app'); - } - - getTeams2CoreServices() { - return this.getTeams2ReactElement()?._reactRootContainer?._internalRoot?.current?.updateQueue?.baseState?.element?.props?.coreServices; - } - - getTeams2IdleTracker() { - return this.getTeams2CoreServices()?.clientState?._idleTracker; - } } function getAppObjects() { diff --git a/app/browser/tools/reactHandler.js b/app/browser/tools/reactHandler.js new file mode 100644 index 0000000..3ebc6ea --- /dev/null +++ b/app/browser/tools/reactHandler.js @@ -0,0 +1,20 @@ +class ReactHandler { + + _getTeams2ReactElement() { + return document.getElementById('app'); + } + + _getTeams2CoreServices() { + return this._getTeams2ReactElement()?._reactRootContainer?._internalRoot?.current?.updateQueue?.baseState?.element?.props?.coreServices; + } + + getTeams2IdleTracker() { + return this._getTeams2CoreServices()?.clientState?._idleTracker; + } + + getTeams2ClientPreferences() { + return this._getTeams2CoreServices()?.clientPreferences?.clientPreferences; + } +} + +module.exports = new ReactHandler(); \ No newline at end of file diff --git a/app/browser/tools/theme.js b/app/browser/tools/theme.js index 2d28795..a9add77 100644 --- a/app/browser/tools/theme.js +++ b/app/browser/tools/theme.js @@ -1,4 +1,4 @@ -const instance = require('./instance'); +const ReactHandler = require('./reactHandler'); class ThemeManager { /** @@ -8,17 +8,18 @@ class ThemeManager { init(config, ipcRenderer) { this.ipcRenderer = ipcRenderer; this.config = config; + ReactHandler.getTeams2ClientPreferences().followOsTheme = config.followSystemTheme; if (config.followSystemTheme) { - this.ipcRenderer.on('system-theme-changed', this.applyTheme); + console.log('followSystemTheme', config.followSystemTheme); + this.ipcRenderer.on('system-theme-changed', this.applyTheme); } } applyTheme = async (event, ...args) => { const theme = args[0] ? 'dark' : 'default'; - const inst = await instance.whenReady().catch(() => { - console.error('Failed to apply Theme'); - }); - inst.controller.layoutService.setTheme(theme); + const clientPreferences = ReactHandler.getTeams2ClientPreferences(); + clientPreferences.useTheme = theme; + console.log('Theme changed to', theme); } } diff --git a/app/browser/tools/wakeLock.js b/app/browser/tools/wakeLock.js index 3e67327..0ff7de9 100644 --- a/app/browser/tools/wakeLock.js +++ b/app/browser/tools/wakeLock.js @@ -1,36 +1,36 @@ var _WakeLock_lock = new WeakMap(); class WakeLock { - constructor() { - _WakeLock_lock.set(this, null); - } + constructor() { + _WakeLock_lock.set(this, null); + } - async enable() { - try { - var lock = await navigator.wakeLock.request('screen'); - lock.addEventListener('release', () => { - console.log('Wake Lock was released'); - }); - console.log('Wake Lock is active'); - _WakeLock_lock.set(this, lock); + async enable() { + try { + var lock = await navigator.wakeLock.request('screen'); + lock.addEventListener('release', () => { + console.log('Wake Lock was released'); + }); + console.log('Wake Lock is active'); + _WakeLock_lock.set(this, lock); - } catch (err) { - console.error(`${err.name}, ${err.message}`); - } - } + } catch (err) { + console.error(`${err.name}, ${err.message}`); + } + } - async disable() { - var lock = _WakeLock_lock.get(this); - if (!lock) { - return; - } - try { - await lock.release(); - lock = null; - _WakeLock_lock.set(this, lock); - } catch (err) { - console.error(`${err.name}, ${err.message}`); - } - } + async disable() { + var lock = _WakeLock_lock.get(this); + if (!lock) { + return; + } + try { + await lock.release(); + lock = null; + _WakeLock_lock.set(this, lock); + } catch (err) { + console.error(`${err.name}, ${err.message}`); + } + } } const wakeLock = new WakeLock(); diff --git a/app/index.js b/app/index.js index 865e52d..c1370ee 100644 --- a/app/index.js +++ b/app/index.js @@ -335,4 +335,4 @@ function onCustomBGServiceConfigDownloadFailure(err) { catch (err) { logger.error(`Failed to save remote configuration at '${dlpath}'`); } -} \ No newline at end of file +} diff --git a/app/mainAppWindow/index.js b/app/mainAppWindow/index.js index 95e1c1e..929997c 100644 --- a/app/mainAppWindow/index.js +++ b/app/mainAppWindow/index.js @@ -222,8 +222,8 @@ function restoreWindow() { } function processArgs(args) { - var regHttps = /^https:\/\/teams.microsoft.com\/l\/(meetup-join|channel)\//g; - var regMS = /^msteams:\/l\/(meetup-join|channel)\//g; + var regHttps = /^https:\/\/teams\.microsoft\.com\/.*(?:meetup-join|channel)/g; + var regMS = /^msteams:\/.*(?:meetup-join|channel)/g; logger.debug('processArgs:', args); for (const arg of args) { if (regHttps.test(arg)) { @@ -317,7 +317,7 @@ function onBeforeSendHeadersHandler(detail, callback) { * @returns {{action: 'deny'} | {action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: Electron.BrowserWindowConstructorOptions}} */ function onNewWindow(details) { - if (details.url.startsWith('https://teams.microsoft.com/l/meetup-join')) { + if (details.url.startsWith('https://teams.microsoft.com/l/meetup-join') || details.url.startsWith('https://teams.microsoft.com/v2/l/meetup-join')) { logger.debug('DEBUG - captured meetup-join url'); return { action: 'deny' }; } else if (details.url === 'about:blank' || details.url === 'about:blank#blocked') { @@ -619,4 +619,4 @@ function enableWakeLockOnWindowRestore() { if (isOnCall) { window.webContents.send('enable-wakelock'); } -} \ No newline at end of file +} diff --git a/app/menus/application.js b/app/menus/application.js index 940695f..33fbcd0 100644 --- a/app/menus/application.js +++ b/app/menus/application.js @@ -109,4 +109,4 @@ function getNotificationsMenu(Menus) { } ] }; -} \ No newline at end of file +} diff --git a/app/menus/tray.js b/app/menus/tray.js index 521da33..d0ccb27 100644 --- a/app/menus/tray.js +++ b/app/menus/tray.js @@ -34,4 +34,4 @@ class ApplicationTray { this.tray.destroy(); } } -exports = module.exports = ApplicationTray; \ No newline at end of file +exports = module.exports = ApplicationTray; diff --git a/app/spellCheckProvider/codes.js b/app/spellCheckProvider/codes.js index e3f5019..6253cbc 100644 --- a/app/spellCheckProvider/codes.js +++ b/app/spellCheckProvider/codes.js @@ -701,4 +701,4 @@ const codes = [ } ]; -module.exports = codes; \ No newline at end of file +module.exports = codes; diff --git a/app/spellCheckProvider/index.js b/app/spellCheckProvider/index.js index 991e1ba..3d26d56 100644 --- a/app/spellCheckProvider/index.js +++ b/app/spellCheckProvider/index.js @@ -136,4 +136,4 @@ function stringCompare(str1, str2) { return le ? -1 : gr ? 1 : 0; } -module.exports = { SpellCheckProvider }; \ No newline at end of file +module.exports = { SpellCheckProvider }; diff --git a/app/streamSelector/browser.js b/app/streamSelector/browser.js index 667000c..25a718f 100644 --- a/app/streamSelector/browser.js +++ b/app/streamSelector/browser.js @@ -123,4 +123,3 @@ function createQualitySelector(properties) { defaultSelection = defaultSelection > -1 ? defaultSelection : properties.screens.length - 1; properties.sscontainer.selectedIndex = defaultSelection; } - diff --git a/app/streamSelector/index.js b/app/streamSelector/index.js index 2083d0c..ccd4241 100644 --- a/app/streamSelector/index.js +++ b/app/streamSelector/index.js @@ -151,5 +151,3 @@ function createScreenRequestHandler() { } module.exports = { StreamSelector }; - - diff --git a/package.json b/package.json index 288a883..5e65a4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teams-for-linux", - "version": "1.4.17", + "version": "1.4.18", "main": "app/index.js", "description": "Unofficial client for Microsoft Teams for Linux", "homepage": "https://github.com/IsmaelMartinez/teams-for-linux", diff --git a/scripts/afterpack.js b/scripts/afterpack.js index e6372a3..fdf159c 100644 --- a/scripts/afterpack.js +++ b/scripts/afterpack.js @@ -2,19 +2,19 @@ const {flipFuses, FuseVersion, FuseV1Options} = require('@electron/fuses'); const {chmod} = require('fs/promises'); function getAppFileName(context) { - const productFileName = context.packager.appInfo.productFilename + const productFileName = context.packager.appInfo.productFilename; switch (context.electronPlatformName) { - case 'win32': - return `${productFileName}.exe`; - case 'darwin': - return `${productFileName}.app`; - case 'mas': - return `${productFileName}.app`; - case 'linux': - return context.packager.executableName; - default: - return ''; + case 'win32': + return `${productFileName}.exe`; + case 'darwin': + return `${productFileName}.app`; + case 'mas': + return `${productFileName}.app`; + case 'linux': + return context.packager.executableName; + default: + return ''; } } @@ -25,11 +25,10 @@ exports.default = async function afterPack(context) { await flipFuses( path, { - version: FuseVersion.V1, - [FuseV1Options.EnableCookieEncryption]: true, + version: FuseVersion.V1, + [FuseV1Options.EnableCookieEncryption]: true, }, - ); - + ); } catch (error) { console.error('afterPack error: ', error); process.exit(1);