mirror of
https://github.com/earthjasonlin/zzz-signal-search-export.git
synced 2025-04-21 07:50:19 +08:00
Users don't have to delete their data. New data structure is used automatically when new data is fetched - Set `count` to `"1"` as default for old data - Record `count` from API - Link to the UIGF website BREAKING CHANGE: SRGF is no longer supported, use UIGFv4.0(Beta) instead
70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
const { app, BrowserWindow, ipcMain } = require('electron')
|
|
const { initWindow } = require('./utils')
|
|
const { disableProxy, proxyStatus } = require('./module/system-proxy')
|
|
require('./getData')
|
|
require('./bridge')
|
|
require('./excel')
|
|
require('./UIGFJson')
|
|
const { getUpdateInfo } = require('./update/index')
|
|
|
|
const isDev = !app.isPackaged
|
|
let win = null
|
|
|
|
function createWindow() {
|
|
win = initWindow()
|
|
win.setMenuBarVisibility(false)
|
|
isDev ? win.loadURL(`http://localhost:${process.env.PORT}`) : win.loadFile('dist/electron/renderer/index.html')
|
|
if (isDev) {
|
|
win.webContents.openDevTools({ mode: 'undocked', activate: true })
|
|
}
|
|
}
|
|
|
|
const isFirstInstance = app.requestSingleInstanceLock()
|
|
|
|
if (!isFirstInstance) {
|
|
app.quit()
|
|
} else {
|
|
app.on('second-instance', () => {
|
|
if (win) {
|
|
if (win.isMinimized()) win.restore()
|
|
win.focus()
|
|
}
|
|
})
|
|
|
|
app.whenReady().then(createWindow)
|
|
|
|
ipcMain.handle('RELAUNCH', async () => {
|
|
app.relaunch()
|
|
app.exit(0)
|
|
})
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') {
|
|
app.quit()
|
|
}
|
|
})
|
|
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
createWindow()
|
|
}
|
|
})
|
|
|
|
app.on('will-quit', (e) => {
|
|
if (proxyStatus.started) {
|
|
disableProxy()
|
|
}
|
|
if (getUpdateInfo().status === 'moving') {
|
|
e.preventDefault()
|
|
setTimeout(() => {
|
|
app.quit()
|
|
}, 3000)
|
|
}
|
|
})
|
|
|
|
app.on('quit', () => {
|
|
if (proxyStatus.started) {
|
|
disableProxy()
|
|
}
|
|
})
|
|
} |