Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Commit

Permalink
fix: use @electron/remote instead of electron.remote
Browse files Browse the repository at this point in the history
  • Loading branch information
bigspeedfpv committed Feb 11, 2023
1 parent 0cdfd9d commit bcb1ade
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 168 deletions.
225 changes: 65 additions & 160 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"main": "background.js",
"dependencies": {
"@electron/remote": "^2.0.9",
"adm-zip": "^0.5.5",
"core-js": "^3.6.5",
"electron-builder": "^23.0.2",
Expand Down
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<script>
const fs = require('fs');
const path = require('path');
const {remote} = require("electron");
const remote = require("@electron/remote");
export default {
name: 'DefaultFrame',
Expand All @@ -112,7 +112,8 @@ export default {
created: function () {
var self = this;
var rfn = path.join(path.dirname(remote.app.getAppPath()), "../src/support/")
var root = process.env.NODE_ENV === 'development' ? '.' : '..';
var rfn = path.join(path.dirname(remote.app.getAppPath()), `${root}/src/support/`)
console.log("Version tag path: "+rfn);
fs.readFile(path.join(rfn, "git_commit"), 'utf8' , (err, data) => {
Expand Down
8 changes: 7 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import { app, protocol, BrowserWindow, globalShortcut } from 'electron'
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
import * as remote from "@electron/remote/main";

remote.initialize();

const isDevelopment = process.env.NODE_ENV !== 'production'

Expand All @@ -22,10 +25,13 @@ async function createWindow() {
enableRemoteModule: true,
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
}
})

remote.enable(win.webContents);

win.setMenu(null);
win.setAutoHideMenuBar(true);

Expand Down
5 changes: 3 additions & 2 deletions src/components/FlashWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const fwbranch = require("../support/fw-branch.js");
const tmplog = require("../support/tmplog.js");
const fs = require('fs')
const path = require('path')
const {remote} = require("electron");
const remote = require("@electron/remote");
export default {
name: 'FlashWizard',
Expand Down Expand Up @@ -255,9 +255,10 @@ export default {
var self = this;
var platformstatus = "";
var root = process.env.NODE_ENV === 'development' ? '.' : '..';
const dfuPath = path.dirname(remote.app.getAppPath());
if (process.platform == "win32" && fs.statSync(path.join(dfuPath, "../src/support/dfu-util/win64/")).isDirectory()) {
if (process.platform == "win32" && fs.statSync(path.join(dfuPath, `${root}/src/support/dfu-util/win64/`)).isDirectory()) {
tmplog.addLog({
type: "dfuUtil.message",
msg: "Found DFU Util for Windows, path set."
Expand Down
5 changes: 3 additions & 2 deletions src/components/FlasherPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const fwbranch = require("../support/fw-branch.js");
const tmplog = require("../support/tmplog.js");
const fs = require('fs')
const path = require('path')
const {remote} = require("electron");
const remote = require("@electron/remote");
export default {
name: 'FlasherPage',
Expand Down Expand Up @@ -273,9 +273,10 @@ export default {
var self = this;
var platformstatus = "";
var root = process.env.NODE_ENV === 'development' ? '.' : '..';
const dfuPath = path.dirname(remote.app.getAppPath());
if (process.platform == "win32" && fs.statSync(path.join(dfuPath, "../src/support/dfu-util/win64/")).isDirectory()) {
if (process.platform == "win32" && fs.statSync(path.join(dfuPath, `${root}/src/support/dfu-util/win64/`)).isDirectory()) {
tmplog.addLog({
type: "dfuUtil.message",
msg: "Found DFU Util for Windows, path set."
Expand Down
2 changes: 1 addition & 1 deletion src/components/SettingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<script>
const tmplog = require("../support/tmplog.js");
const {clipboard} = require('electron');
const {app} = require('electron').remote;
const app = require('@electron/remote').app;
export default {
name: 'SettingsPage',
Expand Down

0 comments on commit bcb1ade

Please sign in to comment.