mirror of https://codeberg.org/pzp/zooboard.git
Get two instances to kinda work at the same time
This commit is contained in:
parent
9da1176e5f
commit
68c3b566c9
30
main.js
30
main.js
|
@ -20,7 +20,7 @@ na.sodium_free = function sodium_free_monkey_patched() {}
|
||||||
|
|
||||||
process.env.ZOOBOARD_DATA ??= Path.join(app.getPath('appData'), 'zooboard')
|
process.env.ZOOBOARD_DATA ??= Path.join(app.getPath('appData'), 'zooboard')
|
||||||
app.setPath('userData', process.env.ZOOBOARD_DATA)
|
app.setPath('userData', process.env.ZOOBOARD_DATA)
|
||||||
const path = Path.resolve(app.getPath('userData'), 'ppppp')
|
const path = process.env.PZP_DIR ?? Path.resolve(app.getPath('userData'), 'ppppp')
|
||||||
|
|
||||||
const keypairPath = Path.join(path, 'keypair.json')
|
const keypairPath = Path.join(path, 'keypair.json')
|
||||||
const keypair = Keypair.loadOrCreateSync(keypairPath)
|
const keypair = Keypair.loadOrCreateSync(keypairPath)
|
||||||
|
@ -277,20 +277,20 @@ if (process.defaultApp) {
|
||||||
app.setAsDefaultProtocolClient('ppppp')
|
app.setAsDefaultProtocolClient('ppppp')
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasLock = app.requestSingleInstanceLock()
|
//const hasLock = app.requestSingleInstanceLock()
|
||||||
|
|
||||||
if (!hasLock) {
|
//if (!hasLock) {
|
||||||
app.quit()
|
// app.quit()
|
||||||
} else {
|
//} else {
|
||||||
app.on('second-instance', (ev, argv, cwd, extraData) => {
|
// app.on('second-instance', (ev, argv, cwd, extraData) => {
|
||||||
if (mainWindow) {
|
// if (mainWindow) {
|
||||||
if (mainWindow.isMinimized()) mainWindow.restore()
|
// if (mainWindow.isMinimized()) mainWindow.restore()
|
||||||
mainWindow.focus()
|
// mainWindow.focus()
|
||||||
if (argv.length > 1) {
|
// if (argv.length > 1) {
|
||||||
handlePPPPPUri(null, argv[argv.length - 1])
|
// handlePPPPPUri(null, argv[argv.length - 1])
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
ipcMain.handle('loadAccount', loadAccount)
|
ipcMain.handle('loadAccount', loadAccount)
|
||||||
|
@ -313,4 +313,4 @@ if (!hasLock) {
|
||||||
if (process.platform !== 'darwin') app.quit()
|
if (process.platform !== 'darwin') app.quit()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
//}
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "BROWSER=none react-scripts start",
|
"start": "PORT=3001 BROWSER=none react-scripts start",
|
||||||
|
"start2": "PZP_DIR=/tmp/zooboard-test PORT=3002 BROWSER=none react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"electron": "ELECTRON_START_URL=http://localhost:3000 DEBUG=*,-shse,-pull-secretstream electron ."
|
"electron": "ELECTRON_START_URL=http://localhost:3001 DEBUG=*,-shse,-pull-secretstream electron .",
|
||||||
|
"electron2": "PZP_DIR=/tmp/zooboard-test ELECTRON_START_URL=http://localhost:3002 DEBUG=*,-shse,-pull-secretstream electron ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@excalidraw/excalidraw": "0.17.2",
|
"@excalidraw/excalidraw": "0.17.2",
|
||||||
|
|
Loading…
Reference in New Issue