Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: implement updater functionality with check and install methods
Tonho3944ec2833eb
diff --git a/src/lib/updater.ts b/src/lib/updater.tsnew file mode 100644index 00000000..4d5c3927--- /dev/null+++ b/src/lib/updater.ts@@ -0,0 +1,32 @@+import { check } from "@tauri-apps/plugin-updater";+import { relaunch } from "@tauri-apps/plugin-process";++export interface UpdateInfo {+ available: boolean;+ version?: string;+ body?: string;+}++export async function checkForUpdate(): Promise<UpdateInfo> {+ try {+ const update = await check();+ if (update) {+ return {+ available: true,+ version: update.version,+ body: update.body ?? undefined,+ };+ }+ return { available: false };+ } catch {+ return { available: false };+ }+}++export async function installUpdate(): Promise<void> {+ const update = await check();+ if (update) {+ await update.downloadAndInstall();+ await relaunch();+ }+}