From f573ecc9ebb042a6d6a138716961504a42a34c3d Mon Sep 17 00:00:00 2001 From: cutls Date: Thu, 8 Dec 2022 00:24:28 +0900 Subject: [PATCH] preffer using code-skip setup and show compatible data --- app/main.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/main.js b/app/main.js index 34affca6..c87b1a3e 100644 --- a/app/main.js +++ b/app/main.js @@ -29,14 +29,10 @@ if (!gotTheLock) { } else { app.on('second-instance', (event, commandLine, workingDirector) => { opening = false - const m = commandLine[2].match(/([a-zA-Z0-9]+)\/\?[a-zA-Z-0-9]+=(.+)/) + const m = commandLine[2].match(/([a-zA-Z0-9]+)\/?\?[a-zA-Z-0-9]+=(.+)/) if (m) { mainWindow.send('customUrl', [m[1], m[2]]) } - if (mainWindow) { - if (mainWindow.isMinimized()) mainWindow.restore() - mainWindow.focus() - } }) } @@ -45,6 +41,13 @@ app.on('window-all-closed', function () { electron.session.defaultSession.clearCache(() => { }) app.quit() }) +app.on('open-url', function (event, url) { + event.preventDefault() + const m = url.match(/([a-zA-Z0-9]+)\/?\?[a-zA-Z-0-9]+=(.+)/) + if (m) { + mainWindow.send('customUrl', [m[1], m[2]]) + } +}) function isFile(file) { try { fs.statSync(file) @@ -55,6 +58,7 @@ function isFile(file) { } function createWindow() { var lang_path = join(app.getPath('userData'), 'language') + console.log(lang_path) if (isFile(lang_path)) { var lang = fs.readFileSync(lang_path, 'utf8') } else {