mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-24 00:23:36 +00:00
Upgrade dependencies, including Electron 18.0.1.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {Buffer} from "buffer";
|
||||
import crypto from "crypto";
|
||||
import {clipboard} from "electron/common";
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import type {
|
||||
ContextMenuParams,
|
||||
MenuItemConstructorOptions,
|
||||
} from "electron/renderer";
|
||||
import process from "process";
|
||||
|
||||
import {Menu} from "@electron/remote";
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import process from "process";
|
||||
|
||||
import type {Html} from "../../../common/html";
|
||||
import {html} from "../../../common/html";
|
||||
import {ipcRenderer} from "../typed-ipc-renderer";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {WebContents} from "electron/main";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
|
||||
import * as remote from "@electron/remote";
|
||||
import {app, dialog} from "@electron/remote";
|
||||
@@ -34,34 +35,6 @@ interface WebViewProps {
|
||||
}
|
||||
|
||||
export default class WebView {
|
||||
props: WebViewProps;
|
||||
zoomFactor: number;
|
||||
badgeCount: number;
|
||||
loading: boolean;
|
||||
customCss: string | false | null;
|
||||
$webviewsContainer: DOMTokenList;
|
||||
$el: HTMLElement;
|
||||
webContentsId: number;
|
||||
|
||||
private constructor(
|
||||
props: WebViewProps,
|
||||
$element: HTMLElement,
|
||||
webContentsId: number,
|
||||
) {
|
||||
this.props = props;
|
||||
this.zoomFactor = 1;
|
||||
this.loading = true;
|
||||
this.badgeCount = 0;
|
||||
this.customCss = ConfigUtil.getConfigItem("customCSS", null);
|
||||
this.$webviewsContainer = document.querySelector(
|
||||
"#webviews-container",
|
||||
)!.classList;
|
||||
this.$el = $element;
|
||||
this.webContentsId = webContentsId;
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
static templateHtml(props: WebViewProps): Html {
|
||||
return html`
|
||||
<webview
|
||||
@@ -119,6 +92,34 @@ export default class WebView {
|
||||
return new WebView(props, $element, webContentsId);
|
||||
}
|
||||
|
||||
props: WebViewProps;
|
||||
zoomFactor: number;
|
||||
badgeCount: number;
|
||||
loading: boolean;
|
||||
customCss: string | false | null;
|
||||
$webviewsContainer: DOMTokenList;
|
||||
$el: HTMLElement;
|
||||
webContentsId: number;
|
||||
|
||||
private constructor(
|
||||
props: WebViewProps,
|
||||
$element: HTMLElement,
|
||||
webContentsId: number,
|
||||
) {
|
||||
this.props = props;
|
||||
this.zoomFactor = 1;
|
||||
this.loading = true;
|
||||
this.badgeCount = 0;
|
||||
this.customCss = ConfigUtil.getConfigItem("customCSS", null);
|
||||
this.$webviewsContainer = document.querySelector(
|
||||
"#webviews-container",
|
||||
)!.classList;
|
||||
this.$el = $element;
|
||||
this.webContentsId = webContentsId;
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
getWebContents(): WebContents {
|
||||
return remote.webContents.fromId(this.webContentsId);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ let lastActive = Date.now();
|
||||
|
||||
export const bridgeEvents = new EventEmitter();
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const electron_bridge: ElectronBridge = {
|
||||
send_event: (eventName: string | symbol, ...args: unknown[]): boolean =>
|
||||
bridgeEvents.emit(eventName, ...args),
|
||||
@@ -59,6 +60,7 @@ const electron_bridge: ElectronBridge = {
|
||||
decrypt_clipboard: (version: number): ClipboardDecrypter =>
|
||||
new ClipboardDecrypterImpl(version),
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
bridgeEvents.on("total_unread_count", (unreadCount: unknown) => {
|
||||
if (typeof unreadCount !== "number") {
|
||||
|
||||
@@ -14,6 +14,7 @@ interface CompatElectronBridge extends ElectronBridge {
|
||||
raw_electron_bridge: ElectronBridge;
|
||||
};
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const electron_bridge: CompatElectronBridge = {
|
||||
...zulipWindow.raw_electron_bridge,
|
||||
|
||||
@@ -33,6 +34,7 @@ interface CompatElectronBridge extends ElectronBridge {
|
||||
this.set_send_notification_reply_message_supported(value);
|
||||
},
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
|
||||
zulipWindow.electron_bridge = electron_bridge;
|
||||
|
||||
@@ -68,26 +70,10 @@ interface CompatElectronBridge extends ElectronBridge {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const NativeNotification = Notification;
|
||||
|
||||
class InjectedNotification extends EventTarget {
|
||||
constructor(title: string, options: NotificationOptions = {}) {
|
||||
super();
|
||||
Object.assign(
|
||||
this,
|
||||
electron_bridge.new_notification(
|
||||
title,
|
||||
options,
|
||||
(type: string, eventInit: EventInit) =>
|
||||
this.dispatchEvent(new Event(type, eventInit)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static get maxActions(): number {
|
||||
return NativeNotification.maxActions;
|
||||
}
|
||||
|
||||
static get permission(): NotificationPermission {
|
||||
return NativeNotification.permission;
|
||||
}
|
||||
@@ -101,6 +87,19 @@ interface CompatElectronBridge extends ElectronBridge {
|
||||
|
||||
return NativeNotification.permission;
|
||||
}
|
||||
|
||||
constructor(title: string, options: NotificationOptions = {}) {
|
||||
super();
|
||||
Object.assign(
|
||||
this,
|
||||
electron_bridge.new_notification(
|
||||
title,
|
||||
options,
|
||||
(type: string, eventInit: EventInit) =>
|
||||
this.dispatchEvent(new Event(type, eventInit)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperties(InjectedNotification.prototype, {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {clipboard} from "electron/common";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
|
||||
import {Menu, app, dialog, session} from "@electron/remote";
|
||||
import * as remote from "@electron/remote";
|
||||
@@ -179,6 +180,7 @@ export class ServerManagerView {
|
||||
autoUpdate: true,
|
||||
betaUpdate: false,
|
||||
errorReporting: true,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
customCSS: false,
|
||||
silent: false,
|
||||
lastActiveTab: 0,
|
||||
|
||||
@@ -7,16 +7,8 @@ export interface NotificationData {
|
||||
lang: string;
|
||||
body: string;
|
||||
tag: string;
|
||||
image: string;
|
||||
icon: string;
|
||||
badge: string;
|
||||
vibrate: readonly number[];
|
||||
timestamp: number;
|
||||
renotify: boolean;
|
||||
silent: boolean;
|
||||
requireInteraction: boolean;
|
||||
data: unknown;
|
||||
actions: readonly NotificationAction[];
|
||||
}
|
||||
|
||||
export function newNotification(
|
||||
@@ -43,15 +35,7 @@ export function newNotification(
|
||||
lang: notification.lang,
|
||||
body: notification.body,
|
||||
tag: notification.tag,
|
||||
image: notification.image,
|
||||
icon: notification.icon,
|
||||
badge: notification.badge,
|
||||
vibrate: notification.vibrate,
|
||||
timestamp: notification.timestamp,
|
||||
renotify: notification.renotify,
|
||||
silent: notification.silent,
|
||||
requireInteraction: notification.requireInteraction,
|
||||
data: notification.data,
|
||||
actions: notification.actions,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ export function generateOptionHtml(
|
||||
disabled?: boolean,
|
||||
): Html {
|
||||
const labelHtml = disabled
|
||||
? html`<label
|
||||
? // eslint-disable-next-line unicorn/template-indent
|
||||
html`<label
|
||||
class="disallowed"
|
||||
title="Setting locked by system administrator."
|
||||
></label>`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {OpenDialogOptions} from "electron/renderer";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
|
||||
import * as remote from "@electron/remote";
|
||||
import {app, dialog, session} from "@electron/remote";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import process from "process";
|
||||
|
||||
import type {DndSettings} from "../../../../common/dnd-util";
|
||||
import {html} from "../../../../common/html";
|
||||
import type {NavItem} from "../../../../common/types";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import process from "process";
|
||||
|
||||
import {html} from "../../../../common/html";
|
||||
import * as LinkUtil from "../../../../common/link-util";
|
||||
import * as t from "../../../../common/translation-util";
|
||||
|
||||
@@ -2,6 +2,7 @@ import type {NativeImage} from "electron/common";
|
||||
import {nativeImage} from "electron/common";
|
||||
import type {Tray as ElectronTray} from "electron/main";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
|
||||
import {BrowserWindow, Menu, Tray} from "@electron/remote";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user