mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Conform to no-floating-promises (#1725)
This commit is contained in:
parent
5c23a23f39
commit
2018a51469
@ -114,7 +114,7 @@ async function main(): Promise<number | undefined> {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Promise<boolean>((resolve) => {
|
await new Promise<boolean>((resolve, reject) => {
|
||||||
const gpgProc = childProcess.execFile("gpg", ["--import"], (error) => {
|
const gpgProc = childProcess.execFile("gpg", ["--import"], (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log("Failed to import key", error);
|
console.log("Failed to import key", error);
|
||||||
@ -123,9 +123,11 @@ async function main(): Promise<number | undefined> {
|
|||||||
}
|
}
|
||||||
resolve(!error);
|
resolve(!error);
|
||||||
});
|
});
|
||||||
fetch(PUB_KEY_URL).then((resp) => {
|
fetch(PUB_KEY_URL)
|
||||||
stream.pipeline(resp.body, gpgProc.stdin!);
|
.then((resp) => {
|
||||||
});
|
stream.pipeline(resp.body, gpgProc.stdin!).catch(reject);
|
||||||
|
})
|
||||||
|
.catch(reject);
|
||||||
});
|
});
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ async function loadConfig(): Promise<void> {
|
|||||||
global.vectorConfig = Object.assign(global.vectorConfig, localConfig);
|
global.vectorConfig = Object.assign(global.vectorConfig, localConfig);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof SyntaxError) {
|
if (e instanceof SyntaxError) {
|
||||||
dialog.showMessageBox({
|
void dialog.showMessageBox({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: `Your ${global.vectorConfig.brand || "Element"} is misconfigured`,
|
title: `Your ${global.vectorConfig.brand || "Element"} is misconfigured`,
|
||||||
message:
|
message:
|
||||||
@ -292,7 +292,7 @@ const warnBeforeExit = (event: Event, input: Input): void => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
configureSentry();
|
void configureSentry();
|
||||||
|
|
||||||
// handle uncaught errors otherwise it displays
|
// handle uncaught errors otherwise it displays
|
||||||
// stack traces in popup dialogs, which is terrible (which
|
// stack traces in popup dialogs, which is terrible (which
|
||||||
@ -442,7 +442,7 @@ app.on("ready", async () => {
|
|||||||
console.log('Auto update disabled via command line flag "--no-update"');
|
console.log('Auto update disabled via command line flag "--no-update"');
|
||||||
} else if (global.vectorConfig["update_base_url"]) {
|
} else if (global.vectorConfig["update_base_url"]) {
|
||||||
console.log(`Starting auto update with base URL: ${global.vectorConfig["update_base_url"]}`);
|
console.log(`Starting auto update with base URL: ${global.vectorConfig["update_base_url"]}`);
|
||||||
updater.start(global.vectorConfig["update_base_url"]);
|
void updater.start(global.vectorConfig["update_base_url"]);
|
||||||
} else {
|
} else {
|
||||||
console.log("No update_base_url is defined: auto update is disabled");
|
console.log("No update_base_url is defined: auto update is disabled");
|
||||||
}
|
}
|
||||||
@ -477,7 +477,7 @@ app.on("ready", async () => {
|
|||||||
webgl: true,
|
webgl: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
global.mainWindow.loadURL("vector://vector/webapp/");
|
void global.mainWindow.loadURL("vector://vector/webapp/");
|
||||||
|
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
setupMacosTitleBar(global.mainWindow);
|
setupMacosTitleBar(global.mainWindow);
|
||||||
|
@ -217,11 +217,11 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
|||||||
label: r.initial,
|
label: r.initial,
|
||||||
backgroundColor: defaultColors[total % defaultColors.length],
|
backgroundColor: defaultColors[total % defaultColors.length],
|
||||||
click: (): void => {
|
click: (): void => {
|
||||||
global.mainWindow?.loadURL(`vector://vector/webapp/#/room/${r.roomId}`);
|
void global.mainWindow?.loadURL(`vector://vector/webapp/#/room/${r.roomId}`);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (r.avatarUrl) {
|
if (r.avatarUrl) {
|
||||||
fetch(r.avatarUrl)
|
void fetch(r.avatarUrl)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
if (!resp.ok) return;
|
if (!resp.ok) return;
|
||||||
return resp.arrayBuffer();
|
return resp.arrayBuffer();
|
||||||
|
@ -150,15 +150,15 @@ export function setupMacosTitleBar(window: BrowserWindow): void {
|
|||||||
|
|
||||||
window.on("enter-full-screen", () => {
|
window.on("enter-full-screen", () => {
|
||||||
if (cssKey !== undefined) {
|
if (cssKey !== undefined) {
|
||||||
window.webContents.removeInsertedCSS(cssKey);
|
void window.webContents.removeInsertedCSS(cssKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.on("leave-full-screen", () => {
|
window.on("leave-full-screen", () => {
|
||||||
applyStyling();
|
void applyStyling();
|
||||||
});
|
});
|
||||||
window.webContents.on("did-finish-load", () => {
|
window.webContents.on("did-finish-load", () => {
|
||||||
if (!window.isFullScreen()) {
|
if (!window.isFullScreen()) {
|
||||||
applyStyling();
|
void applyStyling();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ function processUrl(url: string): void {
|
|||||||
urlToLoad.hash = parsed.hash;
|
urlToLoad.hash = parsed.hash;
|
||||||
|
|
||||||
console.log("Opening URL: ", urlToLoad.href);
|
console.log("Opening URL: ", urlToLoad.href);
|
||||||
global.mainWindow.loadURL(urlToLoad.href);
|
void global.mainWindow.loadURL(urlToLoad.href);
|
||||||
}
|
}
|
||||||
|
|
||||||
function readStore(): Record<string, string> {
|
function readStore(): Record<string, string> {
|
||||||
|
@ -43,7 +43,7 @@ function checkSquirrelHooks(): boolean {
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case "--squirrel-install":
|
case "--squirrel-install":
|
||||||
runUpdateExe(["--createShortcut=" + target]).then(() => app.quit());
|
void runUpdateExe(["--createShortcut=" + target]).then(() => app.quit());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "--squirrel-updated":
|
case "--squirrel-updated":
|
||||||
@ -52,7 +52,7 @@ function checkSquirrelHooks(): boolean {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "--squirrel-uninstall":
|
case "--squirrel-uninstall":
|
||||||
runUpdateExe(["--removeShortcut=" + target]).then(() => app.quit());
|
void runUpdateExe(["--removeShortcut=" + target]).then(() => app.quit());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -140,7 +140,7 @@ export function buildMenuTemplate(): Menu {
|
|||||||
// XXX: vectorConfig won't have defaults applied to it so we need to duplicate them here
|
// XXX: vectorConfig won't have defaults applied to it so we need to duplicate them here
|
||||||
label: _t("common|brand_help", { brand: global.vectorConfig?.brand || "Element" }),
|
label: _t("common|brand_help", { brand: global.vectorConfig?.brand || "Element" }),
|
||||||
click(): void {
|
click(): void {
|
||||||
shell.openExternal(global.vectorConfig?.help_url || "https://element.io/help");
|
void shell.openExternal(global.vectorConfig?.help_url || "https://element.io/help");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -53,7 +53,7 @@ function safeOpenURL(target: string): void {
|
|||||||
// so we know the url parser has understood all the parts
|
// so we know the url parser has understood all the parts
|
||||||
// of the input string
|
// of the input string
|
||||||
const newTarget = url.format(parsedUrl);
|
const newTarget = url.format(parsedUrl);
|
||||||
shell.openExternal(newTarget);
|
void shell.openExternal(newTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ function onLinkContextMenu(ev: Event, params: ContextMenuParams, webContents: We
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
dialog.showMessageBox({
|
void dialog.showMessageBox({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: _t("right_click_menu|save_image_as_error_title"),
|
title: _t("right_click_menu|save_image_as_error_title"),
|
||||||
message: _t("right_click_menu|save_image_as_error_description"),
|
message: _t("right_click_menu|save_image_as_error_description"),
|
||||||
@ -275,7 +275,7 @@ const userDownloadMap = new Map<number, string>(); // Map from id to path
|
|||||||
ipcMain.on("userDownloadAction", function (ev: IpcMainEvent, { id, open = false }) {
|
ipcMain.on("userDownloadAction", function (ev: IpcMainEvent, { id, open = false }) {
|
||||||
const path = userDownloadMap.get(id);
|
const path = userDownloadMap.get(id);
|
||||||
if (open && path) {
|
if (open && path) {
|
||||||
shell.openPath(path);
|
void shell.openPath(path);
|
||||||
}
|
}
|
||||||
userDownloadMap.delete(id);
|
userDownloadMap.delete(id);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user