Skip to content

Commit 8bcfc49

Browse files
committed
1.2.0
1 parent fd75077 commit 8bcfc49

File tree

12 files changed

+51
-170
lines changed

12 files changed

+51
-170
lines changed

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## [unreleased]
3+
## [1.2.0]
44
- Sprite Rotation
55
- Add zoom slider in sprites tab
66

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.4",
2+
"version": "1.2.0",
33
"scripts": {
44
"start": "electron ./static --dev"
55
},

scripts/Streets Of Rage 2.js

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

static/remote/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ configure your bundler appropriately to package the code of `@electron/remote`
5252
in the preload script. Of course, [using `@electron/remote` makes the sandbox
5353
much less effective][remote-considered-harmful].
5454

55-
**Note:** In `electron >= 14.0.0`, you must use the new `enable` API to enable the remote module for each desired `WebContents` separately: `require("@electron/remote/main").enable(webContents)`.
56-
57-
In `electron < 14.0.0`, `@electron/remote` respects the `enableRemoteModule` WebPreferences
55+
**Note:** `@electron/remote` respects the `enableRemoteModule` WebPreferences
5856
value. You must pass `{ webPreferences: { enableRemoteModule: true } }` to
5957
the constructor of `BrowserWindow`s that should be granted permission to use
6058
`@electron/remote`.
6159

60+
6261
# API Reference
6362

6463
The `remote` module provides a simple way to do inter-process communication
@@ -86,9 +85,7 @@ of the remote module:
8685
require('@electron/remote/main').initialize()
8786
```
8887

89-
**Note:** In `electron >= 14.0.0` the remote module is disabled by default for any `WebContents` instance and is only enabled for specified `WebContents` after explicitly calling `require("@electron/remote/main").enable(webContents)`.
90-
91-
In `electron < 14.0.0` the remote module can be disabled for security reasons in the following contexts:
88+
**Note:** The remote module can be disabled for security reasons in the following contexts:
9289
- [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`.
9390
- [`<webview>`](webview-tag.md) - by setting the `enableremotemodule` attribute to `false`.
9491

@@ -217,8 +214,8 @@ e.g.
217214
```sh
218215
project/
219216
├── main
220-
├── foo.js
221-
└── index.js
217+
   ├── foo.js
218+
   └── index.js
222219
├── package.json
223220
└── renderer
224221
└── index.js
@@ -342,4 +339,4 @@ Custom value can be returned by setting `event.returnValue`.
342339

343340
[rmi]: https://en.wikipedia.org/wiki/Java_remote_method_invocation
344341
[enumerable-properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties
345-
[remote-considered-harmful]: https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
342+
[remote-considered-harmful]: https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31

static/remote/dist/src/common/module-names.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@ exports.browserModuleNames = [
2929
'powerMonitor',
3030
'powerSaveBlocker',
3131
'protocol',
32-
'pushNotifications',
33-
'safeStorage',
3432
'screen',
3533
'session',
3634
'ShareMenu',
3735
'systemPreferences',
3836
'TopLevelWindow',
3937
'TouchBar',
4038
'Tray',
41-
'utilityProcess',
4239
'View',
4340
'webContents',
4441
'WebContentsView',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { initialize, enable } from "./server";
1+
export { initialize } from './server';

static/remote/dist/src/main/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.enable = exports.initialize = void 0;
3+
exports.initialize = void 0;
44
var server_1 = require("./server");
55
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return server_1.initialize; } });
6-
Object.defineProperty(exports, "enable", { enumerable: true, get: function () { return server_1.enable; } });
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import { WebContents } from 'electron';
2-
export declare const isRemoteModuleEnabled: (contents: WebContents) => boolean | undefined;
3-
export declare function enable(contents: WebContents): void;
2+
export declare const isRemoteModuleEnabled: (contents: WebContents) => any;
43
export declare function initialize(): void;

static/remote/dist/src/main/server.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33
return (mod && mod.__esModule) ? mod : { "default": mod };
44
};
55
Object.defineProperty(exports, "__esModule", { value: true });
6-
exports.initialize = exports.enable = exports.isRemoteModuleEnabled = void 0;
6+
exports.initialize = exports.isRemoteModuleEnabled = void 0;
77
const events_1 = require("events");
88
const objects_registry_1 = __importDefault(require("./objects-registry"));
99
const type_utils_1 = require("../common/type-utils");
1010
const electron_1 = require("electron");
1111
const get_electron_binding_1 = require("../common/get-electron-binding");
12-
const { Promise } = global;
1312
const v8Util = get_electron_binding_1.getElectronBinding('v8_util');
14-
const hasWebPrefsRemoteModuleAPI = (() => {
15-
var _a, _b;
16-
const electronVersion = Number((_b = (_a = process.versions.electron) === null || _a === void 0 ? void 0 : _a.split(".")) === null || _b === void 0 ? void 0 : _b[0]);
17-
return Number.isNaN(electronVersion) || electronVersion < 14;
18-
})();
1913
// The internal properties of Function.
2014
const FUNCTION_PROPERTIES = [
2115
'length', 'name', 'arguments', 'caller', 'prototype'
@@ -299,23 +293,19 @@ const isRemoteModuleEnabledImpl = function (contents) {
299293
};
300294
const isRemoteModuleEnabledCache = new WeakMap();
301295
const isRemoteModuleEnabled = function (contents) {
302-
if (hasWebPrefsRemoteModuleAPI && !isRemoteModuleEnabledCache.has(contents)) {
296+
if (!isRemoteModuleEnabledCache.has(contents)) {
303297
isRemoteModuleEnabledCache.set(contents, isRemoteModuleEnabledImpl(contents));
304298
}
305299
return isRemoteModuleEnabledCache.get(contents);
306300
};
307301
exports.isRemoteModuleEnabled = isRemoteModuleEnabled;
308-
function enable(contents) {
309-
isRemoteModuleEnabledCache.set(contents, true);
310-
}
311-
exports.enable = enable;
312302
const handleRemoteCommand = function (channel, handler) {
313303
electron_1.ipcMain.on(channel, (event, contextId, ...args) => {
314304
let returnValue;
315305
if (!exports.isRemoteModuleEnabled(event.sender)) {
316306
event.returnValue = {
317307
type: 'exception',
318-
value: valueToMeta(event.sender, contextId, new Error('@electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it.'))
308+
value: valueToMeta(event.sender, contextId, new Error('@electron/remote is disabled for this WebContents. Set {enableRemoteModule: true} in WebPreferences to enable it.'))
319309
};
320310
return;
321311
}
@@ -348,6 +338,8 @@ let initialized = false;
348338
function initialize() {
349339
if (initialized)
350340
throw new Error('@electron/remote has already been initialized');
341+
if (Number(process.versions.electron.split('.')[0]) >= 14)
342+
throw new Error('@electron/remote >= 2.x is required for Electron >= 14. See https://github.com/electron/remote/blob/main/docs/migration-2.md for migration instructions.');
351343
initialized = true;
352344
handleRemoteCommand("REMOTE_BROWSER_WRONG_CONTEXT_ERROR" /* BROWSER_WRONG_CONTEXT_ERROR */, function (event, contextId, passedContextId, id) {
353345
const objectId = [passedContextId, id];
@@ -441,8 +433,7 @@ function initialize() {
441433
return valueToMeta(event.sender, contextId, func(...args), true);
442434
}
443435
catch (error) {
444-
const err = new Error(`Could not call remote function '${func.name || "anonymous"}'. Check that the function signature is correct. Underlying error: ${error}\n` +
445-
(error instanceof Error ? `Underlying stack: ${error.stack}\n` : ""));
436+
const err = new Error(`Could not call remote function '${func.name || 'anonymous'}'. Check that the function signature is correct. Underlying error: ${error.message}\nUnderlying stack: ${error.stack}\n`);
446437
err.cause = error;
447438
throw err;
448439
}
@@ -465,8 +456,7 @@ function initialize() {
465456
return valueToMeta(event.sender, contextId, object[method](...args), true);
466457
}
467458
catch (error) {
468-
const err = new Error(`Could not call remote method '${method}'. Check that the method signature is correct. Underlying error: ${error}` +
469-
(error instanceof Error ? `Underlying stack: ${error.stack}\n` : ""));
459+
const err = new Error(`Could not call remote method '${method}'. Check that the method signature is correct. Underlying error: ${error.message}\nUnderlying stack: ${error.stack}\n`);
470460
err.cause = error;
471461
throw err;
472462
}

static/remote/dist/src/renderer/remote.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const type_utils_1 = require("../common/type-utils");
66
const electron_1 = require("electron");
77
const module_names_1 = require("../common/module-names");
88
const get_electron_binding_1 = require("../common/get-electron-binding");
9-
const { Promise } = global;
109
const callbacksRegistry = new callbacks_registry_1.CallbacksRegistry();
1110
const remoteObjectCache = new Map();
1211
const finalizationRegistry = new FinalizationRegistry((id) => {

0 commit comments

Comments
 (0)