mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 11:57:12 +08:00
fix(electron): auto update
This commit is contained in:
parent
02c4ee9fb2
commit
b7f51f02c2
|
@ -37,7 +37,7 @@
|
||||||
"electron-devtools-installer": "^3.1.1",
|
"electron-devtools-installer": "^3.1.1",
|
||||||
"electron-icon-builder": "^1.0.2",
|
"electron-icon-builder": "^1.0.2",
|
||||||
"electron-is-dev": "^1.2.0",
|
"electron-is-dev": "^1.2.0",
|
||||||
"electron-log": "^4.2.4",
|
"electron-log": "^4.3.0",
|
||||||
"electron-updater": "^4.3.5",
|
"electron-updater": "^4.3.5",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-fileupload": "^1.2.0",
|
"express-fileupload": "^1.2.0",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
import { app, protocol, BrowserWindow, shell } from "electron";
|
import { app, protocol, BrowserWindow, shell, dialog } 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";
|
||||||
|
@ -20,9 +20,6 @@ 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 } },
|
||||||
|
@ -91,6 +88,34 @@ app.on("ready", async () => {
|
||||||
// start netease music api
|
// start netease music api
|
||||||
startNeteaseMusicApi();
|
startNeteaseMusicApi();
|
||||||
|
|
||||||
|
// check for update
|
||||||
|
const log = require("electron-log");
|
||||||
|
log.transports.file.level = "debug";
|
||||||
|
autoUpdater.logger = log;
|
||||||
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
autoUpdater.on("update-available", (info) => {
|
||||||
|
log.debug(info);
|
||||||
|
dialog
|
||||||
|
.showMessageBox({
|
||||||
|
title: "发现新版本 v" + info.version,
|
||||||
|
message: "发现新版本 v" + info.version,
|
||||||
|
detail: "是否前往 Github 下载新版本安装包?",
|
||||||
|
buttons: ["下载", "取消"],
|
||||||
|
type: "question",
|
||||||
|
noLink: true,
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
if (result.response === 0) {
|
||||||
|
shell.openExternal(
|
||||||
|
"https://github.com/qier222/YesPlayMusic/releases"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Install Vue Devtools extension
|
// Install Vue Devtools extension
|
||||||
if (isDevelopment && !process.env.IS_TEST) {
|
if (isDevelopment && !process.env.IS_TEST) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -61,7 +61,6 @@ module.exports = {
|
||||||
owner: "qier222",
|
owner: "qier222",
|
||||||
repo: "YesPlayMusic",
|
repo: "YesPlayMusic",
|
||||||
vPrefixedTagName: true,
|
vPrefixedTagName: true,
|
||||||
private: true,
|
|
||||||
releaseType: "draft",
|
releaseType: "draft",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -70,7 +69,6 @@ module.exports = {
|
||||||
},
|
},
|
||||||
mac: {
|
mac: {
|
||||||
category: "public.app-category.music",
|
category: "public.app-category.music",
|
||||||
target: "dmg",
|
|
||||||
darkModeSupport: true,
|
darkModeSupport: true,
|
||||||
},
|
},
|
||||||
win: {
|
win: {
|
||||||
|
|
|
@ -4379,10 +4379,10 @@ electron-localshortcut@^3.1.0:
|
||||||
keyboardevent-from-electron-accelerator "^2.0.0"
|
keyboardevent-from-electron-accelerator "^2.0.0"
|
||||||
keyboardevents-areequal "^0.2.1"
|
keyboardevents-areequal "^0.2.1"
|
||||||
|
|
||||||
electron-log@^4.2.4:
|
electron-log@^4.3.0:
|
||||||
version "4.2.4"
|
version "4.3.0"
|
||||||
resolved "https://registry.npm.taobao.org/electron-log/download/electron-log-4.2.4.tgz#a13e42a9fc42ca2cc7d2603c3746352efa82112e"
|
resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-4.3.0.tgz#6e841a5c9af34ed3ca83e5a8a4156fdc39bed464"
|
||||||
integrity sha1-oT5CqfxCyizH0mA8N0Y1LvqCES4=
|
integrity sha512-iuJjH/ZEJkDyCbuAMvvFxAjCMDLMXIQ5NqvppETGrbtf4b/007r5P36BSvexdy0UzwDNzDtIuEXLR34vRXWZrg==
|
||||||
|
|
||||||
electron-publish@22.9.1:
|
electron-publish@22.9.1:
|
||||||
version "22.9.1"
|
version "22.9.1"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user