initial app

This commit is contained in:
2024-05-28 14:25:32 +02:00
parent 64076733e8
commit bae9cf8d53
8 changed files with 9450 additions and 1 deletions
+18 -1
View File
@@ -1,2 +1,19 @@
# tooloop-kiosk-browser https://www.electronjs.org/docs/latest/tutorial/quick-start
# Dev environment
```bash
sudp apt install node
sudp apt install npm
sudo apt install rpm
npm install
# https://github.com/electron/electron/issues/17972
sudo chown root chrome-sandbox
chmod 4755 chrome-sandbox
npm run make
./out/tooloop-kiosk-browser-linux-x64/tooloop-kiosk-browser --no-sandbox
```
+3
View File
@@ -0,0 +1,3 @@
{
"url": "https://annahöfe.sign.tooloop.de/de/screens/annahof"
}
+44
View File
@@ -0,0 +1,44 @@
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'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
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,
}),
],
};
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using Node.js <span id="node-version"></span>,
Chromium <span id="chrome-version"></span>,
and Electron <span id="electron-version"></span>.
</p>
</body>
</html>
+65
View File
@@ -0,0 +1,65 @@
const { app, BrowserWindow } = require('electron/main')
const path = require('node:path')
const fs = require("fs");
let url = 'https://www.tooloop.de';
let config;
let mainWindow;
function loadConfig() {
fs.readFile(path.join(__dirname, "config.json"), "utf8", (error, data) => {
if (error) {
console.log(error);
return;
}
config = JSON.parse(data);
console.log(config);
});
}
function createWindow() {
mainWindow = new BrowserWindow({
width: 1920,
height: 1080,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: true,
webSecurity: false,
},
show: false,
autoHideMenuBar: true
});
mainWindow.loadFile('index.html');
// mainWindow.loadURL(url);
mainWindow.on("closed", function () {
mainWindow = null;
});
mainWindow.once("ready-to-show", () => {
mainWindow.setKiosk(true);
mainWindow.show();
});
}
app.whenReady().then(() => {
loadConfig();
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
})
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
});
+9255
View File
File diff suppressed because it is too large Load Diff
+36
View File
@@ -0,0 +1,36 @@
{
"dependencies": {
"electron-icon-builder": "^2.0.1",
"electron-squirrel-startup": "^1.0.1"
},
"name": "tooloop-kiosk-browser",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"repository": {
"type": "git",
"url": "http://code.tooloop.de/Tooloop/tooloop-kiosk-browser.git"
},
"author": {
"name": "Tooloop Multimedia",
"email": "info@tooloop.de",
"url": "https://www.tooloop.de/"
},
"license": "ISC",
"description": "Kiosk browser for digital signage applications",
"devDependencies": {
"@electron-forge/cli": "^7.4.0",
"@electron-forge/maker-deb": "^7.4.0",
"@electron-forge/maker-rpm": "^7.4.0",
"@electron-forge/maker-squirrel": "^7.4.0",
"@electron-forge/maker-zip": "^7.4.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
"@electron-forge/plugin-fuses": "^7.4.0",
"@electron/fuses": "^1.8.0",
"electron": "30.0.8"
}
}
+10
View File
@@ -0,0 +1,10 @@
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const type of ['chrome', 'node', 'electron']) {
replaceText(`${type}-version`, process.versions[type])
}
})