|
|
@ -1,5 +1,5 @@
|
|
|
|
"use strict";
|
|
|
|
"use strict";
|
|
|
|
import { app, protocol, BrowserWindow, globalShortcut } from "electron";
|
|
|
|
import { app, protocol, BrowserWindow } from "electron";
|
|
|
|
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
|
|
|
|
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
|
|
|
|
import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
|
|
|
|
import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
|
|
|
|
import { startNeteaseMusicApi } from "./electron/services";
|
|
|
|
import { startNeteaseMusicApi } from "./electron/services";
|
|
|
@ -8,7 +8,7 @@ import { createMenu } from "./electron/menu";
|
|
|
|
import { createTouchBar } from "./electron/touchBar";
|
|
|
|
import { createTouchBar } from "./electron/touchBar";
|
|
|
|
import { createDockMenu } from "./electron/dockMenu";
|
|
|
|
import { createDockMenu } from "./electron/dockMenu";
|
|
|
|
import { createTray } from "./electron/tray.js";
|
|
|
|
import { createTray } from "./electron/tray.js";
|
|
|
|
// import { autoUpdater } from "electron-updater"
|
|
|
|
import { autoUpdater } from "electron-updater";
|
|
|
|
|
|
|
|
|
|
|
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
|
|
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
|
|
|
|
|
|
|
|
|
|
@ -19,6 +19,9 @@ let win;
|
|
|
|
// ipcMain
|
|
|
|
// ipcMain
|
|
|
|
initIpcMain(win);
|
|
|
|
initIpcMain(win);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for update
|
|
|
|
|
|
|
|
autoUpdater.checkForUpdatesAndNotify();
|
|
|
|
|
|
|
|
|
|
|
|
// Scheme must be registered before the app is ready
|
|
|
|
// Scheme must be registered before the app is ready
|
|
|
|
protocol.registerSchemesAsPrivileged([
|
|
|
|
protocol.registerSchemesAsPrivileged([
|
|
|
|
{ scheme: "app", privileges: { secure: true, standard: true } },
|
|
|
|
{ scheme: "app", privileges: { secure: true, standard: true } },
|
|
|
@ -80,7 +83,7 @@ app.on("ready", async () => {
|
|
|
|
// start netease music api
|
|
|
|
// start netease music api
|
|
|
|
startNeteaseMusicApi();
|
|
|
|
startNeteaseMusicApi();
|
|
|
|
|
|
|
|
|
|
|
|
// Install Vue Devtools xtension
|
|
|
|
// Install Vue Devtools extension
|
|
|
|
if (isDevelopment && !process.env.IS_TEST) {
|
|
|
|
if (isDevelopment && !process.env.IS_TEST) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await installExtension(VUEJS_DEVTOOLS);
|
|
|
|
await installExtension(VUEJS_DEVTOOLS);
|
|
|
@ -89,11 +92,6 @@ app.on("ready", async () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Register shortcut for debug
|
|
|
|
|
|
|
|
globalShortcut.register("CommandOrControl+K", function () {
|
|
|
|
|
|
|
|
win.webContents.openDevTools();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create window
|
|
|
|
// create window
|
|
|
|
createWindow();
|
|
|
|
createWindow();
|
|
|
|
win.once("ready-to-show", () => {
|
|
|
|
win.once("ready-to-show", () => {
|
|
|
@ -108,27 +106,8 @@ app.on("ready", async () => {
|
|
|
|
|
|
|
|
|
|
|
|
// create touchbar
|
|
|
|
// create touchbar
|
|
|
|
win.setTouchBar(createTouchBar(win));
|
|
|
|
win.setTouchBar(createTouchBar(win));
|
|
|
|
|
|
|
|
|
|
|
|
// autoUpdater.checkForUpdatesAndNotify()
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// autoUpdater.on("checking-for-update", () => {});
|
|
|
|
|
|
|
|
// autoUpdater.on("update-available", info => {
|
|
|
|
|
|
|
|
// console.log(info);
|
|
|
|
|
|
|
|
// dialog.showMessageBox({
|
|
|
|
|
|
|
|
// title: "新版本发布",
|
|
|
|
|
|
|
|
// message: "有新内容更新,稍后将重新为您安装",
|
|
|
|
|
|
|
|
// buttons: ["确定"],
|
|
|
|
|
|
|
|
// type: "info",
|
|
|
|
|
|
|
|
// noLink: true
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// autoUpdater.on("update-downloaded", info => {
|
|
|
|
|
|
|
|
// console.log(info);
|
|
|
|
|
|
|
|
// autoUpdater.quitAndInstall();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Exit cleanly on request from parent process in development mode.
|
|
|
|
// Exit cleanly on request from parent process in development mode.
|
|
|
|
if (isDevelopment) {
|
|
|
|
if (isDevelopment) {
|
|
|
|
if (process.platform === "win32") {
|
|
|
|
if (process.platform === "win32") {
|
|
|
|