Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
KinoriN committed Oct 14, 2019
1 parent 3c06d56 commit f53e0ba
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
13 changes: 8 additions & 5 deletions electron/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@
import * as request from 'request';
import * as fs from 'fs';
import { join } from 'path';
import { autoUpdater, AppUpdater } from 'electron-updater';
import { autoUpdater } from 'electron-updater';
import { VtbInfoService, FollowListService } from './services';
import { FollowList, VtbInfo } from '../../interfaces';
import { PlayerObj } from '../../interfaces';
import { createMainWinMenu } from './mainWinMenu';
import { version } from 'punycode';
const tempPath = app.getPath('temp');

let playerObjMap = new Map<number, PlayerObj>();
let win: BrowserWindow = null;
let vtbInfosService: VtbInfoService;
const mainWindowInit = new Promise<BrowserWindow>((resolve) => {
app.on('ready', () => {
autoUpdater.setFeedURL('https://dd.center/api/update/ddmonitor/');
autoUpdater.autoDownload = true;
// autoUpdater.setFeedURL('http://localhost:2333/api/update/ddmonitor/');
autoUpdater.checkForUpdates();
autoUpdater.autoDownload = false;
autoUpdater.on('update-available', () => {
autoUpdater.downloadUpdate();
})
autoUpdater.on('update-downloaded', (info) => {
dialog.showMessageBox(win, <any>{
type: 'info',
title: '发现新版本:' + info.version,
message: '发现新版本:' + info.version,
detail: '更新内容:' + info.releaseNotes,
buttons: ['退出并更新', '暂不更新']
buttons: ['退出并更新', '暂不更新'],
cancelId: 1
}).then(value => {
if (value.response == 0) {
autoUpdater.quitAndInstall();
Expand Down
10 changes: 9 additions & 1 deletion electron/src/mainWinMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ const createMainWinMenu = (app: Electron.App, players: Map<number, PlayerObj>) =
return autoSetPlayerBounds(display);
})
}))
}
},
{
label: '关闭所有播放器',
click: () => {
players.forEach((player: PlayerObj) => {
player.playerWin.close();
})
}
},
]
}

Expand Down
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bili-dd-monitor",
"version": "0.0.8",
"version": "0.0.9",
"author": "kinori",
"scripts": {
"ng": "ng",
Expand All @@ -26,6 +26,7 @@
},
"devDependencies": {
"ngx-electron": "^2.1.1",
"electron-log": "^3.0.8",
"@angular-devkit/build-angular": "^0.803.9",
"@angular/animations": "^8.2.10",
"@angular/cli": "^8.3.9",
Expand Down Expand Up @@ -74,7 +75,7 @@
"output": "build"
},
"releaseInfo": {
"releaseName": "0.0.8",
"releaseName": "0.0.9",
"releaseNotes": "部署自动更新"
},
"win": {
Expand Down

0 comments on commit f53e0ba

Please sign in to comment.