diff --git a/index.html b/index.html index 25e7bfd..18122ab 100644 --- a/index.html +++ b/index.html @@ -3,23 +3,18 @@ + + Client - -

Seahorse Client

-

- We are using Node.js , Chromium - , and Electron - . -

-

👋

+ +

BackOne Client

+ diff --git a/main.js b/main.js index ed062c0..6e06df5 100644 --- a/main.js +++ b/main.js @@ -1,34 +1,69 @@ -const { app, BrowserWindow } = require('electron/main') +const { app, BrowserWindow, Menu, ipcMain, session } = require('electron/main') const path = require('node:path') -const { session } = require('electron') +//const { session } = require('electron') const {machineId, machineIdSync} = require('node-machine-id') // run this as early in the main process as possible if (require('electron-squirrel-startup')) app.quit(); const filter = { - urls: ['https://*.sh.live.databisnis.id/*'] + urls: ['https://*.manage.backone.cloud/*'] } let device_id = machineIdSync() +Menu.setApplicationMenu(null); const createWindow = () => { const win = new BrowserWindow({ width: 1440, height: 900, + title: 'Client', + //titleBarStyle: 'hidden', + tabbingIdentifier: 'clientTabs', webPreferences: { preload: path.join(__dirname, 'preload.js') - } + }, + //...(process.platform !== 'darwin' ? { titleBarOverlay: true } : {}) }) - win.setMenu(null) + //win.setMenu(null) + //win.setTitle(`App Name - Version ${app.getVersion()}`); + //win.setTitle(`Client ${app.getVersion()}`); + + + /* + win.on('app-command', (e, cmd) => { + if (cmd === 'browser-backward') { + if (win.webContents.canGoBack()) { + win.webContents.goBack(); + } + } else if (cmd === 'browser-forward') { + if (win.webContents.canGoForward()) { + win.webContents.goForward(); + } + } + }); + */ + session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => { - details.requestHeaders['Device-Id'] = device_id + details.requestHeaders['User-Agent'] = 'BackOne-Admin'; + details.requestHeaders['Device-Id'] = device_id; callback({ requestHeaders: details.requestHeaders }) }) - //win.loadURL('https://gw.sh.live.databisnis.id/', {userAgent: 'Seahorse-Client/' + device_id}) - win.loadURL('https://gw.sh.live.databisnis.id/') + //win.loadURL('https://nexus.manage.backone.cloud/', {userAgent: 'BackOne-Admin'}) + //win.loadFile('index.html', {userAgent: 'BackOne-Admin'}) + win.loadFile('index.html') + + // Handle the 'nav:back' event from the renderer process + /* + ipcMain.handle('nav:back', () => { + if (mainWindow.webContents.canGoBack()) { + mainWindow.webContents.goBack(); + } + }); + */ + //win.loadURL('https://nexus.manage.backone.cloud/') const ses = win.webContents.session ses.clearCache() } diff --git a/package-lock.json b/package-lock.json index 3ee7bec..5fcb8ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "Seahorse.Client", - "version": "1.0.2", + "name": "BackOneClient", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "Seahorse.Client", - "version": "1.0.2", + "name": "BackOneClient", + "version": "1.0.0", "license": "MIT", "dependencies": { "electron-squirrel-startup": "^1.0.1", diff --git a/package.json b/package.json index 8c03102..182b976 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "SeahorseClient", - "version": "1.1.0", + "name": "BackOneClient", + "version": "1.0.0", "main": "main.js", "scripts": { "start": "electron-forge start", @@ -10,7 +10,7 @@ }, "author": "DBS", "license": "MIT", - "description": "Seahorse-SateliteImages", + "description": "BackOne Client for Manage Controller", "devDependencies": { "@electron-forge/cli": "^7.5.0", "@electron-forge/maker-deb": "^7.5.0",