auto-update

This commit is contained in:
PhilReact 2024-11-03 18:24:57 +02:00
parent cf845cae1b
commit e3a6d826f9
5 changed files with 37 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

@ -1,5 +1,5 @@
{ {
"appId": "com.yourdomain.yourapp", "appId": "com.github.Qortal.Qortal-Hub",
"directories": { "directories": {
"buildResources": "resources" "buildResources": "resources"
}, },
@ -14,13 +14,21 @@
"oneClick": false, "oneClick": false,
"allowToChangeInstallationDirectory": true "allowToChangeInstallationDirectory": true
}, },
"publish": [
{
"provider": "github",
"owner": "Qortal",
"repo": "Qortal-Hub",
"releaseType": "draft"
}
],
"win": { "win": {
"target": "nsis", "target": "nsis",
"icon": "assets/appIcon.ico" "icon": "assets/appIcon.ico"
}, },
"linux": { "linux": {
"target": ["AppImage"], "target": ["AppImage"],
"category": "Utility", // Set a specific Linux category here "category": "Utility",
"executableName": "Qortal", "executableName": "Qortal",
"icon": "assets/qortal.png" "icon": "assets/qortal.png"
}, },

View File

@ -1,15 +1,24 @@
{ {
"name": "Qortal ", "name": "qortal-hub",
"version": "1.0.0", "version": "0.0.2",
"description": "An Amazing Capacitor App", "description": "A desktop app that gives you access to the Qortal network",
"author": { "author": {
"name": "", "name": ""
"email": ""
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "" "url": ""
}, },
"build": {
"appId": "com.github.Qortal.Qortal-Hub",
"publish": [
{
"provider": "github",
"owner": "Qortal",
"repo": "Qortal-Hub"
}
]
},
"license": "MIT", "license": "MIT",
"main": "build/src/index.js", "main": "build/src/index.js",
"scripts": { "scripts": {
@ -17,7 +26,8 @@
"electron:start-live": "node ./live-runner.js", "electron:start-live": "node ./live-runner.js",
"electron:start": "npm run build && electron --inspect=5858 ./", "electron:start": "npm run build && electron --inspect=5858 ./",
"electron:pack": "npm run build && electron-builder build --dir -c ./electron-builder.config.json", "electron:pack": "npm run build && electron-builder build --dir -c ./electron-builder.config.json",
"electron:make": "npm run build && electron-builder build -c ./electron-builder.config.json -p always" "electron:make": "npm run build && electron-builder build -c ./electron-builder.config.json -p always",
"electron:make-local": "npm run build && electron-builder build -c ./electron-builder.config.json --publish=never"
}, },
"dependencies": { "dependencies": {
"@capacitor-community/electron": "^5.0.0", "@capacitor-community/electron": "^5.0.0",

View File

@ -46,7 +46,10 @@ if (electronIsDev) {
// Initialize our app, build windows, and load content. // Initialize our app, build windows, and load content.
await myCapacitorApp.init(); await myCapacitorApp.init();
// Check for updates if we are in a packaged app. // Check for updates if we are in a packaged app.
// autoUpdater.checkForUpdatesAndNotify(); autoUpdater.checkForUpdatesAndNotify();
setInterval(() => {
autoUpdater.checkForUpdatesAndNotify();
}, 6 * 60 * 60 * 1000); // 24 hours in milliseconds
})(); })();
// Handle when all of our windows are close (platforms have their own expectations). // Handle when all of our windows are close (platforms have their own expectations).

View File

@ -2,8 +2,14 @@ require('./rt/electron-rt');
////////////////////////////// //////////////////////////////
// User Defined Preload scripts below // User Defined Preload scripts below
console.log('User Preload!'); console.log('User Preload!');
const { contextBridge, shell } = require('electron'); const { contextBridge, shell, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', { contextBridge.exposeInMainWorld('electronAPI', {
openExternal: (url) => shell.openExternal(url) openExternal: (url) => shell.openExternal(url)
}); });
contextBridge.exposeInMainWorld('electron', {
onUpdateAvailable: (callback) => ipcRenderer.on('update_available', callback),
onUpdateDownloaded: (callback) => ipcRenderer.on('update_downloaded', callback),
restartApp: () => ipcRenderer.send('restart_app')
});