summaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-03-27 21:33:07 +0200
committerMinteck <contact@minteck.org>2022-03-27 21:33:07 +0200
commit5ac113fbe6cf5b317775197fc163b22892146630 (patch)
treeb9b181941c27ae76593d69c5b3a3e243770a2351 /main.js
parenta805652f0061840dff8664e37d84dd7a21a5fdae (diff)
downloaddesktop-5ac113fbe6cf5b317775197fc163b22892146630.tar.gz
desktop-5ac113fbe6cf5b317775197fc163b22892146630.tar.bz2
desktop-5ac113fbe6cf5b317775197fc163b22892146630.zip
Commit
Diffstat (limited to 'main.js')
-rw-r--r--main.js162
1 files changed, 133 insertions, 29 deletions
diff --git a/main.js b/main.js
index c49370b..1134f26 100644
--- a/main.js
+++ b/main.js
@@ -1,53 +1,157 @@
-const { app, BrowserWindow } = require('electron')
+const { app, BrowserWindow, Menu, ipcMain, shell} = require('electron')
const path = require('path')
if (require('os').platform() === "win32") {
- logo = path.join(__dirname, "logo.ico");
+ logo = path.join(__dirname, "splashicon.ico");
+} else if (require('os').platform() === "darwin") {
+ logo = path.join(__dirname, "splashicon.icns");
} else {
- logo = path.join(__dirname, "logo.png");
+ logo = path.join(__dirname, "splashicon.png");
}
-function createWindow () {
- const win = new BrowserWindow({
- width: 1100,
- height: 600,
- /*frame: false,*/
+const packdata = require('./package.json');
+
+function AcLoader(callback) {
+ const loader = new BrowserWindow({
+ width: 800,
+ height: 500,
icon: logo,
+ resizable: false,
+ fullscreenable: false,
+ frame: false,
+ backgroundColor: packdata.colors.primary,
show: false,
webPreferences: {
- preload: path.join(__dirname, "internal.js"),
- nodeIntegration: false,
- nodeIntegrationInWorker: false,
- nodeIntegrationInSubFrames: false,
- contextIsolation: false,
- webviewTag: true,
- enableRemoteModule: true
+ nodeIntegration: true,
+ contextIsolation: false
}
})
- win.setMenu(null);
- win.webContents.userAgent = win.webContents.userAgent + " +FL4D/2.21"
- win.loadURL('https://familine.minteck.org/')
- win.openDevTools();
- win.on('ready-to-show', () => {
- win.show();
- })
+ loader.loadFile("./splash.html");
+ loader.setMenu(new Menu());
-const { shell } = require('electron')
+ loader.on('ready-to-show', () => {
+ loader.show();
+ setTimeout(() => {
+ loader.webContents.send("message", "Checking license...");
+ setTimeout(() => {
+ loader.webContents.send("message", "Connecting to Argon servers...");
+ const win = new BrowserWindow({
+ width: 1100,
+ height: 600,
+ icon: logo,
+ show: false,
+ webPreferences: {
+ preload: path.join(__dirname, "internal.js"),
+ nodeIntegration: false,
+ nodeIntegrationInWorker: false,
+ nodeIntegrationInSubFrames: false,
+ contextIsolation: true,
+ webviewTag: true,
+ enableRemoteModule: true
+ }
+ })
-win.webContents.on('new-window', function (event, url) {
- event.preventDefault()
- shell.openExternal(url)
-})
+ win.setMenu(null);
+ win.webContents.userAgent = win.webContents.userAgent + " +AutomateCloud/1.0"
+ win.loadURL('https://argon.minteck.org/')
+
+ ipcMain.on('affect-message', (event, message) => {
+ loader.webContents.send("message", message);
+ })
+
+ ipcMain.on('finish-startup', () => {
+ loader.hide();
+ Menu.setApplicationMenu(Menu.buildFromTemplate([
+ {
+ label: "Argon",
+ submenu: [
+ {
+ role: "about"
+ },
+ {
+ type: "separator"
+ },
+ {
+ role: "quit"
+ }
+ ]
+ },
+ {
+ role: 'editMenu',
+ submenu: [
+ {
+ role: 'selectAll'
+ },
+ {
+ type: 'separator'
+ },
+ {
+ role: 'undo'
+ },
+ {
+ role: 'redo'
+ },
+ {
+ type: 'separator'
+ },
+ {
+ role: 'cut'
+ },
+ {
+ role: 'copy'
+ },
+ {
+ role: 'paste'
+ }
+ ]
+ },
+ {
+ role: 'viewMenu',
+ submenu: [
+ {
+ role: 'togglefullscreen'
+ }
+ ]
+ },
+
+ {
+ role: 'window',
+ submenu: [
+ {
+ role: 'minimize'
+ },
+ {
+ role: 'close'
+ }
+ ]
+ },
+ {
+ role: 'help'
+ }]));
+ win.show();
+
+ })
+
+ const { shell } = require('electron')
+
+ win.webContents.on('new-window', function (event, url) {
+ event.preventDefault()
+ shell.openExternal(url)
+ })
+ }, 500)
+ }, 500)
+ })
}
app.whenReady().then(() => {
- createWindow()
+ Menu.setApplicationMenu(new Menu());
+ AcLoader(() => {});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
- createWindow()
+ AcLoader(() => {});
}
})
})