Update Electron ~ fixes blue & light mode devtools

This commit is contained in:
Vendicated
2024-12-03 03:58:54 +01:00
parent 5d675efb64
commit 852410a43b
6 changed files with 944 additions and 552 deletions

View File

@@ -499,17 +499,5 @@ export async function createWindows() {
});
});
// evil hack to fix electron 32 regression that makes devtools always light theme
// https://github.com/electron/electron/issues/43367
// TODO: remove once fixed
mainWin.webContents.on("devtools-opened", () => {
if (!nativeTheme.shouldUseDarkColors) return;
nativeTheme.themeSource = "light";
setTimeout(() => {
nativeTheme.themeSource = "dark";
}, 100);
});
initArRPC();
}

View File

@@ -49,8 +49,8 @@ export function registerScreenShareHandler() {
if (isWayland) {
const video = data[0];
if (video) {
const stream = await request.frame
.executeJavaScript(
const stream = await request
.frame!.executeJavaScript(
`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify([video])},true)`
)
.catch(() => null);
@@ -61,8 +61,8 @@ export function registerScreenShareHandler() {
return;
}
const choice = await request.frame
.executeJavaScript(`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`)
const choice = await request
.frame!.executeJavaScript(`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`)
.then(e => e as StreamPick)
.catch(e => {
console.error("Error during screenshare picker", e);

View File

@@ -8,7 +8,9 @@ import { ipcMain, IpcMainEvent, IpcMainInvokeEvent, WebFrameMain } from "electro
import { DISCORD_HOSTNAMES } from "main/constants";
import { IpcEvents } from "shared/IpcEvents";
export function validateSender(frame: WebFrameMain) {
export function validateSender(frame: WebFrameMain | null) {
if (!frame) throw new Error("ipc: No sender frame");
const { hostname, protocol } = new URL(frame.url);
if (protocol === "file:") return;