Upgrade dependencies, including Electron 37.4.0.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-08-29 11:52:26 -07:00
parent 92a2b4eae9
commit 301fe26d80
8 changed files with 578 additions and 595 deletions

View File

@@ -37,6 +37,7 @@ export const configSchemata = {
useProxy: z.boolean(),
useSystemProxy: z.boolean(),
};
export type ConfigSchemata = typeof configSchemata;
export const enterpriseConfigSchemata = {
...configSchemata,

View File

@@ -7,12 +7,12 @@ import {DataError} from "node-json-db/dist/lib/Errors.js";
import type {z} from "zod";
import {app, dialog} from "zulip:remote";
import {configSchemata} from "./config-schemata.ts";
import {type ConfigSchemata, configSchemata} from "./config-schemata.ts";
import * as EnterpriseUtil from "./enterprise-util.ts";
import Logger from "./logger-util.ts";
export type Config = {
[Key in keyof typeof configSchemata]: z.output<(typeof configSchemata)[Key]>;
[Key in keyof ConfigSchemata]: z.output<ConfigSchemata[Key]>;
};
const logger = new Logger({
@@ -26,7 +26,7 @@ reloadDatabase();
export function getConfigItem<Key extends keyof Config>(
key: Key,
defaultValue: Config[Key],
): z.output<(typeof configSchemata)[Key]> {
): z.output<ConfigSchemata[Key]> {
try {
database.reload();
} catch (error: unknown) {
@@ -35,7 +35,13 @@ export function getConfigItem<Key extends keyof Config>(
}
try {
return configSchemata[key].parse(database.getObject<unknown>(`/${key}`));
const typedSchemata: {
[Key in keyof Config]: z.ZodType<
z.output<ConfigSchemata[Key]>,
z.input<ConfigSchemata[Key]>
>;
} = configSchemata; // https://github.com/colinhacks/zod/issues/5154
return typedSchemata[key].parse(database.getObject<unknown>(`/${key}`));
} catch (error: unknown) {
if (!(error instanceof DataError)) throw error;
setConfigItem(key, defaultValue);

View File

@@ -59,7 +59,7 @@ export const _getServerSettings = async (
} = z
.object({
realm_name: z.string(),
realm_uri: z.string().url(),
realm_uri: z.url(),
realm_icon: z.string(),
zulip_version: z.string().default("unknown"),
zulip_feature_level: z.number().default(0),

View File

@@ -1,3 +1,5 @@
import "./zod-config.ts"; // eslint-disable-line import-x/no-unassigned-import
import {clipboard} from "electron/common";
import path from "node:path";
import process from "node:process";

View File

@@ -24,7 +24,7 @@ const logger = new Logger({
export const defaultIconSentinel = "../renderer/img/icon.png";
const serverConfigSchema = z.object({
url: z.string().url(),
url: z.url(),
alias: z.string(),
icon: z.string(),
zulipVersion: z.string().default("unknown"),

View File

@@ -0,0 +1,6 @@
import * as z from "zod";
// In an Electron preload script, Content-Security-Policy only takes effect
// after the page has loaded, which breaks Zod's detection of whether eval is
// allowed.
z.config({jitless: true});

1142
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -175,7 +175,7 @@
"electron-updater": "^6.3.4",
"electron-window-state": "^5.0.3",
"escape-goat": "^4.0.0",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-import-resolver-typescript": "^4.4.4",
"htmlhint": "^1.1.2",
"i18n": "^0.15.1",
"i18next-parser": "^9.3.0",
@@ -192,7 +192,7 @@
"vite": "^5.0.11",
"vite-plugin-electron": "^0.28.0",
"xo": "^1.2.1",
"zod": "^3.5.1"
"zod": "^4.1.5"
},
"overrides": {
"@types/pg": "^8.15.1"