Skip to content

Commit 87250b7

Browse files
feat(utils): add download links utility functions
1 parent 4edf3aa commit 87250b7

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

apps/web/src/utils/download.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
export type DownloadPlatform = "macos" | "linux";
2+
export type DownloadArch = "aarch64" | "x86_64";
3+
export type DownloadFormat = "dmg" | "appimage" | "deb";
4+
5+
export interface DownloadLink {
6+
platform: DownloadPlatform;
7+
arch: DownloadArch;
8+
format: DownloadFormat;
9+
url: string;
10+
label: string;
11+
}
12+
13+
export function getDownloadLinks(version: string): DownloadLink[] {
14+
const baseUrl = `https://github.com/fastrepl/hyprnote/releases/download/desktop_v${version}`;
15+
16+
return [
17+
{
18+
platform: "macos",
19+
arch: "aarch64",
20+
format: "dmg",
21+
url: `${baseUrl}/hyprnote-macos-aarch64.dmg`,
22+
label: "Apple Silicon",
23+
},
24+
{
25+
platform: "macos",
26+
arch: "x86_64",
27+
format: "dmg",
28+
url: `${baseUrl}/hyprnote-macos-x86_64.dmg`,
29+
label: "Intel",
30+
},
31+
{
32+
platform: "linux",
33+
arch: "x86_64",
34+
format: "appimage",
35+
url: `${baseUrl}/hyprnote-linux-x86_64.AppImage`,
36+
label: "AppImage",
37+
},
38+
{
39+
platform: "linux",
40+
arch: "x86_64",
41+
format: "deb",
42+
url: `${baseUrl}/hyprnote-linux-x86_64.deb`,
43+
label: "Debian",
44+
},
45+
];
46+
}
47+
48+
export function groupDownloadLinks(links: DownloadLink[]) {
49+
return {
50+
macos: links.filter((link) => link.platform === "macos"),
51+
linux: links.filter((link) => link.platform === "linux"),
52+
};
53+
}

0 commit comments

Comments
 (0)