Merge branch 'master' of https://git.loafle.net/ucap-web/next-ucap-messenger
This commit is contained in:
commit
5cb1281908
|
@ -2,9 +2,9 @@ version: '3.1'
|
|||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:1.17.5-alpine
|
||||
image: nginx:1.17.8-alpine
|
||||
volumes:
|
||||
- ../dist/web:/usr/share/nginx/html:ro
|
||||
- ./html:/usr/share/nginx/html:ro
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
ports:
|
||||
- 8099:80
|
||||
- 80:80
|
||||
|
|
|
@ -15,11 +15,6 @@ export class ElectronUpdateWindowService {
|
|||
private browserWindow: BrowserWindow;
|
||||
private templateUrl: string;
|
||||
|
||||
versionInfo: {
|
||||
installed?: string;
|
||||
latest?: string;
|
||||
};
|
||||
|
||||
constructor(options: ElectronUpdateWindowOptions) {
|
||||
this.customOptions = {
|
||||
...DefaultElectronUpdateWindowOptions
|
||||
|
@ -59,7 +54,7 @@ export class ElectronUpdateWindowService {
|
|||
return this.templateUrl;
|
||||
}
|
||||
|
||||
show() {
|
||||
show(versionInfo: { installed: string; latest: string }) {
|
||||
this.browserWindow = new BrowserWindow(this.customOptions);
|
||||
this.browserWindow.loadURL(this.templatePath);
|
||||
|
||||
|
@ -78,7 +73,7 @@ export class ElectronUpdateWindowService {
|
|||
|
||||
this.browserWindow.webContents.send(
|
||||
Channel.browserWindowSetContents,
|
||||
this.versionInfo
|
||||
versionInfo
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -42,13 +42,17 @@ downloadingCancel &&
|
|||
});
|
||||
|
||||
function setContents(event, versionInfo) {
|
||||
let updateDoc = global.window.document;
|
||||
const updateDoc = global.window.document;
|
||||
|
||||
let latestVersion = updateDoc.getElementById('latestVersion');
|
||||
latestVersion.innerHTML = versionInfo.latest || '';
|
||||
const latestVersion = updateDoc.getElementById('latestVersion');
|
||||
if (!!latestVersion) {
|
||||
latestVersion.innerHTML = versionInfo.latest || '';
|
||||
}
|
||||
|
||||
let installedVersion = updateDoc.getElementById('installedVersion');
|
||||
installedVersion.innerHTML = versionInfo.installed || '';
|
||||
const installedVersion = updateDoc.getElementById('installedVersion');
|
||||
if (!!installedVersion) {
|
||||
installedVersion.innerHTML = versionInfo.installed || '';
|
||||
}
|
||||
}
|
||||
|
||||
ipcRenderer.on(
|
||||
|
@ -67,4 +71,7 @@ ipcRenderer.on(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.on('UCAP::ElectronUpdateWindow::BrowserWindowSetContents', setContents);
|
||||
ipcRenderer.on(
|
||||
'UCAP::ElectronUpdateWindow::BrowserWindowSetContents',
|
||||
setContents
|
||||
);
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
Menu,
|
||||
shell,
|
||||
dialog,
|
||||
webFrame
|
||||
BrowserWindow
|
||||
} from 'electron';
|
||||
import path from 'path';
|
||||
import fse from 'fs-extra';
|
||||
|
@ -359,10 +359,6 @@ ipcMain.on(UpdaterChannel.Apply, (event: IpcMainEvent, ...args: any[]) => {
|
|||
const ver = args[0];
|
||||
|
||||
if (semver.lt(app.getVersion(), ver)) {
|
||||
updateWindowService.versionInfo = {
|
||||
latest: ver,
|
||||
installed: app.getVersion()
|
||||
};
|
||||
autoUpdater
|
||||
.checkForUpdatesAndNotify()
|
||||
.then(result => {})
|
||||
|
@ -718,7 +714,10 @@ autoUpdater.on('update-available', info => {
|
|||
log.info(info);
|
||||
log.info('Update available.');
|
||||
|
||||
updateWindowService.show();
|
||||
updateWindowService.show({
|
||||
latest: info.version,
|
||||
installed: app.getVersion()
|
||||
});
|
||||
});
|
||||
autoUpdater.on('update-not-available', info => {
|
||||
log.info('Update not available.');
|
||||
|
@ -743,6 +742,15 @@ autoUpdater.on('update-downloaded', info => {
|
|||
|
||||
updateWindowService.setDownloadComplete();
|
||||
|
||||
app.removeAllListeners('window-all-closed');
|
||||
const browserWindows = BrowserWindow.getAllWindows();
|
||||
|
||||
// https://github.com/electron-userland/electron-builder/issues/1604#issuecomment-372091881
|
||||
browserWindows.forEach(browserWindow => {
|
||||
browserWindow.removeAllListeners('close');
|
||||
browserWindow.removeAllListeners('closed');
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
autoUpdater.quitAndInstall(true, true);
|
||||
}, 2000);
|
||||
|
|
Loading…
Reference in New Issue
Block a user