Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): add updater target resolution helper

Richie McIlroyfcb6a6edc9f6
diff --git a/apps/desktop/src/utils/updater.ts b/apps/desktop/src/utils/updater.ts
new file mode 100644
index 000000000..cf0f2a75a
--- /dev/null
+++ b/apps/desktop/src/utils/updater.ts
@@ -0,0 +1,21 @@
+import { arch, type as ostype } from "@tauri-apps/plugin-os";
+import type { CheckOptions } from "@tauri-apps/plugin-updater";
+
+function updaterArch() {
+ const currentArch = arch();
+ if (currentArch === "x86") return "i686";
+ return currentArch;
+}
+
+function updaterTarget() {
+ const currentArch = updaterArch();
+ const os = ostype();
+
+ if (os === "macos") return `darwin-${currentArch}`;
+ if (os === "linux") return `linux-${currentArch}-deb`;
+ return `${os}-${currentArch}`;
+}
+
+export function getUpdaterCheckOptions(): CheckOptions {
+ return { target: updaterTarget() };
+}