Merge pull request 'lyc-dev' (#60) from lyc-dev into main

This commit is contained in:
lyc 2024-07-25 09:15:03 +08:00
commit 78e666d6c1
1 changed files with 9 additions and 6 deletions

View File

@ -4,8 +4,6 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/icon.png?asset' import icon from '../../resources/icon.png?asset'
import File from './file' import File from './file'
// const handleUpdate = require("./handleUpdate");
File({ app, shell, BrowserWindow, ipcMain }) File({ app, shell, BrowserWindow, ipcMain })
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
let mainWindow, loginWindow let mainWindow, loginWindow
@ -27,10 +25,13 @@ function createLoginWindow() {
} }
}) })
// handleUpdate(loginWindow,ipcMain) // handleUpdate(loginWindow,ipcMain)
const loginURL = is.dev ? `http://localhost:5173/#/login` : join(__dirname, '../renderer/index.html') // const loginURL = is.dev ? `http://localhost:5173/#/login` : `file://${__dirname}/index.html/#/login`
loginWindow.loadURL(loginURL) // loginWindow.loadURL(loginURL)
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
loginWindow.loadURL('http://localhost:5173/#/login')
} else {
loginWindow.loadFile(join(__dirname, '../renderer/index.html'), {hash: 'login'})
}
loginWindow.webContents.openDevTools() loginWindow.webContents.openDevTools()
loginWindow.once('ready-to-show', () => { loginWindow.once('ready-to-show', () => {
@ -113,6 +114,7 @@ async function createLinkWin(data) {
// 初始化完成 // 初始化完成
app.on('ready', () => { app.on('ready', () => {
// 设置应用程序用户模型标识符 // 设置应用程序用户模型标识符
electronApp.setAppUserModelId('com.electron') electronApp.setAppUserModelId('com.electron')
@ -170,6 +172,7 @@ app.on('ready', () => {
}) })
createLoginWindow() createLoginWindow()
app.on('activate', function () { app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createLoginWindow() if (BrowserWindow.getAllWindows().length === 0) createLoginWindow()
}) })