Skip to content

Commit 123bd5b

Browse files
committed
preload: Drop compatibility injected JS for Zulip Server < 3.0.
The server was updated in a6fee2f18ef9d2ef6ac248e9ed82d580daff1a07 (3.0-dev~1674) and e701f208619b8b9b28a85f84ee16cf8d8df82b72 (3.0-dev~1667) to avoid relying on this wrapper. We no longer support servers older than 3.0, so we can delete it. Signed-off-by: Anders Kaseorg <[email protected]>
1 parent ad771c3 commit 123bd5b

File tree

6 files changed

+2
-146
lines changed

6 files changed

+2
-146
lines changed

app/common/typed-ipc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export type MainMessage = {
77
"fetch-user-agent": () => string;
88
"focus-app": () => void;
99
"focus-this-webview": () => void;
10-
"get-injected-js": () => string;
1110
"new-clipboard-key": () => {key: Uint8Array; sig: Uint8Array};
1211
"permission-callback": (permissionCallbackId: number, grant: boolean) => void;
1312
"quit-app": () => void;

app/main/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {IpcMainEvent, WebContents} from "electron/main";
33
import {BrowserWindow, app, dialog, powerMonitor, session} from "electron/main";
44
import {Buffer} from "node:buffer";
55
import crypto from "node:crypto";
6-
import fs from "node:fs";
76
import path from "node:path";
87
import process from "node:process";
98

@@ -206,13 +205,6 @@ function createMainWindow(): BrowserWindow {
206205
configureSpellChecker();
207206
ipcMain.on("configure-spell-checker", configureSpellChecker);
208207

209-
ipcMain.on("get-injected-js", (event) => {
210-
event.returnValue = fs.readFileSync(
211-
path.join(bundlePath, "injected.js"),
212-
"utf8",
213-
);
214-
});
215-
216208
const clipboardSigKey = crypto.randomBytes(32);
217209

218210
ipcMain.on("new-clipboard-key", (event) => {

app/renderer/js/injected.ts

Lines changed: 0 additions & 113 deletions
This file was deleted.

app/renderer/js/preload.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {contextBridge, webFrame} from "electron/renderer";
1+
import {contextBridge} from "electron/renderer";
22

33
import electron_bridge, {bridgeEvents} from "./electron-bridge.js";
44
import * as NetworkError from "./pages/network.js";
55
import {ipcRenderer} from "./typed-ipc-renderer.js";
66

7-
contextBridge.exposeInMainWorld("raw_electron_bridge", electron_bridge);
7+
contextBridge.exposeInMainWorld("electron_bridge", electron_bridge);
88

99
ipcRenderer.on("logout", () => {
1010
if (bridgeEvents.emit("logout")) {
@@ -73,6 +73,3 @@ window.addEventListener("load", () => {
7373
const $settingsButton = document.querySelector("#settings")!;
7474
NetworkError.init($reconnectButton, $settingsButton);
7575
});
76-
77-
(async () =>
78-
webFrame.executeJavaScript(ipcRenderer.sendSync("get-injected-js")))();

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@
302302
},
303303
{
304304
"files": [
305-
"app/renderer/js/injected.ts",
306305
"scripts/notarize.js",
307306
"tests/**/*.js"
308307
],

vite.config.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@ import * as path from "node:path";
55
import {defineConfig} from "vite";
66
import electron from "vite-plugin-electron";
77

8-
let resolveInjected: () => void;
98
let resolvePreload: () => void;
109
let resolveRenderer: () => void;
11-
const whenInjected = new Promise<void>((resolve) => {
12-
resolveInjected = resolve;
13-
});
1410
const whenPreload = new Promise<void>((resolve) => {
1511
resolvePreload = resolve;
1612
});
@@ -26,7 +22,6 @@ export default defineConfig({
2622
index: "app/main",
2723
},
2824
async onstart({startup}) {
29-
await whenInjected;
3025
await whenPreload;
3126
await whenRenderer;
3227
await startup();
@@ -49,19 +44,6 @@ export default defineConfig({
4944
},
5045
},
5146
},
52-
{
53-
entry: {
54-
injected: "app/renderer/js/injected.ts",
55-
},
56-
onstart() {
57-
resolveInjected();
58-
},
59-
vite: {
60-
build: {
61-
sourcemap: "inline",
62-
},
63-
},
64-
},
6547
{
6648
entry: {
6749
preload: "app/renderer/js/preload.ts",

0 commit comments

Comments
 (0)