diff --git a/package.json b/package.json index d468043..0a6d90f 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "discord-rpc": "^4.0.1", "electron-squirrel-startup": "^1.0.1", "electron-store": "^10.1.0", - "update-electron-app": "^3.1.2", "utf-8-validate": "^6.0.5" }, "packageManager": "pnpm@10.33.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a6151d9..8c726db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,9 +29,6 @@ importers: electron-store: specifier: ^10.1.0 version: 10.1.0 - update-electron-app: - specifier: ^3.1.2 - version: 3.1.2 utf-8-validate: specifier: ^6.0.5 version: 6.0.5 @@ -910,56 +907,67 @@ packages: resolution: {integrity: sha512-kDWSPafToDd8LcBYd1t5jw7bD5Ojcu12S3uT372e5HKPzQt532vW+rGFFOaiR0opxePyUkHrwz8iWYEyH1IIQA==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.52.2': resolution: {integrity: sha512-gKm7Mk9wCv6/rkzwCiUC4KnevYhlf8ztBrDRT9g/u//1fZLapSRc+eDZj2Eu2wpJ+0RzUKgtNijnVIB4ZxyL+w==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.52.2': resolution: {integrity: sha512-66lA8vnj5mB/rtDNwPgrrKUOtCLVQypkyDa2gMfOefXK6rcZAxKLO9Fy3GkW8VkPnENv9hBkNOFfGLf6rNKGUg==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.52.2': resolution: {integrity: sha512-s+OPucLNdJHvuZHuIz2WwncJ+SfWHFEmlC5nKMUgAelUeBUnlB4wt7rXWiyG4Zn07uY2Dd+SGyVa9oyLkVGOjA==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.52.2': resolution: {integrity: sha512-8wTRM3+gVMDLLDdaT6tKmOE3lJyRy9NpJUS/ZRWmLCmOPIJhVyXwjBo+XbrrwtV33Em1/eCTd5TuGJm4+DmYjw==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-gnu@4.52.2': resolution: {integrity: sha512-6yqEfgJ1anIeuP2P/zhtfBlDpXUb80t8DpbYwXQ3bQd95JMvUaqiX+fKqYqUwZXqdJDd8xdilNtsHM2N0cFm6A==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.52.2': resolution: {integrity: sha512-sshYUiYVSEI2B6dp4jMncwxbrUqRdNApF2c3bhtLAU0qA8Lrri0p0NauOsTWh3yCCCDyBOjESHMExonp7Nzc0w==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.52.2': resolution: {integrity: sha512-duBLgd+3pqC4MMwBrKkFxaZerUxZcYApQVC5SdbF5/e/589GwVvlRUnyqMFbM8iUSb1BaoX/3fRL7hB9m2Pj8Q==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.52.2': resolution: {integrity: sha512-tzhYJJidDUVGMgVyE+PmxENPHlvvqm1KILjjZhB8/xHYqAGeizh3GBGf9u6WdJpZrz1aCpIIHG0LgJgH9rVjHQ==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.52.2': resolution: {integrity: sha512-opH8GSUuVcCSSyHHcl5hELrmnk4waZoVpgn/4FDao9iyE4WpQhyWJ5ryl5M3ocp4qkRuHfyXnGqg8M9oKCEKRA==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.52.2': resolution: {integrity: sha512-LSeBHnGli1pPKVJ79ZVJgeZWWZXkEe/5o8kcn23M8eMKCUANejchJbF/JqzM4RRjOJfNRhKJk8FuqL1GKjF5oQ==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openharmony-arm64@4.52.2': resolution: {integrity: sha512-uPj7MQ6/s+/GOpolavm6BPo+6CbhbKYyZHUDvZ/SmJM7pfDBgdGisFX3bY/CBDMg2ZO4utfhlApkSfZ92yXw7Q==} @@ -1977,9 +1985,6 @@ packages: resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} engines: {node: '>= 0.4'} - github-url-to-object@4.0.6: - resolution: {integrity: sha512-NaqbYHMUAlPcmWFdrAB7bcxrNIiiJWJe8s/2+iOc9vlcHlwHqSGrPk+Yi3nu6ebTwgsZEa7igz+NH2vEq3gYwQ==} - glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -2267,9 +2272,6 @@ packages: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} - is-url@1.2.4: - resolution: {integrity: sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==} - is-weakmap@2.0.2: resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} engines: {node: '>= 0.4'} @@ -3302,9 +3304,6 @@ packages: peerDependencies: browserslist: '>= 4.21.0' - update-electron-app@3.1.2: - resolution: {integrity: sha512-htLyPJv7mEoCpaSzCg0W3Hxz7ID0GC7BIhhpK32/ITG7McrWak4aOkLEOjJheKAI94AxtBVTjCk4EFIvyttw2w==} - uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -5835,10 +5834,6 @@ snapshots: es-errors: 1.3.0 get-intrinsic: 1.3.0 - github-url-to-object@4.0.6: - dependencies: - is-url: 1.2.4 - glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -6146,8 +6141,6 @@ snapshots: is-unicode-supported@0.1.0: {} - is-url@1.2.4: {} - is-weakmap@2.0.2: {} is-weakref@1.1.1: @@ -7218,11 +7211,6 @@ snapshots: escalade: 3.2.0 picocolors: 1.1.1 - update-electron-app@3.1.2: - dependencies: - github-url-to-object: 4.0.6 - ms: 2.1.3 - uri-js@4.4.1: dependencies: punycode: 2.3.1 diff --git a/src/main.ts b/src/main.ts index 013f47a..a524b62 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,7 @@ import * as fs from "fs"; import * as path from "path"; -import { updateElectronApp } from "update-electron-app"; -import { BrowserWindow, Notification, app, shell } from "electron"; +import { BrowserWindow, app, shell } from "electron"; import started from "electron-squirrel-startup"; import { aviaVersion } from "../package.json"; @@ -11,6 +10,7 @@ import { autoLaunch } from "./native/autoLaunch"; import { setBadgeCount } from "./native/badges"; import { config } from "./native/config"; import { initDiscordRpc } from "./native/discordRpc"; +import { checkForUpdates } from "./native/updater"; import { initTray } from "./native/tray"; import { BUILD_URL, createMainWindow, mainWindow } from "./native/window"; @@ -42,16 +42,6 @@ if (!config.hardwareAcceleration) { const acquiredLock = app.requestSingleInstanceLock(); -const onNotifyUser = () => { - const notification = new Notification({ - title: "Update Available", - body: "Restart the app to install the update.", - silent: true, - }); - - notification.show(); -}; - const loadInject = () => { if (!mainWindow) return; @@ -87,8 +77,6 @@ const loadInject = () => { }; if (acquiredLock) { - updateElectronApp({ onNotifyUser }); - app.whenReady().then(() => { applyAppName(); createMainWindow(); @@ -110,6 +98,7 @@ if (acquiredLock) { initTray(); initDiscordRpc(); + checkForUpdates(); setBadgeCount(0); if (process.platform === "win32") { diff --git a/src/native/update-window.ts b/src/native/update-window.ts new file mode 100644 index 0000000..5206ea5 --- /dev/null +++ b/src/native/update-window.ts @@ -0,0 +1,83 @@ +import { BrowserWindow, app, ipcMain } from "electron"; + +let win: BrowserWindow | null = null; + +const HTML = `
+