diff --git a/package.json b/package.json index 17b8eb1c..46a1f289 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ledfx", - "version": "2.0.103-b5", + "version": "2.0.104", "description": "LedFx v2 - BladeMOD", "author": "YeonV aka Blade", "private": true, @@ -98,7 +98,9 @@ "build:win32": "set GENERATE_SOURCEMAP=false && set CI=false && react-scripts build", "build:default": "GENERATE_SOURCEMAP=false CI=false react-scripts build", "prebuild": "node -e \"let pkg=require('./package.json'); pkg.homepage='/'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));\"", - "postbuild": "node -e \"let pkg=require('./package.json'); pkg.homepage='.'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));\" && rm -rf build/app && rm -rf build/preload.js && rm -rf build/renderer.js && rm -rf build/electron.js", + "postbuild": "run-script-os", + "postbuild:win32": "node -e \"let pkg=require('./package.json'); pkg.homepage='.'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));\" && del /q build\\app && rm -rf build\\preload.js && rm -rf build\\renderer.js && rm -rf build\\electron.js", + "postbuild:default": "node -e \"let pkg=require('./package.json'); pkg.homepage='.'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));\" && rm -rf build/app && rm -rf build/preload.js && rm -rf build/renderer.js && rm -rf build/electron.js", "buildhass": "GENERATE_SOURCEMAP=false CI=false react-scripts build", "prebuildhass": "node -e \"let pkg=require('./package.json'); pkg.homepage='./'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));\"", "postbuildhass": "node -e \"let pkg=require('./package.json'); pkg.homepage='.'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));\" && rm -rf build/app && rm -rf build/preload.js && rm -rf build/renderer.js && rm -rf build/electron.js", diff --git a/public/app/core.js b/public/app/core.js index 9c58f7a3..52514fcd 100644 --- a/public/app/core.js +++ b/public/app/core.js @@ -22,8 +22,8 @@ const coreFile = { 'instance1': ['-p', '8888', '--no-tray'] } }; - -const coreParams = store.get('coreParams', defaultCoreParams); + +const coreParams = store.get('coreParams', defaultCoreParams); const corePath = (file) => path.join(path.dirname(__dirname), isDev ? '../extraResources' : '../../extraResources', file) const runCore = (file, options) => require('child_process').spawn(`${corePath(file)}`, options).on('error', (err) => { console.error(`Failed to start subprocess. ${err}`); }); @@ -32,13 +32,13 @@ if (!fs.existsSync(path.join(app.getPath("userData"), '.ledfx-cc'))) { console.log('Creating .ledfx-cc folder') fs.mkdirSync(path.join(app.getPath("userData"), '.ledfx-cc')); } -function startCore(wind, platform, instance = 'instance1', port = '8889') { +function startCore(wind, platform, instance = 'instance1', port = '8889') { let subpy; - + if (fs.existsSync(corePath(coreFile[platform]))) { if (coreParams[platform] && instance && coreParams[platform][instance]) { if (instance !== 'instance1') { - + coreParams[platform][instance] = ['-p', port, '-c', path.join(app.getPath("userData"), '.ledfx-cc', instance)]; } console.log('Starting core with params', platform, instance, coreParams[platform][instance]) @@ -60,7 +60,7 @@ function startCore(wind, platform, instance = 'instance1', port = '8889') { subpy.stderr.on('data', (data) => { console.log(`stderr: ${data}`); wind.webContents.send('fromMain', ['snackbar', data.toString()]); - }); + }); subpy.on('exit', (code, signal) => { console.log(`Child process exited with code ${code} and signal ${signal}`); }); @@ -68,9 +68,9 @@ function startCore(wind, platform, instance = 'instance1', port = '8889') { console.error(`Failed to start subprocess. ${err}`); }); } - } + } return subpy; - } + } const isCC = fs.existsSync(corePath(coreFile[process.platform])) diff --git a/public/app/handlers.js b/public/app/handlers.js index ff89d3bf..67a9b9dd 100644 --- a/public/app/handlers.js +++ b/public/app/handlers.js @@ -98,7 +98,7 @@ const handlers = async (wind, subprocesses, event, parameters) => { // path.join(app.getPath('appData'), '.ledfx', 'config.json') // ) - if (parameters.instance && parameters.instance !== 'instance1') { + if (parameters.instance && parameters.instance !== 'instance1') { shell.showItemInFolder( path.join(app.getPath("userData"), '.ledfx-cc', parameters.instance, 'config.json') ) @@ -119,7 +119,7 @@ const handlers = async (wind, subprocesses, event, parameters) => { path.join(app.getPath('home'), '.ledfx', 'config.json') ) } - + break case 'restart-client': app.relaunch() diff --git a/public/app/instances.js b/public/app/instances.js index 03c07784..b54c11c8 100644 --- a/public/app/instances.js +++ b/public/app/instances.js @@ -36,10 +36,10 @@ function startInstance(wind, name, subprocesses, port) { } if (wind && wind.webContents && !wind.isDestroyed() && subprocesses) { // `subprocesses` is defined, proceed with calling `sendStatus` - try { + try { sendStatus(wind, subprocesses, false, name); } catch (error) { - console.error(error); + console.error(error); } } else { // `subprocesses` is not defined, handle this case as needed @@ -110,7 +110,7 @@ function closeAllSubs(wind, subpy, subprocesses) { Object.values(subprocesses).forEach((sub) => { if (sub) kills(sub) }) - } + } } module.exports = { diff --git a/public/app/otp.js b/public/app/otp.js index 7e0e63a5..ea3c7943 100644 --- a/public/app/otp.js +++ b/public/app/otp.js @@ -91,7 +91,7 @@ function handleVerifyOTP(wind, event, parameters) { user.mfaEnabled = true; store.set('user', user); } - + // console.log('verified_otp:', verified ,user) wind.webContents.send('fromMain', ['mfa-verified', verified]); return; diff --git a/public/app/tray.js b/public/app/tray.js index 77986c4c..5f8310ca 100644 --- a/public/app/tray.js +++ b/public/app/tray.js @@ -6,7 +6,7 @@ const isDev = require('electron-is-dev'); function createMenu(isCC, wind, thePath) { let contextMenu; - + if (isCC) { contextMenu = Menu.buildFromTemplate([ { label: 'Show', click: () => { @@ -73,7 +73,7 @@ function createMenu(isCC, wind, thePath) { { label: 'Exit', click: () => app.quit() }, ]); } - + return contextMenu; } @@ -83,7 +83,7 @@ function createTray(isCC, wind, thePath, dir) { let tray = new Tray(icon); let contextMenu = createMenu(isCC, wind, thePath); - + tray.setToolTip(`LedFx Client${isDev ? ' DEV' : ''}`); tray.setContextMenu(contextMenu); tray.setIgnoreDoubleClickEvents(true); diff --git a/public/electron.js b/public/electron.js index eed393b3..00485a7c 100644 --- a/public/electron.js +++ b/public/electron.js @@ -40,7 +40,7 @@ const ready = () => require('@electron/remote/main').enable(wind.webContents) wind.webContents.setWindowOpenHandler(({ url }) => { - if (url.includes(' https://accounts.spotify.com/authorize') + if (url.includes(' https://accounts.spotify.com/authorize') // || url.includes(`${backendUrl}/connect/github?callback`) ) { shell.openExternal(url) @@ -51,14 +51,14 @@ const ready = () => if (isCC) startInstance(wind, 'instance1', subprocesses) if (isDev) installDevtools(installExtension) - + createTray(isCC, wind, thePath, __dirname) ipcMain.on('toMain', async (event, parameters) => handlers(wind, subprocesses, event, parameters) ) wind.on('close', () => { - closeAllSubs(wind, subpy, subprocesses) + closeAllSubs(wind, subpy, subprocesses) wind = null; }) }) diff --git a/src/components/Midi/LaunchpadButton.tsx b/src/components/Midi/LaunchpadButton.tsx index 8a34496a..c486922d 100644 --- a/src/components/Midi/LaunchpadButton.tsx +++ b/src/components/Midi/LaunchpadButton.tsx @@ -15,8 +15,10 @@ const LaunchpadButton = ({ borderless, bgColor, children, + hidden, ...props }: { + hidden?: boolean buttonNumber: number children: React.ReactNode active?: boolean @@ -55,7 +57,7 @@ const LaunchpadButton = ({ }, [midiEvent.button]) return ( -