|
|
|
@ -1,4 +1,4 @@ |
|
|
|
const { app, BrowserWindow, shell, dialog } = require("electron") |
|
|
|
const { app, BrowserWindow, shell, dialog, Menu } = require("electron") |
|
|
|
const { join } = require("./utilities/centralPath") |
|
|
|
const isDev = require("electron-is-dev") |
|
|
|
const { autoUpdater } = require("electron-updater") |
|
|
|
@ -8,7 +8,7 @@ const initialiseBudibase = require("./utilities/initialiseBudibase") |
|
|
|
const { budibaseAppsDir } = require("./utilities/budibaseDir") |
|
|
|
const { openNewGitHubIssue, debugInfo } = require("electron-util") |
|
|
|
const eventEmitter = require("./events") |
|
|
|
|
|
|
|
const isMac = process.platform === "darwin" |
|
|
|
const budibaseDir = budibaseAppsDir() |
|
|
|
const envFile = join(budibaseDir, ".env") |
|
|
|
|
|
|
|
@ -87,6 +87,116 @@ async function startApp() { |
|
|
|
// dock icon is clicked and there are no other windows open.
|
|
|
|
if (win === null) createWindow() |
|
|
|
}) |
|
|
|
|
|
|
|
const template = [ |
|
|
|
// { role: 'appMenu' }
|
|
|
|
...(isMac |
|
|
|
? [ |
|
|
|
{ |
|
|
|
label: app.name, |
|
|
|
submenu: [ |
|
|
|
{ role: "about" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "services" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "hide" }, |
|
|
|
{ role: "hideothers" }, |
|
|
|
{ role: "unhide" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "quit" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
] |
|
|
|
: []), |
|
|
|
// { role: 'fileMenu' }
|
|
|
|
{ |
|
|
|
label: "File", |
|
|
|
submenu: [isMac ? { role: "close" } : { role: "quit" }], |
|
|
|
}, |
|
|
|
// { role: 'editMenu' }
|
|
|
|
{ |
|
|
|
label: "Edit", |
|
|
|
submenu: [ |
|
|
|
{ role: "undo" }, |
|
|
|
{ role: "redo" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "cut" }, |
|
|
|
{ role: "copy" }, |
|
|
|
{ role: "paste" }, |
|
|
|
...(isMac |
|
|
|
? [ |
|
|
|
{ role: "pasteAndMatchStyle" }, |
|
|
|
{ role: "delete" }, |
|
|
|
{ role: "selectAll" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ |
|
|
|
label: "Speech", |
|
|
|
submenu: [{ role: "startSpeaking" }, { role: "stopSpeaking" }], |
|
|
|
}, |
|
|
|
] |
|
|
|
: [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }]), |
|
|
|
], |
|
|
|
}, |
|
|
|
// { role: 'viewMenu' }
|
|
|
|
{ |
|
|
|
label: "View", |
|
|
|
submenu: [ |
|
|
|
{ role: "reload" }, |
|
|
|
{ role: "forceReload" }, |
|
|
|
{ role: "toggleDevTools" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "resetZoom" }, |
|
|
|
{ role: "zoomIn" }, |
|
|
|
{ role: "zoomOut" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "togglefullscreen" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
// { role: 'windowMenu' }
|
|
|
|
{ |
|
|
|
label: "Window", |
|
|
|
submenu: [ |
|
|
|
{ role: "minimize" }, |
|
|
|
{ role: "zoom" }, |
|
|
|
...(isMac |
|
|
|
? [ |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "front" }, |
|
|
|
{ type: "separator" }, |
|
|
|
{ role: "window" }, |
|
|
|
] |
|
|
|
: [{ role: "close" }]), |
|
|
|
], |
|
|
|
}, |
|
|
|
{ |
|
|
|
role: "help", |
|
|
|
submenu: [ |
|
|
|
{ |
|
|
|
label: "Learn More", |
|
|
|
click: () => shell.openExternal("https://www.budibase.com/"), |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "Documentation", |
|
|
|
click: () => shell.openExternal("https://docs.budibase.com/"), |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "Search issues", |
|
|
|
click: () => |
|
|
|
shell.openExternal("https://github.com/Budibase/budibase/issues"), |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "Community discussions", |
|
|
|
click: () => |
|
|
|
shell.openExternal( |
|
|
|
"https://github.com/Budibase/budibase/discussions" |
|
|
|
), |
|
|
|
}, |
|
|
|
], |
|
|
|
}, |
|
|
|
] |
|
|
|
|
|
|
|
const menu = Menu.buildFromTemplate(template) |
|
|
|
Menu.setApplicationMenu(menu) |
|
|
|
} |
|
|
|
|
|
|
|
autoUpdater.on("update-downloaded", (event, releaseNotes, releaseName) => { |
|
|
|
|