Skip to content

Commit 8dbcf8e

Browse files
committed
add macos-arm64
1 parent 17f52eb commit 8dbcf8e

File tree

1 file changed

+61
-41
lines changed

1 file changed

+61
-41
lines changed

docs/.vuepress/components/Desktop.vue

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,95 @@
11
<script setup lang="ts">
2-
import { NButtonGroup, NImage, NSpace, NButton, NDropdown } from 'naive-ui';
3-
import { computed, ref } from 'vue';
4-
import { api } from './api'
2+
import { NButtonGroup, NImage, NSpace, NButton, NDropdown } from "naive-ui";
3+
import { computed, ref } from "vue";
4+
import { api } from "./api";
55
6-
const platform = navigator.platform.toLowerCase()
7-
const plat = ref<"win" | 'linux' | 'mac'>('win')
8-
if (platform.includes('win')) {
9-
plat.value = 'win'
10-
} else if (platform.includes('linux')) {
11-
plat.value = 'linux'
12-
} else if (platform.includes('mac')) {
13-
plat.value = 'mac'
6+
const platform = navigator.platform.toLowerCase();
7+
const plat = ref<"win" | "linux" | "mac">("win");
8+
if (platform.includes("win")) {
9+
plat.value = "win";
10+
} else if (platform.includes("linux")) {
11+
plat.value = "linux";
12+
} else if (platform.includes("mac")) {
13+
plat.value = "mac";
1414
}
1515
16-
console.log(plat.value)
16+
console.log(plat.value);
1717
18-
const res = await fetch(`${api()}/proxy/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop-proxy.json`)
19-
const data = await res.json()
20-
const version = (data.name as string).slice(1)
21-
const urls = {
22-
'win': `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_x64_en-US.msi`,
23-
'linux': `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_amd64.deb`,
24-
'mac': `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_x64.dmg`
25-
}
18+
const res = await fetch(
19+
`${api()}/proxy/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop-proxy.json`
20+
);
21+
const data = await res.json();
22+
const version = (data.name as string).slice(1);
2623
2724
let text = {
28-
down: "Download"
29-
}
25+
down: "Download",
26+
};
3027
3128
const raw = [
32-
{ key: 'win', label: 'Windows' },
33-
{ key: 'linux', label: 'Linux' },
34-
{ key: 'mac', label: 'MacOS' }
35-
]
29+
{
30+
key: "win",
31+
label: "Windows",
32+
url: `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_x64_en-US.msi`,
33+
},
34+
{
35+
key: "mac_arm64",
36+
label: "MacOS (Apple Silicon)",
37+
url: `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_aarch64.dmg`,
38+
},
39+
{
40+
key: "mac_x64",
41+
label: "MacOS (Intel)",
42+
url: `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_x64.dmg`,
43+
},
44+
{
45+
key: "linux",
46+
label: "Linux",
47+
url: `https://ghproxy.com/https://github.com/alist-org/desktop-release/releases/latest/download/alist-desktop_${version}_amd64.deb`,
48+
},
49+
];
3650
3751
const fullPlat = computed(() => {
38-
return raw.find(item => item.key === plat.value)?.label
39-
})
52+
return raw.find((item) => item.key === plat.value)?.label;
53+
});
4054
4155
const options = computed(() => {
42-
return raw.map(item => {
56+
return raw.map((item) => {
4357
return {
4458
...item,
45-
label: `${item.label} ${plat.value === item.key ? '' : ''}`
46-
}
47-
})
48-
})
59+
label: `${item.label} ${plat.value === item.key ? "" : ""}`,
60+
};
61+
});
62+
});
4963
5064
if (location.pathname.startsWith("/zh/")) {
5165
text = {
52-
down: "下载"
53-
}
66+
down: "下载",
67+
};
5468
}
5569
5670
function down() {
57-
window.open(urls[plat.value], "_blank")
71+
window.open(raw.find((item) => item.key === plat.value)?.url, "_blank");
5872
}
5973
6074
function handleSelect(key) {
61-
plat.value = key
75+
plat.value = key;
6276
}
63-
6477
</script>
6578

6679
<template>
6780
<NSpace align="center" vertical size="large">
6881
<NButtonGroup class="down">
69-
<NDropdown trigger="hover" :options="options" @select="handleSelect" size="large">
82+
<NDropdown
83+
trigger="hover"
84+
:options="options"
85+
@select="handleSelect"
86+
size="large"
87+
>
7088
<NButton size="large" type="primary" tertiary>💻{{ fullPlat }}</NButton>
7189
</NDropdown>
72-
<NButton size="large" @click="down" type="info" secondary>{{ text.down }}</NButton>
90+
<NButton size="large" @click="down" type="info" secondary>{{
91+
text.down
92+
}}</NButton>
7393
</NButtonGroup>
7494
<NImage src="/img/guide/desktop.png"></NImage>
7595
</NSpace>
@@ -81,4 +101,4 @@ function handleSelect(key) {
81101
margin-top: 30px;
82102
margin-bottom: 30px;
83103
}
84-
</style>
104+
</style>

0 commit comments

Comments
 (0)