prepare b47

This commit is contained in:
YeonV 2022-07-08 12:05:39 +02:00
parent 8785c31da2
commit 425d7b6041
21 changed files with 325 additions and 218 deletions

View File

@ -1,22 +1,22 @@
{
"files": {
"main.css": "/static/css/main.5721f888.css",
"main.js": "/static/js/main.c1f4aa5a.js",
"static/js/787.15424a8e.chunk.js": "/static/js/787.15424a8e.chunk.js",
"static/media/transitions.gif": "/static/media/transitions.53b6d6f458b421f00872.gif",
"static/media/materialdesignicons-webfont.woff": "/static/media/materialdesignicons-webfont.d8e8e0f7931afa097409.woff",
"static/media/materialdesignicons-webfont.woff2": "/static/media/materialdesignicons-webfont.e9db4005489e24809b62.woff2",
"static/media/MaterialIcons-Regular.woff2": "/static/media/MaterialIcons-Regular.f71673ad689fb42ddae1.woff2",
"service-worker.js": "/service-worker.js",
"static/media/ring.png": "/static/media/ring.1faea45b576b5380bde1.png",
"static/media/blademod.svg": "/static/media/blademod.f939f478785a84b3edcc820eef654556.svg",
"index.html": "/index.html",
"main.5721f888.css.map": "/static/css/main.5721f888.css.map",
"main.c1f4aa5a.js.map": "/static/js/main.c1f4aa5a.js.map",
"787.15424a8e.chunk.js.map": "/static/js/787.15424a8e.chunk.js.map"
"main.css": "./static/css/main.fb926903.css",
"main.js": "./static/js/main.abc61991.js",
"static/js/787.15424a8e.chunk.js": "./static/js/787.15424a8e.chunk.js",
"static/media/materialdesignicons-webfont.woff": "./static/media/materialdesignicons-webfont.059ea00c378aeafc39fc.woff",
"static/media/transitions.gif": "./static/media/transitions.53b6d6f458b421f00872.gif",
"static/media/materialdesignicons-webfont.woff2": "./static/media/materialdesignicons-webfont.d5cba82059f88bfa469e.woff2",
"static/media/MaterialIcons-Regular.woff2": "./static/media/MaterialIcons-Regular.f71673ad689fb42ddae1.woff2",
"service-worker.js": "./service-worker.js",
"static/media/ring.png": "./static/media/ring.1faea45b576b5380bde1.png",
"static/media/blademod.svg": "./static/media/blademod.f939f478785a84b3edcc820eef654556.svg",
"index.html": "./index.html",
"main.fb926903.css.map": "./static/css/main.fb926903.css.map",
"main.abc61991.js.map": "./static/js/main.abc61991.js.map",
"787.15424a8e.chunk.js.map": "./static/js/787.15424a8e.chunk.js.map"
},
"entrypoints": [
"static/css/main.5721f888.css",
"static/js/main.c1f4aa5a.js"
"static/css/main.fb926903.css",
"static/js/main.abc61991.js"
]
}

View File

@ -1,189 +1,287 @@
/* eslint-disable @typescript-eslint/indent */
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-return-assign */
/* eslint-disable no-console */
/* eslint-disable global-require */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const { app, Menu, Tray, nativeImage, Notification, nativeTheme, BrowserWindow, ipcMain, shell } = require('electron');
const {
app,
Menu,
Tray,
// Notification,
nativeTheme,
BrowserWindow,
ipcMain,
shell,
} = require('electron');
const isDev = require('electron-is-dev');
const { download } = require("electron-dl");
const fs = require('fs')
const { download } = require('electron-dl');
const fs = require('fs');
// Conditionally include the dev tools installer to load React Dev Tools
let installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS; // NEW!
let installExtension;
let REACT_DEVELOPER_TOOLS;
let REDUX_DEVTOOLS; // NEW!
if (isDev) {
const devTools = require("electron-devtools-installer");
installExtension = devTools.default;
REACT_DEVELOPER_TOOLS = devTools.REACT_DEVELOPER_TOOLS;
REDUX_DEVTOOLS = devTools.REDUX_DEVTOOLS;
const devTools = require('electron-devtools-installer');
installExtension = devTools.default;
REACT_DEVELOPER_TOOLS = devTools.REACT_DEVELOPER_TOOLS;
REDUX_DEVTOOLS = devTools.REDUX_DEVTOOLS;
}
// Handle creating/removing shortcuts on Windows when installing/uninstalling
if (require("electron-squirrel-startup")) {
app.quit();
if (require('electron-squirrel-startup')) {
app.quit();
}
let win
let win;
function createWindow(args) {
require('@electron/remote/main').initialize()
function createWindow(args = {}) {
require('@electron/remote/main').initialize();
// Create the browser window.
win = new BrowserWindow({
width: 480,
height: 768,
autoHideMenuBar: true,
titleBarStyle: process.platform === 'darwin' ? 'default' : 'hidden',
titleBarOverlay:
process.platform === 'darwin'
? false
: { color: '#333', symbolColor: '#ffffff' },
frame: process.platform === 'darwin',
webPreferences: {
webSecurity: false,
allowRunningInsecureContent: true,
plugins: true,
// enableRemoteModule: true,
backgroundThrottling: false,
nodeIntegration: true,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js'),
...args,
},
});
// require('@treverix/remote/main').initialize()
// Create the browser window.
win = new BrowserWindow({
width: 480,
height: 768,
autoHideMenuBar: true,
titleBarStyle: "hidden",
// frame: false,
webPreferences: {
webSecurity: false,
allowRunningInsecureContent: true,
plugins: true,
enableRemoteModule: true,
backgroundThrottling: false,
nodeIntegration: true,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js'),
...args
}
});
win.loadURL(
isDev
? 'http://localhost:3000'
: `file://${path.join(__dirname, '../build/index.html')}`
);
win.loadURL(
isDev
? 'http://localhost:3000'
: `file://${path.join(__dirname, '../build/index.html')}`
);
// win.removeMenu()
// Open the DevTools.
// if (isDev) {
// win.webContents.openDevTools({ mode: 'detach' });
// }
// win.removeMenu()
// Open the DevTools.
// if (isDev) {
// win.webContents.openDevTools({ mode: 'detach' });
// }
return win
return win;
}
const NOTIFICATION_TITLE = 'LedFx Client - by Blade'
const NOTIFICATION_BODY = 'Testing Notification from the Main process'
// const NOTIFICATION_TITLE = 'LedFx Client - by Blade';
// const NOTIFICATION_BODY = 'Testing Notification from the Main process';
function showNotification() {
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
// function showNotification() {
// new Notification({
// title: NOTIFICATION_TITLE,
// body: NOTIFICATION_BODY,
// }).show();
// }
let tray = null;
let subpy = null;
let contextMenu = null;
let wind;
let willQuitApp = false
let tray = null
var subpy = null
var contextMenu = null
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
var wind
app.whenReady().then(async () => {
nativeTheme.themeSource = 'dark';
const thePath = process.env.PORTABLE_EXECUTABLE_DIR || path.resolve('.')
const ledfxCores = fs.readdirSync(thePath).filter(o => (o.length - o.indexOf('--win-portable.exe') === 18) && o.indexOf('LedFx_core') === 0)
const ledfxCore = ledfxCores && ledfxCores.length && ledfxCores.length > 0 && ledfxCores[ledfxCores.length - 1]
const integratedCore = ledfxCore && fs.existsSync(`${thePath}/${ledfxCore}`)
nativeTheme.themeSource = 'dark';
const thePath = process.env.PORTABLE_EXECUTABLE_DIR || path.resolve('.');
if (integratedCore) {
subpy = require("child_process").spawn(`./${ledfxCore}`, ["-p", "8888"]);
}
wind = (integratedCore) ? createWindow({additionalArguments: ["integratedCore"]}) : createWindow();
// require('@treverix/remote/main').initialize()
require("@electron/remote/main").enable(wind.webContents)
if (isDev) {
await installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS], { loadExtensionOptions: { allowFileAccess: true }, forceDownload: false })
.then(name => console.log(`Added Extension: ${name}`))
.catch(error => console.log(`An error occurred: , ${error}`));
}
const integratedCore = (process.platform === 'darwin')
? fs.existsSync(path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx_core.app'))
: fs.existsSync(path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx-notray.exe'))
const icon = path.join(__dirname, 'icon_16x16a.png')
tray = new Tray(icon)
const currentDir = fs.readdirSync(thePath)
console.log(currentDir)
if (integratedCore) {
contextMenu = Menu.buildFromTemplate([
{ label: 'Show', click: () => wind.show() },
{ label: 'Minimize', click: () => wind.minimize() },
{ label: 'Minimize to tray', click: () => wind.hide() },
{ label: 'Test Notifiation', click: () => showNotification() },
{ label: 'seperator', type: 'separator' },
{ label: 'Dev', click: () => wind.webContents.openDevTools() },
{ label: 'seperator', type: 'separator' },
{ label: 'Start core', click: () => subpy = require("child_process").spawn(`./${ledfxCore}`, []) },
{ label: 'Stop core', click: () => wind.webContents.send('fromMain', 'shutdown') },
// { label: 'Download core', click: () => download(wind, `https://github.com/YeonV/LedFx-Frontend-v2/releases/latest/download/LedFx_core-${app.getVersion().split('-')[1]}--win-portable.exe`, { directory: thePath, overwrite: true }).then((f) => { app.relaunch(); app.exit() }) },
{ label: 'Restart Client', click: () => { app.relaunch(); app.exit() }},
{ label: 'Open folder', click: () => shell.openPath(thePath) },
{ label: 'seperator', type: 'separator' },
{ label: 'Exit', click: () => app.quit() }
])
if (integratedCore) {
if (process.platform === 'darwin') {
subpy = require('child_process').spawn(`${path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx_core.app/Contents/MacOS/LedFx_v2')}`, []);
} else {
contextMenu = Menu.buildFromTemplate([
{ label: 'Show', click: () => wind.show() },
{ label: 'Minimize', click: () => wind.minimize() },
{ label: 'Minimize to tray', click: () => wind.hide() },
{ label: 'Test Notifiation', click: () => showNotification() },
{ label: 'seperator', type: 'separator' },
{ label: 'Dev', click: () => wind.webContents.openDevTools() },
{ label: 'seperator', type: 'separator' },
{ label: 'Stop core', click: () => wind.webContents.send('fromMain', 'shutdown') },
// { label: 'Download core', click: () => download(wind, `https://github.com/YeonV/LedFx-Frontend-v2/releases/latest/download/LedFx_core-${app.getVersion().split('-')[1]}--win-portable.exe`, { directory: thePath, overwrite: true, onProgress: (obj)=>{wind.webContents.send('fromMain', ['download-progress', obj])} }).then((f) => { wind.webContents.send('fromMain', 'clear-frontend'); app.relaunch(); app.exit() })},
{ label: 'Restart Client', click: () => {app.relaunch(); app.exit() }},
{ label: 'Open folder', click: () => shell.openPath(thePath) },
{ label: 'seperator', type: 'separator' },
{ label: 'Exit', click: () => app.quit() }
])
subpy = require('child_process').spawn(`${path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx-notray.exe')}`, ['-p', '8888']);
}
tray.setToolTip(`LedFx Client${isDev ? ' DEV' : ''}`)
tray.setContextMenu(contextMenu)
tray.setIgnoreDoubleClickEvents(true)
tray.on('click', (e) => wind.show())
}
ipcMain.on("toMain", (event, parameters) => {
console.log(parameters)
if (parameters === 'start-core') {
console.log("Starting Core", ledfxCore)
if (integratedCore) {
subpy = require("child_process").spawn(`./${ledfxCore}`, [])
}
return
}
if (parameters === 'open-config') {
console.log("Open Config")
shell.showItemInFolder(path.join(app.getPath('appData'), '/.ledfx/config.json'))
return
}
if (parameters === 'restart-client') {
app.relaunch();
app.exit();
return
}
if (parameters === 'download-core') {
download(wind, `https://github.com/YeonV/LedFx-Frontend-v2/releases/latest/download/LedFx_core-${app.getVersion().split('-')[1]}--win-portable.exe`, { directory: thePath, overwrite: true, onProgress: (obj)=>{wind.webContents.send('fromMain', ['download-progress', obj])} }).then((f) => { wind.webContents.send('fromMain', 'clear-frontend'); app.relaunch(); app.exit() })
return
}
});
wind = integratedCore
? createWindow({ additionalArguments: ['integratedCore'] })
: createWindow();
if (integratedCore) {
wind.on('close', ()=>{
wind.webContents.send('fromMain', 'shutdown')
})
require('@electron/remote/main').enable(wind.webContents);
if (isDev) {
await installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS], {
loadExtensionOptions: { allowFileAccess: true },
forceDownload: false,
})
.then((name) => console.log(`Added Extension: ${name}`))
.catch((error) => console.log(`An error occurred: , ${error}`));
}
const icon = path.join(__dirname, 'icon_16x16a.png');
tray = new Tray(icon);
if (integratedCore) {
contextMenu = Menu.buildFromTemplate([
{ label: 'Show', click: () => {
if (process.platform === 'darwin') app.dock.show()
wind.show()
}},
{ label: 'Minimize', click: () => wind.minimize() },
{ label: 'Minimize to tray', click: () => {
if (process.platform === 'darwin') app.dock.hide()
wind.hide()
}},
// { label: 'Test Notifiation', click: () => showNotification() },
{ label: 'seperator', type: 'separator' },
{ label: 'Dev', click: () => wind.webContents.openDevTools() },
{ label: 'seperator', type: 'separator' },
{
label: 'Start core',
click: () => (process.platform === 'darwin')
? subpy = require('child_process').spawn(`${path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx_core.app/Contents/MacOS/LedFx_v2')}`, [])
: subpy = require('child_process').spawn(`${path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx-notray.exe')}`, ['-p', '8888'])
},
{
label: 'Stop core',
click: () => wind.webContents.send('fromMain', 'shutdown'),
},
// { label: 'Download core', click: () => download(wind, `https://github.com/YeonV/LedFx-Frontend-v2/releases/latest/download/LedFx_core-${app.getVersion().split('-')[1]}--win-portable.exe`, { directory: thePath, overwrite: true }).then((f) => { app.relaunch(); app.exit() }) },
{
label: 'Restart Client',
click: () => {
app.relaunch();
app.exit();
},
},
{ label: 'Open folder', click: () => shell.openPath(thePath) },
{ label: 'seperator', type: 'separator' },
{ label: 'Exit', click: () => app.quit() },
]);
} else {
contextMenu = Menu.buildFromTemplate([
{ label: 'Show', click: () => {
if (process.platform === 'darwin') app.dock.show()
wind.show()
}},
{ label: 'Minimize', click: () => wind.minimize() },
{ label: 'Minimize to tray', click: () => {
if (process.platform === 'darwin') app.dock.hide()
wind.hide()
}},
// { label: 'Test Notifiation', click: () => showNotification() },
{ label: 'seperator', type: 'separator' },
{ label: 'Dev', click: () => wind.webContents.openDevTools() },
{ label: 'seperator', type: 'separator' },
{
label: 'Stop core',
click: () => wind.webContents.send('fromMain', 'shutdown'),
},
// { label: 'Download core', click: () => download(wind, `https://github.com/YeonV/LedFx-Frontend-v2/releases/latest/download/LedFx_core-${app.getVersion().split('-')[1]}--win-portable.exe`, { directory: thePath, overwrite: true, onProgress: (obj)=>{wind.webContents.send('fromMain', ['download-progress', obj])} }).then((f) => { wind.webContents.send('fromMain', 'clear-frontend'); app.relaunch(); app.exit() })},
{
label: 'Restart Client',
click: () => {
app.relaunch();
app.exit();
},
},
{ label: 'Open folder', click: () => shell.openPath(thePath) },
{ label: 'seperator', type: 'separator' },
{ label: 'Exit', click: () => app.quit() },
]);
}
tray.setToolTip(`LedFx Client${isDev ? ' DEV' : ''}`);
tray.setContextMenu(contextMenu);
tray.setIgnoreDoubleClickEvents(true);
tray.on('click', () => wind.show());
ipcMain.on('toMain', (event, parameters) => {
console.log(parameters);
if (parameters === 'get-platform') {
wind.webContents.send('fromMain', ['platform', process.platform]);
return;
}
if (parameters === 'start-core') {
if (integratedCore) {
if (process.platform === 'darwin') {
wind.webContents.send('fromMain', ['currentdir', integratedCore, fs.existsSync(path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx_core.app'))]);
subpy = require('child_process').spawn(`${path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx_core.app/Contents/MacOS/LedFx_v2')}`, []);
} else {
wind.webContents.send('fromMain', ['currentdir', integratedCore, fs.existsSync(path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx-notray.exe'))]);
subpy = require('child_process').spawn(`${path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources','LedFx-notray.exe')}`, []);
}
}
return;
}
if (parameters === 'open-config') {
console.log('Open Config');
wind.webContents.send('fromMain', ['currentdir', path.join(path.dirname(__dirname), isDev ? 'extraResources' : '../extraResources')]);
shell.showItemInFolder(
path.join(app.getPath('appData'), '/.ledfx/config.json')
);
return;
}
if (parameters === 'restart-client') {
app.relaunch();
app.exit();
return;
}
if (parameters === 'download-core') {
download(
wind,
`https://github.com/YeonV/LedFx-Frontend-v2/releases/latest/download/LedFx_core-${
app.getVersion().split('-')[1]
}--win-portable.exe`,
{
directory: thePath,
overwrite: true,
onProgress: (obj) => {
wind.webContents.send('fromMain', ['download-progress', obj]);
},
}
).then(() => {
wind.webContents.send('fromMain', 'clear-frontend');
app.relaunch();
app.exit();
});
}
});
wind.on('close', function(e){
if (subpy !== null) {
subpy.kill('SIGINT');
}
})
});
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
if (subpy !== null) {
subpy.kill("SIGINT");
}
app.quit();
}
app.quit();
});
app.on('before-quit', () => {
if (subpy !== null) {
subpy.kill('SIGINT');
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="description" content="LedFx Client - by Blade"/><link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="/favicon/apple-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="/favicon/apple-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="/favicon/apple-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="/favicon/apple-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="/favicon/apple-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="/favicon/apple-icon-152x152.png"><link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-icon-180x180.png"><link rel="icon" type="image/png" sizes="192x192" href="/favicon/android-icon-192x192.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png"><link rel="icon" type="image/png" sizes="96x96" href="/favicon/favicon-96x96.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png"><meta name="msapplication-TileColor" content="#333333"><meta name="msapplication-TileImage" content="/favicon/ms-icon-144x144.png"><meta name="theme-color" content="#333333"><meta name="background-color" content="#020202"><link rel="manifest" href="/manifest.json"/><title>LedFx</title><script defer="defer" src="/static/js/main.c1f4aa5a.js"></script><link href="/static/css/main.5721f888.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><script type="application/javascript">"serviceWorker"in navigator&&window.addEventListener("load",(function(){navigator.serviceWorker.register("serviceWorker.js",{scope:"."}).then((function(e){console.debug("ServiceWorker registration successful with scope: ",e.scope)}),(function(e){console.debug("ServiceWorker registration failed: ",e)}))}))</script><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="description" content="LedFx Client - by Blade"/><link rel="apple-touch-icon" sizes="57x57" href="./favicon/apple-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="./favicon/apple-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="./favicon/apple-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="./favicon/apple-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="./favicon/apple-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="./favicon/apple-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="./favicon/apple-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="./favicon/apple-icon-152x152.png"><link rel="apple-touch-icon" sizes="180x180" href="./favicon/apple-icon-180x180.png"><link rel="icon" type="image/png" sizes="192x192" href="./favicon/android-icon-192x192.png"><link rel="icon" type="image/png" sizes="32x32" href="./favicon/favicon-32x32.png"><link rel="icon" type="image/png" sizes="96x96" href="./favicon/favicon-96x96.png"><link rel="icon" type="image/png" sizes="16x16" href="./favicon/favicon-16x16.png"><meta name="msapplication-TileColor" content="#333333"><meta name="msapplication-TileImage" content="./favicon/ms-icon-144x144.png"><meta name="theme-color" content="#333333"><meta name="background-color" content="#020202"><link rel="manifest" href="./manifest.json"/><title>LedFx</title><script defer="defer" src="./static/js/main.abc61991.js"></script><link href="./static/css/main.fb926903.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><script type="application/javascript">"serviceWorker"in navigator&&window.addEventListener("load",(function(){navigator.serviceWorker.register("serviceWorker.js",{scope:"."}).then((function(e){console.debug("ServiceWorker registration successful with scope: ",e.scope)}),(function(e){console.debug("ServiceWorker registration failed: ",e)}))}))</script><div id="root"></div></body></html>

View File

@ -1,29 +1,38 @@
/* eslint-disable no-new */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/no-extraneous-dependencies */
const { contextBridge, ipcRenderer } = require('electron');
const customTitlebar = require('@treverix/custom-electron-titlebar');
// const customTitlebar = require('@treverix/custom-electron-titlebar');
// const customTitlebar = require('custom-electron-titlebar');
contextBridge.exposeInMainWorld('api', {
send: (channel, data) => {
// Whitelist channels
let validChannels = ['toMain'];
if (validChannels.includes(channel)) {
ipcRenderer.send(channel, data);
}
},
receive: (channel, func) => {
let validChannels = ['fromMain'];
if (validChannels.includes(channel)) {
// Deliberately strip event as it includes `sender`
ipcRenderer.on(channel, (event, ...args) => func(...args));
}
},
send: (channel, data) => {
// Whitelist channels
const validChannels = ['toMain'];
if (validChannels.includes(channel)) {
ipcRenderer.send(channel, data);
}
},
receive: (channel, func) => {
const validChannels = ['fromMain'];
if (validChannels.includes(channel)) {
// Deliberately strip event as it includes `sender`
ipcRenderer.on(channel, (event, ...args) => func(...args));
}
},
yz: true,
});
// contextBridge.exposeInMainWorld('electron', {
// // ...other APIs to expose to renderer process
// platform: () => ipcRenderer.send(process.platform)
// });
window.addEventListener('DOMContentLoaded', () => {
new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex('#202020'),
icon: './icon.png',
menu: false,
titleHorizontalAlignment: 'left',
});
})
// window.addEventListener('DOMContentLoaded', () => {
// new customTitlebar.Titlebar({
// backgroundColor: customTitlebar.Color.fromHex('#202020'),
// icon: './icon.png',
// menu: false,
// titleHorizontalAlignment: 'left',
// });
// });

View File

@ -1,3 +0,0 @@
This is the compiled frontend.
The frontend source code is currently hosted at https://github.com/YeonV/LedFx-Frontend-v2

View File

@ -4,10 +4,3 @@
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.
// import { Titlebar } from 'custom-electron-titlebar'
// window.addEventListener('DOMContentLoaded', () => {
// new Titlebar({
// backgroundColor: '#800000'
// })
// })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
self.addEventListener('install', event => {
event.waitUntil(Promise.resolve());
});
/* eslint-disable no-restricted-globals */
self.addEventListener('install', (event) => {
event.waitUntil(Promise.resolve());
});
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim());
});
self.addEventListener('activate', (event) => {
event.waitUntil((self).clients.claim());
});
self.addEventListener('fetch', event => {
event.waitUntil(Promise.resolve());
});
self.addEventListener('fetch', (event) => {
event.waitUntil(Promise.resolve());
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -195,4 +195,13 @@ PERFORMANCE OF THIS SOFTWARE.
* SOFTWARE.
*/
/**!
* hotkeys-js v3.9.3
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2022 kenny wong <wowohoo@qq.com>
* http://jaywcjlove.github.io/hotkeys
* Licensed under the MIT license
*/
//! moment.js

File diff suppressed because one or more lines are too long