Update electron to 16.0.4

This commit is contained in:
Fedor Indutny
2021-12-09 09:06:04 +01:00
committed by GitHub
parent ba043c422b
commit bbc13d058e
28 changed files with 491 additions and 2985 deletions
+23 -9
View File
@@ -23,6 +23,7 @@ import {
screen,
shell,
systemPreferences,
desktopCapturer,
} from 'electron';
import { z } from 'zod';
@@ -587,11 +588,10 @@ async function createWindow() {
if (getEnvironment() === Environment.Test) {
mainWindow.loadURL(
prepareFileUrl([__dirname, '../test/index.html'], moreKeys)
);
} else if (getEnvironment() === Environment.TestLib) {
mainWindow.loadURL(
prepareFileUrl([__dirname, '../libtextsecure/test/index.html'], moreKeys)
prepareFileUrl([__dirname, '../test/index.html'], {
...moreKeys,
argv: JSON.stringify(process.argv),
})
);
} else {
mainWindow.loadURL(
@@ -1424,10 +1424,7 @@ app.on('ready', async () => {
addSensitivePath(userDataPath);
if (
getEnvironment() !== Environment.Test &&
getEnvironment() !== Environment.TestLib
) {
if (getEnvironment() !== Environment.Test) {
installFileHandler({
protocol: electronProtocol,
userDataPath,
@@ -2120,3 +2117,20 @@ ipc.handle('show-save-dialog', async (_event, { defaultPath }) => {
defaultPath,
});
});
ipc.handle('getScreenCaptureSources', async () => {
return desktopCapturer.getSources({
fetchWindowIcons: true,
thumbnailSize: { height: 102, width: 184 },
types: ['window', 'screen'],
});
});
if (isTestEnvironment(getEnvironment())) {
ipc.handle('ci:test-electron:done', async (_event, info) => {
process.stdout.write(
`ci:test-electron:done=${JSON.stringify(info)}\n`,
() => app.quit()
);
});
}
+12 -2
View File
@@ -2,19 +2,29 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'path';
import { mkdirSync } from 'fs';
import { app } from 'electron';
import { start } from './base_config';
import config from './config';
let userData: string | undefined;
// Use separate data directory for benchmarks & development
if (config.has('storagePath')) {
app.setPath('userData', String(config.get('storagePath')));
userData = String(config.get('storagePath'));
} else if (config.has('storageProfile')) {
const userData = join(
userData = join(
app.getPath('appData'),
`Signal-${config.get('storageProfile')}`
);
}
if (userData !== undefined) {
try {
mkdirSync(userData, { recursive: true });
} catch (error) {
console.error('Failed to create userData', error?.stack || String(error));
}
app.setPath('userData', userData);
}