summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-27 13:32:35 +0200
committerRaindropsSys <contact@minteck.org>2023-04-27 13:32:35 +0200
commitade37c5b0ad6dc2c61be1efb5421862321ace805 (patch)
treeef0310a032fe9b9757dce3f9b15c7867b12cae2c
parent3661eadc63e4d2a240f88c18c4d50d12956d7223 (diff)
downloaddelta-kiosk-ade37c5b0ad6dc2c61be1efb5421862321ace805.tar.gz
delta-kiosk-ade37c5b0ad6dc2c61be1efb5421862321ace805.tar.bz2
delta-kiosk-ade37c5b0ad6dc2c61be1efb5421862321ace805.zip
Updated 4 files (automated)
-rwxr-xr-x[-rw-r--r--]build.sh2
-rw-r--r--index.html5
-rw-r--r--index.js19
-rw-r--r--kiosk.js8
4 files changed, 32 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index de1ee86..83aeeed 100644..100755
--- a/build.sh
+++ b/build.sh
@@ -1,4 +1,4 @@
#!/bin/bash
electron-packager --overwrite --platform darwin --arch arm64 .
-electron-packager --overwrite --platform linux --arch x64 . \ No newline at end of file
+electron-packager --overwrite --platform win32 --arch x64 . \ No newline at end of file
diff --git a/index.html b/index.html
index c191504..9ace65f 100644
--- a/index.html
+++ b/index.html
@@ -211,6 +211,11 @@
window.authApprovalInterval = setInterval(async () => {
let data = JSON.parse(await (await window.fetch(server + "/dev.equestria.delta.kiosk.CheckApproved/?id=" + window.authId)).text());
if (data['token']) {
+ remote.webContents.fromId(document.getElementById("webview").getWebContentsId()).setWindowOpenHandler((details) => {
+ return {
+ action: 'deny'
+ };
+ });
remote.webContents.fromId(document.getElementById("webview").getWebContentsId()).session.cookies.set({
url: "https://delta.equestria.dev",
name: "DeltaLanguage",
diff --git a/index.js b/index.js
index 091ff58..4a6dc32 100644
--- a/index.js
+++ b/index.js
@@ -1,4 +1,5 @@
-const { app, BrowserWindow, Menu, ipcMain, MenuItem } = require('electron');
+const { app, BrowserWindow, Menu, ipcMain, MenuItem, globalShortcut, shell} = require('electron');
+const os = require("os");
require('@electron/remote/main').initialize();
const createWindow = () => {
@@ -6,6 +7,8 @@ const createWindow = () => {
width: 800,
height: 600,
fullscreen: true,
+ kiosk: os.platform() === "win32",
+ autoHideMenuBar: true,
title: "Delta Kiosk",
webPreferences: {
nodeIntegration: true,
@@ -113,12 +116,26 @@ const createWindow = () => {
})
]);
+ mainWindow.webContents.setWindowOpenHandler((details) => {
+ return {
+ action: 'deny'
+ };
+ });
+
+ mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
+ item.cancel()
+ })
+
mainWindow.setMenu(menu);
Menu.setApplicationMenu(menu);
mainWindow.loadFile('index.html');
}
app.whenReady().then(() => {
+ globalShortcut.register('Ctrl+Esc', () => {
+ console.log('Disabled Windows key')
+ })
+
createWindow()
})
diff --git a/kiosk.js b/kiosk.js
index 640dcb3..24760f0 100644
--- a/kiosk.js
+++ b/kiosk.js
@@ -9,4 +9,12 @@ contextBridge.exposeInMainWorld('kiosk', {
}
});
+setInterval(() => {
+ for (let item of Array.from(document.querySelectorAll('input[type="file"]'))) {
+ item.disabled = true;
+ }
+
+ window.showOpenFilePicker = null;
+});
+
console.log("Preloaded kiosk additions"); \ No newline at end of file