mirror of
https://github.com/QYG2297248353/IYUUPlus-Windows.git
synced 2025-12-29 08:01:35 +08:00
v1.0.0
This commit is contained in:
+6
-1
@@ -1,7 +1,10 @@
|
||||
const { Menu, BrowserWindow } = require("electron")
|
||||
const path = require('node:path')
|
||||
const server = require('../server/server');
|
||||
const mainWin = require('../windows/app');
|
||||
|
||||
const iconPath = path.join(__dirname, '..', 'iyuu.ico')
|
||||
|
||||
let template = [
|
||||
{
|
||||
label: "IYUU",
|
||||
@@ -15,7 +18,6 @@ let template = [
|
||||
{
|
||||
label: "重启服务",
|
||||
click: () => {
|
||||
mainWin.closeWindows()
|
||||
server.restartServer()
|
||||
}
|
||||
|
||||
@@ -26,6 +28,7 @@ let template = [
|
||||
let win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
icon: iconPath,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
@@ -48,6 +51,7 @@ let template = [
|
||||
let win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
icon: iconPath,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
@@ -65,6 +69,7 @@ let template = [
|
||||
let win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
icon: iconPath,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
|
||||
+17
-3
@@ -1,9 +1,11 @@
|
||||
const { app, Menu, Tray } = require("electron")
|
||||
const path = require('node:path')
|
||||
const log = require('electron-log')
|
||||
const server = require('../server/server');
|
||||
const mainWin = require('../windows/app');
|
||||
|
||||
const tray = new Tray('iyuu.ico');
|
||||
const iconPath = path.join(__dirname, '..', 'iyuu.ico')
|
||||
const tray = new Tray(iconPath);
|
||||
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
@@ -12,12 +14,24 @@ const contextMenu = Menu.buildFromTemplate([
|
||||
mainWin.showWindows()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '通过浏览器打开',
|
||||
click: () => {
|
||||
require('electron').shell.openExternal('http://127.0.0.1:8787')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '重启服务',
|
||||
click: () => {
|
||||
server.restartServer()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '强制退出',
|
||||
click: () => {
|
||||
app.exit(414)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '退出',
|
||||
click: () => {
|
||||
@@ -31,8 +45,8 @@ tray.setContextMenu(contextMenu);
|
||||
|
||||
tray.on('double-click', () => {
|
||||
if (mainWin.visibleWindows()) {
|
||||
mainWin.showWindows()
|
||||
} else {
|
||||
mainWin.hideWindows()
|
||||
} else {
|
||||
mainWin.showWindows()
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user