From 990828c69864d109bfe03a26a158e0ea7f6fce10 Mon Sep 17 00:00:00 2001 From: Xmader Date: Tue, 30 Oct 2018 14:17:54 +0800 Subject: [PATCH] =?UTF-8?q?v1.6.2=20-=20=E4=BF=AE=E5=A4=8D=E5=9C=A8MacOS?= =?UTF-8?q?=E4=B8=8A=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20-=20#5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/app.js | 20 +++++++++++++++++--- app/package.json | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/app.js b/app/app.js index a8cf9f7..e704e48 100644 --- a/app/app.js +++ b/app/app.js @@ -18,9 +18,8 @@ const edit_conf = require('./edit_conf.js') const { app, BrowserWindow, Menu, ipcMain } = electron -var mainWindow = null; +let mainWindow = null; -// console.dir(process.argv) const isDev = process.argv.pop() == "dev"; // 增加右键菜单 @@ -43,6 +42,16 @@ if (isDev) { } const contextMenu = Menu.buildFromTemplate(contextMenuTemplate); +const appMenuTemplate = [ + { + submenu: [{ label: "退出", role: "quit" }] + }, + { + label: "编辑", + submenu: contextMenuTemplate + } +] + app.commandLine.appendSwitch('ignore-certificate-errors') // 忽略证书相关错误, 适用于使用自签名证书将Aria2的RPC配置成HTTPS协议的情况 @@ -80,7 +89,12 @@ app.on('ready', function () { // 打开窗口的调试工具 //mainWindow.webContents.openDevTools(); - mainWindow.setMenu(null); + if (platform == 'darwin') { + Menu.setApplicationMenu(Menu.buildFromTemplate(appMenuTemplate)) + } else { + mainWindow.setMenu(null) + } + mainWindow.loadURL(`file://${__dirname}/pages/index.html`); mainWindow.once('ready-to-show', function () { diff --git a/app/package.json b/app/package.json index aecc2a0..5604bee 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "ariang-gui", - "version": "1.6.1", + "version": "1.6.2", "private": true, "description": "AriaNg GUI", "main": "app.js",