mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-01 20:43:33 +00:00
Switch electron.remote to @electron/remote.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import electron from "electron";
|
||||
|
||||
export const {app, dialog} =
|
||||
process.type === "renderer" ? electron.remote : electron;
|
||||
process.type === "renderer"
|
||||
? // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
||||
(require("@electron/remote") as typeof import("@electron/remote"))
|
||||
: electron;
|
||||
|
||||
@@ -2,6 +2,7 @@ import electron, {app, dialog, session} from "electron";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import * as remoteMain from "@electron/remote/main";
|
||||
import windowStateKeeper from "electron-window-state";
|
||||
|
||||
import * as ConfigUtil from "../common/config-util";
|
||||
@@ -66,7 +67,6 @@ function createMainWindow(): Electron.BrowserWindow {
|
||||
minHeight: 400,
|
||||
webPreferences: {
|
||||
contextIsolation: false,
|
||||
enableRemoteModule: true,
|
||||
nodeIntegration: true,
|
||||
partition: "persist:webviewsession",
|
||||
webviewTag: true,
|
||||
@@ -74,6 +74,7 @@ function createMainWindow(): Electron.BrowserWindow {
|
||||
},
|
||||
show: false,
|
||||
});
|
||||
remoteMain.enable(win.webContents);
|
||||
|
||||
win.on("focus", () => {
|
||||
send(win.webContents, "focus");
|
||||
@@ -145,6 +146,8 @@ function createMainWindow(): Electron.BrowserWindow {
|
||||
// Used for notifications on Windows
|
||||
app.setAppUserModelId("org.zulip.zulip-electron");
|
||||
|
||||
remoteMain.initialize();
|
||||
|
||||
app.on("second-instance", () => {
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import type {ContextMenuParams} from "electron";
|
||||
import {remote} from "electron";
|
||||
|
||||
import {Menu, clipboard} from "@electron/remote";
|
||||
|
||||
import * as t from "../../../common/translation-util";
|
||||
|
||||
const {clipboard, Menu} = remote;
|
||||
|
||||
export const contextMenu = (
|
||||
webContents: Electron.WebContents,
|
||||
event: Event,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {remote} from "electron";
|
||||
import {app, shell} from "@electron/remote";
|
||||
|
||||
import * as ConfigUtil from "../../../common/config-util";
|
||||
import {ipcRenderer} from "../typed-ipc-renderer";
|
||||
@@ -6,8 +6,6 @@ import * as LinkUtil from "../utils/link-util";
|
||||
|
||||
import type WebView from "./webview";
|
||||
|
||||
const {shell, app} = remote;
|
||||
|
||||
const dingSound = new Audio("../resources/sounds/ding.ogg");
|
||||
|
||||
export default function handleExternalLink(
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import {remote} from "electron";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import * as remote from "@electron/remote";
|
||||
import {app, dialog} from "@electron/remote";
|
||||
|
||||
import * as ConfigUtil from "../../../common/config-util";
|
||||
import {HTML, html} from "../../../common/html";
|
||||
import type {RendererMessage} from "../../../common/typed-ipc";
|
||||
@@ -13,8 +15,6 @@ import {generateNodeFromHTML} from "./base";
|
||||
import {contextMenu} from "./context-menu";
|
||||
import handleExternalLink from "./handle-external-link";
|
||||
|
||||
const {app, dialog} = remote;
|
||||
|
||||
const shouldSilentWebview = ConfigUtil.getConfigItem("silent", false);
|
||||
|
||||
interface WebViewProps {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import {clipboard, remote} from "electron";
|
||||
import {clipboard} from "electron";
|
||||
import path from "path";
|
||||
|
||||
import {Menu, app, dialog, session} from "@electron/remote";
|
||||
import * as remote from "@electron/remote";
|
||||
|
||||
import type {Config} from "../../common/config-util";
|
||||
import * as ConfigUtil from "../../common/config-util";
|
||||
import * as DNDUtil from "../../common/dnd-util";
|
||||
@@ -21,8 +24,6 @@ import * as DomainUtil from "./utils/domain-util";
|
||||
import * as LinkUtil from "./utils/link-util";
|
||||
import ReconnectUtil from "./utils/reconnect-util";
|
||||
|
||||
const {session, app, Menu, dialog} = remote;
|
||||
|
||||
type WebviewListener =
|
||||
| "webview-reload"
|
||||
| "back"
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import {remote} from "electron";
|
||||
import {app} from "@electron/remote";
|
||||
|
||||
import {html} from "../../../common/html";
|
||||
|
||||
const {app} = remote;
|
||||
|
||||
export class AboutView {
|
||||
readonly $view: HTMLElement;
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type {OpenDialogOptions} from "electron";
|
||||
import {remote} from "electron";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import * as remote from "@electron/remote";
|
||||
import {app, dialog, session} from "@electron/remote";
|
||||
import Tagify from "@yaireo/tagify";
|
||||
import ISO6391 from "iso-639-1";
|
||||
import * as z from "zod";
|
||||
@@ -16,7 +17,6 @@ import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
|
||||
import {generateSelectHTML, generateSettingOption} from "./base-section";
|
||||
|
||||
const {app, dialog, session} = remote;
|
||||
const currentBrowserWindow = remote.getCurrentWindow();
|
||||
|
||||
interface GeneralSectionProps {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {remote} from "electron";
|
||||
import {dialog} from "@electron/remote";
|
||||
|
||||
import {html} from "../../../../common/html";
|
||||
import * as t from "../../../../common/translation-util";
|
||||
@@ -7,8 +7,6 @@ import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
import * as DomainUtil from "../../utils/domain-util";
|
||||
import * as LinkUtil from "../../utils/link-util";
|
||||
|
||||
const {dialog} = remote;
|
||||
|
||||
interface NewServerFormProps {
|
||||
$root: Element;
|
||||
onChange: () => void;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {remote} from "electron";
|
||||
import {dialog} from "@electron/remote";
|
||||
|
||||
import {html} from "../../../../common/html";
|
||||
import * as Messages from "../../../../common/messages";
|
||||
@@ -8,8 +8,6 @@ import {generateNodeFromHTML} from "../../components/base";
|
||||
import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
import * as DomainUtil from "../../utils/domain-util";
|
||||
|
||||
const {dialog} = remote;
|
||||
|
||||
interface ServerInfoFormProps {
|
||||
$root: Element;
|
||||
server: ServerConf;
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import type {NativeImage} from "electron";
|
||||
import {remote} from "electron";
|
||||
import path from "path";
|
||||
|
||||
import {BrowserWindow, Menu, Tray, nativeImage} from "@electron/remote";
|
||||
|
||||
import * as ConfigUtil from "../../common/config-util";
|
||||
import type {RendererMessage} from "../../common/typed-ipc";
|
||||
|
||||
import type {ServerManagerView} from "./main";
|
||||
import {ipcRenderer} from "./typed-ipc-renderer";
|
||||
|
||||
const {Tray, Menu, nativeImage, BrowserWindow} = remote;
|
||||
|
||||
let tray: Electron.Tray | null = null;
|
||||
|
||||
const ICON_DIR = "../../resources/tray";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {remote} from "electron";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import {app, dialog} from "@electron/remote";
|
||||
import {JsonDB} from "node-json-db";
|
||||
import {DataError} from "node-json-db/dist/lib/Errors";
|
||||
import * as z from "zod";
|
||||
@@ -12,8 +12,6 @@ import * as Messages from "../../../common/messages";
|
||||
import type {ServerConf} from "../../../common/types";
|
||||
import {ipcRenderer} from "../typed-ipc-renderer";
|
||||
|
||||
const {app, dialog} = remote;
|
||||
|
||||
const logger = new Logger({
|
||||
file: "domain-util.log",
|
||||
});
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -425,6 +425,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@electron/remote": {
|
||||
"version": "github:andersk/electron-remote#9436ea742cf2e7a56780be0a079c6a490ff5540d",
|
||||
"from": "github:andersk/electron-remote#2.0.6-fixes"
|
||||
},
|
||||
"@electron/universal": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.0.5.tgz",
|
||||
|
||||
@@ -146,6 +146,7 @@
|
||||
"InstantMessaging"
|
||||
],
|
||||
"dependencies": {
|
||||
"@electron/remote": "github:andersk/electron-remote#2.0.6-fixes",
|
||||
"@sentry/electron": "^2.5.1",
|
||||
"@yaireo/tagify": "^4.5.0",
|
||||
"adm-zip": "^0.5.5",
|
||||
|
||||
Reference in New Issue
Block a user