IYUUPlus-Windows/menu/menu.js

110 lines
3.4 KiB
JavaScript
Raw Normal View History

2024-07-02 17:37:28 +08:00
const { app, Menu, BrowserWindow } = require("electron")
2024-07-01 16:50:17 +08:00
const path = require('node:path')
2024-06-27 18:27:45 +08:00
const server = require('../server/server');
2024-07-01 14:08:06 +08:00
const mainWin = require('../windows/app');
2024-06-27 18:27:45 +08:00
2024-07-01 16:50:17 +08:00
const iconPath = path.join(__dirname, '..', 'iyuu.ico')
2024-07-02 17:37:28 +08:00
const iconPngPath = path.join(__dirname, '..', 'iyuu.png')
const { version } = require('../package.json')
2024-07-01 16:50:17 +08:00
2024-06-27 18:27:45 +08:00
let template = [
{
label: "IYUU",
submenu: [
2024-06-29 00:41:06 +08:00
{
label: "刷新",
click: () => {
2024-07-01 14:08:06 +08:00
mainWin.refreshUrl()
2024-06-29 00:41:06 +08:00
}
},
2024-06-27 18:27:45 +08:00
{
label: "重启服务",
click: () => {
server.restartServer()
}
},
{
label: "文档中心",
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
2024-07-02 17:37:28 +08:00
icon: iconPath
2024-06-27 18:27:45 +08:00
});
win.loadURL("https://doc.iyuu.cn/");
win.on("closed", () => {
win = null;
});
}
},
2024-07-02 17:37:28 +08:00
{
label: "数据统计",
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
icon: iconPath
});
win.loadURL("https://analytics.lifebus.top/share/uz482jXYOxwnoRRZ/iyuu.lifebus.top");
win.on("closed", () => {
win = null;
});
}
},
2024-06-27 18:27:45 +08:00
]
},
{
label: "帮助",
submenu: [
{
2024-06-29 00:41:06 +08:00
label: "问题反馈",
2024-06-27 18:27:45 +08:00
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
2024-07-02 17:37:28 +08:00
icon: iconPath
2024-06-27 18:27:45 +08:00
});
2024-06-29 00:41:06 +08:00
win.loadURL("https://gitee.com/qyg2297248353/iyuuplus-windows/issues");
2024-06-27 18:27:45 +08:00
win.on("closed", () => {
win = null;
});
}
},
{
2024-06-29 00:41:06 +08:00
label: "新疆萌森软件开发工作室提供技术支持",
2024-06-27 18:27:45 +08:00
click: () => {
let win = new BrowserWindow({
width: 800,
height: 600,
2024-07-02 17:37:28 +08:00
icon: iconPath
2024-06-27 18:27:45 +08:00
});
2024-07-02 17:37:28 +08:00
win.loadURL("https://blog.lifebus.top/");
2024-06-27 18:27:45 +08:00
win.on("closed", () => {
win = null;
});
}
2024-06-29 00:41:06 +08:00
},
{
2024-07-02 17:37:28 +08:00
label: "关于",
click: () => {
app.setAboutPanelOptions({
applicationName: "IYUU Plus Windows",
applicationVersion: version,
version: version,
copyright: "新疆萌森软件开发工作室",
authors: ["新疆萌森软件开发工作室", "大卫"],
website: "https://blog.lifebus.top/",
iconPath: iconPngPath
})
app.showAboutPanel()
}
2024-06-27 18:27:45 +08:00
}
]
}
]
const m = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(m)