mirror of
https://github.com/element-hq/element-desktop
synced 2025-04-21 09:03:56 +02:00
Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
0298141e03
commit
0cdf4dfbec
@ -464,8 +464,18 @@ app.on("ready", async () => {
|
||||
console.log("No update_base_url is defined: auto update is disabled");
|
||||
}
|
||||
|
||||
// Set up i18n before loading storage as we need translations for dialogs
|
||||
global.appLocalization = new AppLocalization({
|
||||
components: [(): void => tray.initApplicationMenu(), (): void => Menu.setApplicationMenu(buildMenuTemplate())],
|
||||
});
|
||||
|
||||
try {
|
||||
console.debug("Ensuring storage is ready");
|
||||
await store.safeStorageReady();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
app.exit(1);
|
||||
}
|
||||
|
||||
// Load the previous window state with fallback to defaults
|
||||
const mainWindowState = windowStateKeeper({
|
||||
@ -561,10 +571,6 @@ app.on("ready", async () => {
|
||||
|
||||
webContentsHandler(global.mainWindow.webContents);
|
||||
|
||||
global.appLocalization = new AppLocalization({
|
||||
components: [(): void => tray.initApplicationMenu(), (): void => Menu.setApplicationMenu(buildMenuTemplate())],
|
||||
});
|
||||
|
||||
session.defaultSession.setDisplayMediaRequestHandler((_, callback) => {
|
||||
global.mainWindow?.webContents.send("openDesktopCapturerSourcePicker");
|
||||
setDisplayMediaCallback(callback);
|
||||
|
10
src/store.ts
10
src/store.ts
@ -177,7 +177,7 @@ class Store extends ElectronStore<{
|
||||
if (data) {
|
||||
for (const key in data) {
|
||||
const plaintext = data[key];
|
||||
await this.setSecret(key, plaintext);
|
||||
await this.setSecretSafeStorage(key, plaintext);
|
||||
}
|
||||
}
|
||||
} else if (safeStorageBackend in safeStorageBackendMap) {
|
||||
@ -239,7 +239,7 @@ class Store extends ElectronStore<{
|
||||
];
|
||||
for (const cred of credentials) {
|
||||
console.info("Store migration: writing", cred);
|
||||
await this.setSecret(cred.account, cred.password);
|
||||
await this.setSecretSafeStorage(cred.account, cred.password);
|
||||
console.info("Store migration: deleting", cred);
|
||||
await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, cred.account);
|
||||
}
|
||||
@ -290,9 +290,13 @@ class Store extends ElectronStore<{
|
||||
throw new Error("safeStorage is not available");
|
||||
}
|
||||
|
||||
await this.setSecretSafeStorage(key, secret);
|
||||
await keytar.setPassword(KEYTAR_SERVICE, key, secret);
|
||||
}
|
||||
|
||||
private async setSecretSafeStorage(key: string, secret: string): Promise<void> {
|
||||
const encryptedValue = safeStorage.encryptString(secret);
|
||||
this.set(this.getSecretStorageKey(key), encryptedValue.toString("base64"));
|
||||
await keytar.setPassword(KEYTAR_SERVICE, key, secret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user