kopia lustrzana https://github.com/dceejay/electron-node-red
add kiosk mode (dangerous)
rodzic
457537b15d
commit
28f7c6fbff
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Electron Main",
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||||
|
"program": "${workspaceFolder}/main.js"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -51,7 +51,7 @@ yarn && yarn dist -m // for mac
|
||||||
These will generally fail the first time through and you will need to install some extra library in order to make it
|
These will generally fail the first time through and you will need to install some extra library in order to make it
|
||||||
complete successfully.
|
complete successfully.
|
||||||
|
|
||||||
The defaults are to build a `.msi` for Windows, a `.dmg` for Mac and both a `.deb` and `.rpm` for Linux.
|
The defaults are to build a `.msi` for Windows, a `.dmg` for Mac, and both a `.deb` and `.rpm` for Linux.
|
||||||
These can be changed by editing the build section of the `package.json` file, see the
|
These can be changed by editing the build section of the `package.json` file, see the
|
||||||
[electron-builder config docs](https://www.electron.build/configuration/configuration) for more info.
|
[electron-builder config docs](https://www.electron.build/configuration/configuration) for more info.
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
16
main.js
16
main.js
|
@ -6,6 +6,7 @@
|
||||||
const editable = true; // Set this to false to create a run only application - no editor/no console
|
const editable = true; // Set this to false to create a run only application - no editor/no console
|
||||||
const allowLoadSave = false; // set to true to allow import and export of flow file
|
const allowLoadSave = false; // set to true to allow import and export of flow file
|
||||||
const showMap = false; // set to true to add Worldmap to the menu
|
const showMap = false; // set to true to add Worldmap to the menu
|
||||||
|
const kioskMode = false; // set to true to start in kiosk mode
|
||||||
|
|
||||||
let flowfile = 'electronflow.json'; // default Flows file name - loaded at start
|
let flowfile = 'electronflow.json'; // default Flows file name - loaded at start
|
||||||
const urldash = "/ui/#/0"; // Start on the dashboard page
|
const urldash = "/ui/#/0"; // Start on the dashboard page
|
||||||
|
@ -215,9 +216,11 @@ if (process.platform !== 'darwin') {
|
||||||
template[tempNum].submenu.push({ type: "separator" });
|
template[tempNum].submenu.push({ type: "separator" });
|
||||||
template[tempNum].submenu.push({ role: 'togglefullscreen' });
|
template[tempNum].submenu.push({ role: 'togglefullscreen' });
|
||||||
template[tempNum].submenu.push({ role: 'quit' });
|
template[tempNum].submenu.push({ role: 'quit' });
|
||||||
|
if (!showMap) { template[tempNum].submenu.splice(8,1); }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!showMap) { template[tempNum].submenu.splice(6,1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showMap) { template[tempNum].submenu.splice(8,1); }
|
|
||||||
|
|
||||||
if (!editable) {
|
if (!editable) {
|
||||||
template[tempNum].submenu.splice(3,1);
|
template[tempNum].submenu.splice(3,1);
|
||||||
|
@ -251,8 +254,7 @@ function saveFlow() {
|
||||||
function openFlow() {
|
function openFlow() {
|
||||||
dialog.showOpenDialog({ filters:[{ name:'JSON', extensions:['json']} ]},
|
dialog.showOpenDialog({ filters:[{ name:'JSON', extensions:['json']} ]},
|
||||||
function (fileNames) {
|
function (fileNames) {
|
||||||
if (fileNames) {
|
if (fileNames && fileNames.length > 0) {
|
||||||
//console.log(fileNames[0]);
|
|
||||||
fs.readFile(fileNames[0], 'utf-8', function (err, data) {
|
fs.readFile(fileNames[0], 'utf-8', function (err, data) {
|
||||||
try {
|
try {
|
||||||
var flo = JSON.parse(data);
|
var flo = JSON.parse(data);
|
||||||
|
@ -305,11 +307,11 @@ function createConsole() {
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
title: "Node-RED",
|
title: "Node-RED",
|
||||||
//titleBarStyle: "hidden",
|
|
||||||
width: 1024,
|
width: 1024,
|
||||||
height: 768,
|
height: 768,
|
||||||
icon: path.join(__dirname, nrIcon),
|
icon: path.join(__dirname, nrIcon),
|
||||||
fullscreenable: true,
|
fullscreenable: true,
|
||||||
|
kiosk: kioskMode,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: false
|
nodeIntegration: false
|
||||||
|
@ -327,8 +329,8 @@ function createWindow() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// mainWindow.webContents.on('did-finish-load', () => {
|
// mainWindow.webContents.on('did-finish-load', (a) => {
|
||||||
// console.log("LOADED DASHBOARD");
|
// console.log("FINISHED LOAD",a);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
mainWindow.webContents.on("new-window", function(e, url, frameName, disposition, options) {
|
mainWindow.webContents.on("new-window", function(e, url, frameName, disposition, options) {
|
||||||
|
|
Ładowanie…
Reference in New Issue