-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
out/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Commands | ||
|
||
build (curr os): `npm run make` | ||
build (windows): `npm run make:win` | ||
|
||
TODO: document command line args |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const { FusesPlugin } = require('@electron-forge/plugin-fuses'); | ||
const { FuseV1Options, FuseVersion } = require('@electron/fuses'); | ||
|
||
module.exports = { | ||
packagerConfig: { | ||
asar: true, | ||
}, | ||
rebuildConfig: {}, | ||
makers: [ | ||
{ | ||
name: '@electron-forge/maker-squirrel', | ||
config: {}, | ||
}, | ||
{ | ||
name: '@electron-forge/maker-zip', | ||
platforms: ['darwin', 'win32', 'linux'], | ||
}, | ||
], | ||
plugins: [ | ||
{ | ||
name: '@electron-forge/plugin-auto-unpack-natives', | ||
config: {}, | ||
}, | ||
// Fuses are used to enable/disable various Electron functionality | ||
// at package time, before code signing the application | ||
new FusesPlugin({ | ||
version: FuseVersion.V1, | ||
[FuseV1Options.RunAsNode]: false, | ||
[FuseV1Options.EnableCookieEncryption]: true, | ||
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, | ||
[FuseV1Options.EnableNodeCliInspectArguments]: false, | ||
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, | ||
[FuseV1Options.OnlyLoadAppFromAsar]: true, | ||
}), | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --> | ||
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">--> | ||
<title>Hello World!</title> | ||
</head> | ||
<body> | ||
<h1>Hello World!</h1> | ||
We are using Node.js <span id="node-version"></span>, | ||
Chromium <span id="chrome-version"></span>, | ||
and Electron <span id="electron-version"></span>. | ||
</body> | ||
|
||
<script> | ||
alert(window.electron.roomType); | ||
</script> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
const { app, BrowserWindow } = require('electron'); | ||
const path = require('node:path'); | ||
const { Command, Option } = require('commander'); | ||
|
||
const program = new Command(); | ||
|
||
program | ||
.addOption( | ||
new Option( | ||
'-v, --view <view>', | ||
'The view type you wish to load (audio or video)', | ||
) | ||
.default('audio') | ||
.choices(['audio', 'video']), | ||
) | ||
.addOption( | ||
new Option( | ||
'-rt, --room-type <room-type>', | ||
'The key of the active room type you wish to load.' | ||
) | ||
.default('active') | ||
) | ||
; | ||
|
||
program.parse(); | ||
|
||
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); | ||
|
||
function createWindow () { | ||
const { view, roomType } = program.opts(); | ||
const titleExtraOpts = [ | ||
roomType || null | ||
].filter(Boolean).join(','); | ||
|
||
const win = new BrowserWindow({ | ||
width: 1280, | ||
height: 720, | ||
// Vue is overwriting the title, this is just wasting cpu cycles. | ||
// But then again, we're using electron so who fucking cares lmao | ||
title: `VDO.Ninja Viewer - ${view === 'audio' ? 'Audio' : 'Video'} View ${titleExtraOpts.length ? `(${titleExtraOpts})` : ''}`, | ||
fullscreen: view === 'video', | ||
webPreferences: { | ||
backgroundThrottling: false, | ||
contextIsolation: true, | ||
nodeIntegration: true, | ||
preload: path.join(__dirname, 'preload.js'), | ||
additionalArguments: [ | ||
`roomType:${roomType}`, | ||
'applyDelay:false', // TODO: implement when we need this | ||
], | ||
}, | ||
}); | ||
|
||
win.loadURL(`http://localhost:9090/bundles/nodecg-vdoninja/graphics/${view}-view/main.html`).catch(console.error); | ||
} | ||
|
||
app.whenReady().then(() => { | ||
createWindow(); | ||
|
||
// Specific macos stuff, doubt we ever need this. | ||
app.on('activate', () => { | ||
if (BrowserWindow.getAllWindows().length === 0) { | ||
createWindow(); | ||
} | ||
}); | ||
}); | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); |