Skip to content

Commit

Permalink
test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ircfspace committed Jun 19, 2024
1 parent 7289e1e commit 7b833da
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 65 deletions.
111 changes: 49 additions & 62 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"url": "https://github.com/bepass-org/oblivion-desktop/issues",
"email": "[email protected]"
},
"version": "0.23.13-beta",
"version": "0.23.8-beta",
"license": "Restrictive",
"main": "./src/main/main.ts",
"scripts": {
Expand Down Expand Up @@ -96,6 +96,7 @@
"electron-debug": "^3.2.0",
"electron-log": "^4.4.8",
"electron-settings": "^4.0.3",
"electron-updater": "^6.2.1",
"lottie-react": "^2.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oblivion-desktop",
"description": "unofficial desktop version of oblivion",
"version": "0.23.13-beta",
"version": "0.23.8-beta",
"homepage": "https://github.com/bepass-org/oblivion-desktop#readme",
"license": "Restrictive",
"author": "ircfspace+kiomarzsss <[email protected]> (https://ircf.space/)",
Expand Down
62 changes: 61 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import {
Tray,
nativeImage,
IpcMainEvent,
globalShortcut
globalShortcut,
dialog
} from 'electron';
import path from 'path';
import fs from 'fs';
import settings from 'electron-settings';
import log from 'electron-log';
import { autoUpdater } from 'electron-updater';
import MenuBuilder from './menu';
import { exitTheApp, isDev } from './lib/utils';
import { openDevToolsByDefault, useCustomWindowXY } from './dxConfig';
Expand All @@ -48,6 +50,9 @@ export const binAssetsPath = path.join(
);
export const regeditVbsDirPath = path.join(binAssetsPath, 'vbs');

autoUpdater.allowPrerelease = true;
autoUpdater.autoRunAppAfterInstall = true;

if (!gotTheLock) {
log.info('did not create new instance since there was already one running.');
app.exit(0);
Expand Down Expand Up @@ -429,6 +434,61 @@ if (!gotTheLock) {
)
);
});

autoUpdater.checkForUpdatesAndNotify();
autoUpdater.on('update-available', () => {
dialog
.showMessageBox({
type: 'info',
title: 'Update Available',
message:
'A new version of the ' +
appTitle +
' is available. Do you want to update now?',
buttons: ['Yes', 'No']
})
.then((result) => {
if (result.response === 0) {
autoUpdater.downloadUpdate();
if (mainWindow) {
mainWindow.setProgressBar(100);
}
}
});
});

autoUpdater.on('download-progress', (progressObj) => {
let logMessage: any = 'Download speed: ' + progressObj.bytesPerSecond;
logMessage = logMessage + ' - Downloaded ' + progressObj.percent + '%';
logMessage =
logMessage + ' (' + progressObj.transferred + '/' + progressObj.total + ')';
log.info(logMessage);
if (mainWindow) {
mainWindow.setProgressBar(Math.round(progressObj.percent) / 100);
}
});

autoUpdater.on('update-downloaded', () => {
if (mainWindow) {
mainWindow.setProgressBar(1);
}
dialog
.showMessageBox({
type: 'info',
title: 'Update Ready',
message:
'A new version of the ' +
appTitle +
' is ready. It will be installed after a restart. Do you want to restart now?',
buttons: ['Yes', 'Later']
})
// eslint-disable-next-line promise/no-nesting
.then((result) => {
if (result.response === 0) {
autoUpdater.quitAndInstall();
}
});
});
});

// Remove this if your app does not use auto updates
Expand Down

0 comments on commit 7b833da

Please sign in to comment.