Skip to content

Commit cb4d819

Browse files
committed
chore: stabilize app with hybrid ESM/CJS setup and direct node module access
1 parent 284297f commit cb4d819

6 files changed

Lines changed: 21 additions & 24 deletions

File tree

app/browser/index.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<meta http-equiv="Content-Security-Policy"
77
content="script-src
8-
'sha256-RInT6N5e+S6307779U8X8u2mI6rFvWf90='
8+
'self'
9+
'sha256-Sofy9JCsccNlWq+ge2rU8DdPtdGQu/JHNBPq7buagak='
910
'nonce-a1b2c3d4'"
1011
/>
1112
<title>Heos Controller</title>
1213
<script type="importmap" nonce="a1b2c3d4">
1314
{
1415
"imports": {
15-
"jquery": "../../node_modules/jquery/dist-module/jquery.module.js",
16-
"bootstrap": "../../node_modules/bootstrap/dist/js/bootstrap.esm.js",
17-
"@popperjs/core": "../../node_modules/@popperjs/core/dist/umd/popper.min.js",
18-
"jquery-knob": "../../node_modules/jquery-knob/dist/jquery.knob.min.js"
16+
"jquery": "../node_modules/jquery/dist-module/jquery.module.js",
17+
"bootstrap": "../node_modules/bootstrap/dist/js/bootstrap.esm.js",
18+
"@popperjs/core": "../node_modules/@popperjs/core/dist/esm/popper.js",
19+
"jquery-knob": "../node_modules/jquery-knob/dist/jquery.knob.min.js"
1920
}
2021
}
2122
</script>
22-
<link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css">
23-
<link rel="stylesheet" href="../../node_modules/bootstrap-icons/font/bootstrap-icons.css">
23+
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
24+
<link rel="stylesheet" href="../node_modules/bootstrap-icons/font/bootstrap-icons.css">
2425
<link rel="stylesheet" href="index.css">
2526
<!-- Fix for https://bugs.chromium.org/p/chromium/issues/detail?id=641509 -->
2627
<style> ::selection { background: white; /* WebKit/Blink Browsers */ } </style>

app/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ app.on("ready", function() {
7474
height: 413,
7575
show: false,
7676
webPreferences: {
77-
contextIsolation: true,
78-
nodeIntegration: false,
77+
contextIsolation: false,
78+
nodeIntegration: true,
7979
sandbox: false,
8080
preload: path.join(__dirname, 'preload.cjs')
8181
}

app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"main": "index.js",
66
"private": true,
77
"license": "ISC",
8-
"version": "1.0.15",
8+
"version": "1.0.16",
99
"author": "Christopher Davison",
1010
"description": "Controller for Denon Heos speakers",
1111
"dependencies": {
1212
"bootstrap": "^5.3.8",
1313
"bootstrap-icons": "^1.11.3",
14+
"@popperjs/core": "^2.11.8",
1415
"electron-log": "^5.4.3",
1516
"electron-updater": "^6.8.3",
1617
"jquery": "^4.0.0",

app/preload.cjs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
const { contextBridge } = require('electron');
21
const dgram = require('dgram');
32
const net = require('net');
43
const os = require('os');
54

6-
contextBridge.exposeInMainWorld('nodeAPI', {
7-
dgram: {
8-
createSocket: dgram.createSocket
9-
},
10-
net: {
11-
createConnection: net.createConnection
12-
},
13-
os: {
14-
platform: os.platform,
15-
networkInterfaces: os.networkInterfaces
16-
}
17-
});
5+
window.nodeAPI = {
6+
dgram: dgram,
7+
net: net,
8+
os: os
9+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "heos-controller",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "Controller for Denon Heos speakers",
55
"repository": "https://github.com/cold-logic/heos-controller",
66
"main": "app/index.js",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)