Skip to content

Commit

Permalink
Version 0.3.1 - Security fixes (#7)
Browse files Browse the repository at this point in the history
* Fixes security issues

* Updates version number to 0.3.1
  • Loading branch information
AntoineJT authored Aug 8, 2020
1 parent c606bc5 commit 9b4187a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function createWindow() {
width: windowWidth,
height: height,
webPreferences: {
nodeIntegration: true
nodeIntegration: false,
preload: path.join(app.getAppPath(), 'public/preload.js')
},
alwaysOnTop: true,
frame: false,
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liveapp-mvp",
"version": "0.3.0",
"version": "0.3.1",
"private": true,
"description": "A frontend for the WidgetBot discord bot",
"main": "index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="description" content="A frontend for the WidgetBot discord bot">
<meta http-equiv="Content-Security-Policy" content="script-src 'self';">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@500&display=swap" rel="stylesheet">
<title>Live App</title>
Expand All @@ -25,6 +26,6 @@
server="238975753969074177"
channel="718795219369328661">
</widgetbot>
<script src="https://cdn.jsdelivr.net/npm/@widgetbot/html-embed"></script>
<script src="thirdparty/widgetbot_html-embed.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions src/public/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const electron = require('electron');

process.once('loaded', () => {
global.ipcRenderer = electron.ipcRenderer;
});
6 changes: 6 additions & 0 deletions src/public/thirdparty/widgetbot_html-embed.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/public/titlebar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const { ipcRenderer } = require('electron')
// when no preloading is done, for pages with nodeIntegration enabled
if (ipcRenderer === undefined) {
global.ipcRenderer = require('electron')
}

document.getElementById('minimize').addEventListener('click', () => ipcRenderer.send('minimizeWindow'))
document.getElementById('close').addEventListener('click', () => ipcRenderer.send('closeWindow'))

0 comments on commit 9b4187a

Please sign in to comment.