preffer using code-skip setup and show compatible data

This commit is contained in:
cutls 2022-12-08 00:24:28 +09:00
parent a298228143
commit f573ecc9eb

View File

@ -29,14 +29,10 @@ if (!gotTheLock) {
} else { } else {
app.on('second-instance', (event, commandLine, workingDirector) => { app.on('second-instance', (event, commandLine, workingDirector) => {
opening = false 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) { if (m) {
mainWindow.send('customUrl', [m[1], m[2]]) 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(() => { }) electron.session.defaultSession.clearCache(() => { })
app.quit() 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) { function isFile(file) {
try { try {
fs.statSync(file) fs.statSync(file)
@ -55,6 +58,7 @@ function isFile(file) {
} }
function createWindow() { function createWindow() {
var lang_path = join(app.getPath('userData'), 'language') var lang_path = join(app.getPath('userData'), 'language')
console.log(lang_path)
if (isFile(lang_path)) { if (isFile(lang_path)) {
var lang = fs.readFileSync(lang_path, 'utf8') var lang = fs.readFileSync(lang_path, 'utf8')
} else { } else {