Skip to content

Commit

Permalink
Add auto updater
Browse files Browse the repository at this point in the history
  • Loading branch information
RuurdBijlsma committed Nov 12, 2023
1 parent dc733d4 commit c129a32
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 13 deletions.
108 changes: 98 additions & 10 deletions 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
Expand Up @@ -33,21 +33,22 @@
"@electron-toolkit/utils": "^2.0.1",
"chart.js": "^4.4.0",
"color-extr-thief": "^2.3.4",
"electron-updater": "^6.1.4",
"events": "^3.3.0",
"express": "^4.18.2",
"ffbinaries": "^1.1.5",
"filenamify": "^6.0.0",
"iconv-lite": "^0.6.3",
"idb": "^7.1.1",
"pinia": "^2.1.7",
"replace-special-characters": "^1.2.7",
"spotify-web-api-js": "^1.5.2",
"vite-plugin-vuetify": "^1.0.2",
"vue-chartjs": "^5.2.0",
"vue-router": "^4.2.5",
"vuetify": "^3.3.23",
"youtube-search-api": "^1.2.1",
"yt-dlp-wrap": "^2.3.12",
"replace-special-characters": "^1.2.7"
"yt-dlp-wrap": "^2.3.12"
},
"devDependencies": {
"@electron-toolkit/tsconfig": "^1.0.1",
Expand Down
15 changes: 14 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ import { join } from "path";
import { electronApp, is, optimizer } from "@electron-toolkit/utils";
import icon from "../../resources/app-icon/dark-500.png?asset";
import { handleIpc } from "./ipcFunctions";
import { autoUpdater } from "electron-updater";

async function configUpdater() {
setInterval(
() => {
autoUpdater.checkForUpdatesAndNotify();
},
1000 * 60 * 60,
);
autoUpdater.checkForUpdatesAndNotify().then();
autoUpdater.on("error", (e) => console.error("[auto updater]", e));
}

function createWindow(): void {
// Create the browser window.
Expand Down Expand Up @@ -36,10 +48,11 @@ function createWindow(): void {

// HMR for renderer base on electron-vite cli.
// Load the remote URL for development or the local html file for production.
mainWindow.loadURL(url);
mainWindow.loadURL(url).then();
if (isDev) mainWindow.webContents.openDevTools();

handleIpc(ipcMain, mainWindow);
configUpdater();
}

// This method will be called when Electron has finished
Expand Down

0 comments on commit c129a32

Please sign in to comment.