Skip to content

Commit 56966c3

Browse files
committed
[ electron ] electron.remote been deprecated, reworked to use "electron/remote" module.
1 parent 4982116 commit 56966c3

13 files changed

Lines changed: 271 additions & 253 deletions

File tree

docs/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Security
1515
-->
1616

17+
## v4.3.2 - 2026-01-02
18+
### Added
19+
### Changed
20+
* added `@electron/remote` module as a replacement for `electron.remote` which has been deprecated.
21+
### Deprecated
22+
### Removed
23+
### Fixed
24+
* loads of `showDialog()` calls used `electron.remote` and now use the remote from `@electron/remote` module.
25+
### Security
26+
1727
## v4.3.1 - 2026-01-02
1828
### Added
1929
* announcement system allows me to display notices on launch

index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ const extend = require("xtend");
1818
const ssbKeys = require("ssb-keys");
1919
const announcements = require("./lib/announcements.js");
2020

21+
require("@electron/remote/main").initialize();
22+
2123
const windows = {
2224
dialogs: new Set(),
2325
};
24-
const appIcon = nativeImage.createFromPath(
25-
Path.join(__dirname, "assets/512x512.png"),
26-
);
26+
const appIcon = nativeImage.createFromPath(
27+
Path.join(__dirname, "assets/512x512.png"),
28+
);
2729
let ssbConfig = null;
2830
let quitting = false;
2931

@@ -67,6 +69,7 @@ electron.app.on("ready", () => {
6769
process.argv.includes("--use-global-ssb")),
6870
}, () => {
6971
const browserWindow = openMainWindow();
72+
require("@electron/remote/main").enable(browserWindow.webContents)
7073

7174
browserWindow.on("app-command", (e, cmd) => {
7275
switch (cmd) {
@@ -314,7 +317,7 @@ function openMainWindow() {
314317
if (process.platform !== "darwin") electron.app.quit();
315318
});
316319
}
317-
windows.main.setIcon(appIcon)
320+
windows.main.setIcon(appIcon);
318321
return windows.main;
319322
}
320323

@@ -402,7 +405,7 @@ function setupContext(appName, opts, cb) {
402405
// ev.preventDefault()
403406
// windows.background.hide()
404407
// })
405-
windows.background.setIcon(appIcon)
408+
windows.background.setIcon(appIcon);
406409
}
407410
}
408411

@@ -425,11 +428,11 @@ function openAnnouncementsWindow() {
425428
announcements: announcements.getAsHTML(),
426429
show: true,
427430
backgroundColor: "#EEE",
428-
icon: appIcon
431+
icon: appIcon,
429432
},
430433
);
431434

432435
windows.announcements.setAlwaysOnTop(true);
433-
windows.announcements.setIcon(appIcon)
436+
windows.announcements.setIcon(appIcon);
434437
// windows.announcements.openDevTools()
435438
}

lib/depject/blogs/sheet/compose.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,10 @@ exports.create = function (api) {
276276
}
277277

278278
function showDialog(opts) {
279-
const electron = require("electron");
280-
electron.remote.dialog.showMessageBox(
281-
electron.remote.getCurrentWindow(),
279+
const remote = require('@electron/remote')
280+
281+
remote.dialog.showMessageBox(
282+
remote.getCurrentWindow(),
282283
opts,
283284
);
284285
}

lib/depject/books/sheet/review.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,10 @@ exports.create = function (api) {
201201
}
202202

203203
function showDialog(opts) {
204-
const electron = require("electron");
205-
electron.remote.dialog.showMessageBox(
206-
electron.remote.getCurrentWindow(),
204+
const remote = require("@electron/remote");
205+
206+
remote.dialog.showMessageBox(
207+
remote.getCurrentWindow(),
207208
opts,
208209
);
209210
}

lib/depject/contact/html/follow-toggle.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const nest = require('depnest')
22
const electron = require('electron')
3+
const remote = require('@electron/remote')
34
const { h, when, computed } = require('mutant')
45

56
exports.gives = nest('contact.html.followToggle')
@@ -93,8 +94,8 @@ exports.create = function (api) {
9394
? ignoring
9495
: status === false
9596

96-
const factor = electron.remote.getCurrentWindow().webContents.getZoomFactor()
97-
const menu = electron.remote.Menu.buildFromTemplate([
97+
const factor = remote.getCurrentWindow().webContents.getZoomFactor()
98+
const menu = remote.Menu.buildFromTemplate([
9899
{
99100
type: 'radio',
100101
label: i18n('Neutral'),
@@ -128,7 +129,7 @@ exports.create = function (api) {
128129
}
129130
])
130131
menu.popup({
131-
window: electron.remote.getCurrentWindow(),
132+
window: remote.getCurrentWindow(),
132133
x: Math.round(rects.left * factor),
133134
y: Math.round(rects.bottom * factor) + 4
134135
})

0 commit comments

Comments
 (0)