mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 01:05:10 +08:00
refactor: rebuild desktop app with Tauri
This commit is contained in:
1 parent
a3ec2a0dfc
commit
4053a7fb20
808 files changed
+87359
-181491
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { getVersion } from "@tauri-apps/api/app";
|
||||
import { isTauri } from "@tauri-apps/api/core";
|
||||
import { disable, enable, isEnabled } from "@tauri-apps/plugin-autostart";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
import { check, type Update } from "@tauri-apps/plugin-updater";
|
||||
|
||||
export function hasNativeAppLifecycle(): boolean {
|
||||
return isTauri();
|
||||
}
|
||||
|
||||
export async function currentAppVersion(): Promise<string> {
|
||||
return hasNativeAppLifecycle() ? getVersion() : "dev";
|
||||
}
|
||||
|
||||
export async function readAutostart(): Promise<boolean> {
|
||||
return isEnabled();
|
||||
}
|
||||
|
||||
export async function writeAutostart(enabled: boolean): Promise<void> {
|
||||
await (enabled ? enable() : disable());
|
||||
}
|
||||
|
||||
export async function checkForUpdate(): Promise<Update | null> {
|
||||
return check();
|
||||
}
|
||||
|
||||
export async function installUpdate(update: Update): Promise<void> {
|
||||
await update.downloadAndInstall();
|
||||
await relaunch();
|
||||
}
|
||||
Reference in new issue
Block a user