Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
tlebon committed Jul 22, 2024
2 parents f446d4b + 7dde2d1 commit 3378235
Show file tree
Hide file tree
Showing 9 changed files with 1,018 additions and 613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.1.0
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: '${{secrets.WEBTEAM_AUTOMERGE_TOKEN}}'

Expand Down
4 changes: 2 additions & 2 deletions app-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"wire-web-config-internal": "https://github.com/wireapp/wire-web-config-default#v0.31.24",
"wire-web-config-production": "https://github.com/wireapp/wire-web-config-wire#v0.31.25-0"
"wire-web-config-internal": "https://github.com/wireapp/wire-web-config-default#v0.31.28",
"wire-web-config-production": "https://github.com/wireapp/wire-web-config-wire#v0.31.29-0"
}
}
36 changes: 36 additions & 0 deletions electron/src/calling/PictureInPictureCall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

import {getNewWindowOptions} from '../window/WindowUtil';

const PICTURE_IN_PICTURE_CALL_FRAME_NAME = 'WIRE_PICTURE_IN_PICTURE_CALL';

export const isPictureInPictureCallWindow = (frameName: string): boolean => {
return frameName === PICTURE_IN_PICTURE_CALL_FRAME_NAME;
};

export const getPictureInPictureCallWindowOptions = (): Electron.BrowserWindowConstructorOptions => {
return getNewWindowOptions({
width: 1026,
height: 829,
resizable: true,
fullscreenable: true,
maximizable: true,
});
};
70 changes: 14 additions & 56 deletions electron/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {LogFactory} from '@wireapp/commons';
import {WebAppEvents} from '@wireapp/webapp-events';

import * as ProxyAuth from './auth/ProxyAuth';
import {getPictureInPictureCallWindowOptions, isPictureInPictureCallWindow} from './calling/PictureInPictureCall';
import {
attachTo as attachCertificateVerifyProcManagerTo,
setCertificateVerifyProc,
Expand Down Expand Up @@ -171,25 +172,14 @@ app.setAppUserModelId(config.appUserModelId);
// do not use mdns for local ip obfuscation to prevent windows firewall prompt
app.commandLine.appendSwitch('disable-features', 'WebRtcHideLocalIpsWithMdns');

app.on('gpu-info-update', () => {
try {
logger.info('GPUFeatureStatus:', app.getGPUFeatureStatus());
const has2dCanvas = app.getGPUFeatureStatus()?.['2d_canvas']?.startsWith('enabled');

if (!has2dCanvas) {
/*
* If the 2D canvas is unavailable, and we rely on hardware acceleration,
* Electron can't render anything and will only display a white screen. Thus
* we disable hardware acceleration completely.
*/
logger.warn('2D canvas unavailable, disabling hardware acceleration');
app.disableHardwareAcceleration();
}
} catch (error) {
logger.warn(`Can't read GPUFeatureStatus, disabling hardware acceleration`);
app.getGPUInfo('basic').then((info: any) => {
const gpuDevices = 'gpuDevice' in info ? info.gpuDevice : [];
if (gpuDevices.length > 0) {
logger.info('No GPU device found, disabling hardware acceleration');
app.disableHardwareAcceleration();
}
});

// IPC events
const bindIpcEvents = (): void => {
ipcMain.on(EVENT_TYPE.ACTION.SAVE_PICTURE, (_event, bytes: Uint8Array, timestamp?: string) => {
Expand Down Expand Up @@ -592,46 +582,14 @@ class ElectronWrapperInit {
if (SingleSignOn.isSingleSignOnLoginWindow(details.frameName)) {
return {
action: 'allow',
overrideBrowserWindowOptions: {
alwaysOnTop: true,
backgroundColor: '#FFFFFF',
fullscreen: false,
fullscreenable: false,
height: 600,
maximizable: false,
minimizable: false,
modal: false,
movable: true,
parent: main,
resizable: false,
title: SingleSignOn.getWindowTitle(details.url),
titleBarStyle: 'default',
useContentSize: true,
webPreferences: {
allowRunningInsecureContent: false,
backgroundThrottling: false,
contextIsolation: true,
devTools: false,
disableBlinkFeatures: '',
experimentalFeatures: false,
images: true,
javascript: true,
nodeIntegration: false,
nodeIntegrationInWorker: false,
offscreen: false,
partition: '',
plugins: false,
preload: '',
sandbox: true,
scrollBounce: true,
spellcheck: false,
textAreasAreResizable: false,
webSecurity: true,
webgl: false,
webviewTag: false,
},
width: 480,
},
overrideBrowserWindowOptions: SingleSignOn.getSingleSignOnLoginWindowOptions(main, details.url),
};
}

if (isPictureInPictureCallWindow(details.frameName)) {
return {
action: 'allow',
overrideBrowserWindowOptions: getPictureInPictureCallWindowOptions(),
};
}

Expand Down
11 changes: 11 additions & 0 deletions electron/src/sso/SingleSignOn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ export class SingleSignOn {
// Ensure authenticity of the window from within the code
public static isSingleSignOnLoginWindow = (frameName: string) => SingleSignOn.SINGLE_SIGN_ON_FRAME_NAME === frameName;

public static getSingleSignOnLoginWindowOptions = (
parent: BrowserWindow,
origin: string,
): Electron.BrowserWindowConstructorOptions =>
WindowUtil.getNewWindowOptions({
title: SingleSignOn.getWindowTitle(origin),
parent,
width: 480,
height: 600,
});

// Returns an empty string if the origin is a Wire backend
public static getWindowTitle = (origin: string): string =>
SingleSignOn.ALLOWED_BACKEND_ORIGINS.includes(origin) ? '' : origin;
Expand Down
59 changes: 59 additions & 0 deletions electron/src/window/WindowUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,62 @@ export const openExternal = async (url: string, httpsOnly: boolean = false): Pro
logger.error(error);
}
};

export const getNewWindowOptions = ({
parent,
title = '',
width,
height,
resizable = false,
fullscreenable = false,
maximizable = false,
}: {
title?: string;
parent?: Electron.BrowserWindow;
width: number;
height: number;
resizable?: boolean;
fullscreenable?: boolean;
maximizable?: boolean;
}): Electron.BrowserWindowConstructorOptions => ({
alwaysOnTop: true,
width,
height,
backgroundColor: '#FFFFFF',
fullscreen: false,
fullscreenable,
maximizable,
minimizable: false,
modal: false,
movable: true,
parent,
resizable,
minHeight: height,
minWidth: width,
title: title,
titleBarStyle: 'default',
useContentSize: true,
webPreferences: {
allowRunningInsecureContent: false,
backgroundThrottling: false,
contextIsolation: true,
devTools: false,
disableBlinkFeatures: '',
experimentalFeatures: false,
images: true,
javascript: true,
nodeIntegration: false,
nodeIntegrationInWorker: false,
offscreen: false,
partition: '',
plugins: false,
preload: '',
sandbox: true,
scrollBounce: true,
spellcheck: false,
textAreasAreResizable: false,
webSecurity: true,
webgl: false,
webviewTag: false,
},
});
15 changes: 1 addition & 14 deletions jenkins/windows.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ node('windows') {
def electronVersion = parseJson(packageJson).devDependencies.electron
currentBuild.displayName = version

stage('Sign test file') {
withCredentials([string(credentialsId: 'SM_API_KEY', variable: 'SM_API_KEY'), string(credentialsId: 'SM_HOST', variable: 'SM_HOST'), string(credentialsId: 'SM_CLIENT_CERT_PASSWORD', variable: 'SM_CLIENT_CERT_PASSWORD'), file(credentialsId: 'SM_CLIENT_CERT_FILE', variable: 'SM_CLIENT_CERT_FILE'), string(credentialsId: 'SM_KEYPAIR_ALIAS', variable: 'SM_KEYPAIR_ALIAS')]) {
try {
bat 'smctl sign --keypair-alias %SM_KEYPAIR_ALIAS% --config-file %SM_CLIENT_CERT_FILE% --input C:\\Users\\jenkins\\Downloads\\Git-2.21.0-64-bit.exe -v'
} catch (e) {
currentBuild.result = 'FAILED'
wireSend secret: "${jenkinsbot_secret}", message: "🏞 **${JOB_NAME} ${version} signing installer failed**\n${BUILD_URL}"
throw e
}
}
}

stage('Build') {
try {
withEnv(["PATH+NODE=${NODE}", 'npm_config_target_arch=x64']) {
Expand Down Expand Up @@ -119,5 +107,4 @@ node('windows') {
}

wireSend secret: "${jenkinsbot_secret}", message: "🏞 **New build of ${JOB_NAME} ${version}**\n- Download: [Jenkins](${BUILD_URL})\n- Electron version: ${electronVersion}\n- Branch: [${GIT_BRANCH}](https://github.com/wireapp/wire-desktop/commits/${GIT_BRANCH})"
}

}
58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"dependencies": {
"@electron/remote": "2.1.2",
"@hapi/joi": "17.1.1",
"@wireapp/certificate-check": "0.7.13",
"@wireapp/commons": "5.2.8",
"@wireapp/protocol-messaging": "1.48.0",
"@wireapp/react-ui-kit": "9.17.7",
"@wireapp/webapp-events": "0.22.0",
"@wireapp/certificate-check": "0.7.14",
"@wireapp/commons": "5.2.10",
"@wireapp/protocol-messaging": "1.49.0",
"@wireapp/react-ui-kit": "9.21.1",
"@wireapp/webapp-events": "0.22.1",
"auto-launch": "5.0.6",
"axios": "0.21.2",
"content-type": "1.0.5",
Expand All @@ -33,16 +33,16 @@
},
"description": "The most secure collaboration platform.",
"devDependencies": {
"@babel/core": "7.24.7",
"@babel/helper-string-parser": "7.24.7",
"@babel/core": "7.24.9",
"@babel/helper-string-parser": "7.24.8",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-optional-chaining": "7.21.0",
"@babel/preset-env": "7.24.7",
"@babel/preset-env": "7.24.8",
"@babel/preset-react": "7.24.7",
"@babel/preset-typescript": "7.24.7",
"@babel/register": "7.24.6",
"@electron/fuses": "1.8.0",
"@electron/osx-sign": "1.3.0",
"@electron/osx-sign": "1.3.1",
"@types/adm-zip": "0.5.5",
"@types/amplify": "1.1.28",
"@types/auto-launch": "5.0.5",
Expand All @@ -52,10 +52,10 @@
"@types/hapi__joi": "^17.1.14",
"@types/is-ci": "3.0.4",
"@types/jest": "^29.5.12",
"@types/lodash": "4.17.5",
"@types/lodash": "4.17.7",
"@types/minimist": "1.2.5",
"@types/mocha": "10.0.6",
"@types/node": "18.19.34",
"@types/mocha": "10.0.7",
"@types/node": "18.19.41",
"@types/open-graph": "0.2.5",
"@types/platform": "1.3.6",
"@types/prettier": "^2.7.3",
Expand All @@ -65,13 +65,13 @@
"@types/sinon": "17.0.3",
"@types/sort-json": "2.0.3",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "7.13.0",
"@typescript-eslint/parser": "7.13.0",
"@wireapp/copy-config": "2.2.2",
"@wireapp/eslint-config": "3.0.11",
"@typescript-eslint/eslint-plugin": "7.16.1",
"@typescript-eslint/parser": "7.16.1",
"@wireapp/copy-config": "2.2.3",
"@wireapp/eslint-config": "3.0.15",
"@wireapp/prettier-config": "0.6.4",
"adm-zip": "0.5.14",
"aws-sdk": "2.1639.0",
"aws-sdk": "2.1659.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "29.7.0",
Expand All @@ -82,9 +82,9 @@
"cross-env": "7.0.3",
"css-loader": "7.1.2",
"dotenv": "16.4.5",
"electron": "29.4.2",
"electron": "29.4.5",
"electron-builder": "24.13.3",
"electron-mocha": "12.3.0",
"electron-mocha": "12.3.1",
"electron-packager": "17.1.2",
"electron-winstaller": "4.0.1",
"eslint": "8.57.0",
Expand All @@ -94,35 +94,35 @@
"eslint-plugin-better-styled-components": "1.1.2",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jasmine": "4.1.3",
"eslint-plugin-jasmine": "4.2.0",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-jest-dom": "5.4.0",
"eslint-plugin-jsdoc": "48.2.9",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-jsdoc": "48.8.3",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-no-unsanitized": "4.0.2",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.34.2",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-simple-import-sort": "12.1.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-testing-library": "6.2.2",
"eslint-plugin-unused-imports": "3.2.0",
"form-data": "4.0.0",
"husky": "4.3.8",
"is-ci": "3.0.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"lint-staged": "15.2.6",
"mocha": "10.4.0",
"lint-staged": "15.2.7",
"mocha": "10.7.0",
"nock": "13.5.4",
"nyc": "15.1.0",
"prettier": "2.8.8",
"rimraf": "5.0.7",
"rimraf": "5.0.8",
"sinon": "17.0.2",
"sort-json": "2.0.1",
"style-loader": "4.0.0",
"ts-node": "10.9.2",
"typescript": "5.4.5",
"webpack": "5.92.0",
"typescript": "5.5.3",
"webpack": "5.93.0",
"webpack-cli": "5.1.4"
},
"homepage": "https://wire.com",
Expand Down
Loading

0 comments on commit 3378235

Please sign in to comment.