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
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
6 changed files with 944 additions and 552 deletions

View file

@ -25,34 +25,34 @@
}, },
"dependencies": { "dependencies": {
"arrpc": "github:OpenAsar/arrpc#5aadc307cb9bf4479f0a12364a253b07a77ace22", "arrpc": "github:OpenAsar/arrpc#5aadc307cb9bf4479f0a12364a253b07a77ace22",
"electron-updater": "^6.3.4" "electron-updater": "^6.3.9"
}, },
"optionalDependencies": { "optionalDependencies": {
"@vencord/venmic": "^6.1.0" "@vencord/venmic": "^6.1.0"
}, },
"devDependencies": { "devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2", "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@stylistic/eslint-plugin": "^2.8.0", "@stylistic/eslint-plugin": "^2.11.0",
"@types/node": "^22.5.5", "@types/node": "^22.10.1",
"@types/react": "^18.3.8", "@types/react": "^18.3.12",
"@vencord/types": "^1.8.4", "@vencord/types": "^1.8.4",
"dotenv": "^16.4.5", "dotenv": "^16.4.6",
"electron": "^33.0.2", "electron": "^33.2.1",
"electron-builder": "^25.0.5", "electron-builder": "^25.1.8",
"esbuild": "^0.23.1", "esbuild": "^0.24.0",
"eslint": "^9.11.0", "eslint": "^9.16.0",
"eslint-import-resolver-alias": "^1.1.2", "eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-path-alias": "^2.1.0", "eslint-plugin-path-alias": "^2.1.0",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-header": "^1.2.1", "eslint-plugin-simple-header": "^1.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"prettier": "^3.3.3", "prettier": "^3.4.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"tsx": "^4.19.1", "tsx": "^4.19.2",
"type-fest": "^4.26.1", "type-fest": "^4.30.0",
"typescript": "^5.6.2", "typescript": "^5.7.2",
"typescript-eslint": "^8.6.0", "typescript-eslint": "^8.17.0",
"xml-formatter": "^3.6.3" "xml-formatter": "^3.6.3"
}, },
"packageManager": "pnpm@9.1.0", "packageManager": "pnpm@9.1.0",

1440
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

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(); initArRPC();
} }

View file

@ -49,8 +49,8 @@ export function registerScreenShareHandler() {
if (isWayland) { if (isWayland) {
const video = data[0]; const video = data[0];
if (video) { if (video) {
const stream = await request.frame const stream = await request
.executeJavaScript( .frame!.executeJavaScript(
`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify([video])},true)` `Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify([video])},true)`
) )
.catch(() => null); .catch(() => null);
@ -61,8 +61,8 @@ export function registerScreenShareHandler() {
return; return;
} }
const choice = await request.frame const choice = await request
.executeJavaScript(`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`) .frame!.executeJavaScript(`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify(data)})`)
.then(e => e as StreamPick) .then(e => e as StreamPick)
.catch(e => { .catch(e => {
console.error("Error during screenshare picker", 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 { DISCORD_HOSTNAMES } from "main/constants";
import { IpcEvents } from "shared/IpcEvents"; 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); const { hostname, protocol } = new URL(frame.url);
if (protocol === "file:") return; if (protocol === "file:") return;

View file

@ -26,11 +26,11 @@ export class SettingsStore<T extends object> {
/** /**
* The store object. Making changes to this object will trigger the applicable change listeners * The store object. Making changes to this object will trigger the applicable change listeners
*/ */
public declare store: T; declare public store: T;
/** /**
* The plain data. Changes to this object will not trigger any change listeners * The plain data. Changes to this object will not trigger any change listeners
*/ */
public declare plain: T; declare public plain: T;
public constructor(plain: T) { public constructor(plain: T) {
this.plain = plain; this.plain = plain;