Skip to content

Commit 0daa463

Browse files
committed
feat(thunder): add thunder support to protocol launcher
1 parent 6006c3e commit 0daa463

File tree

16 files changed

+143
-5
lines changed

16 files changed

+143
-5
lines changed

.changeset/big-lizards-make.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'protocol-launcher': minor
3+
---
4+
5+
feat(thunder): add thunder support to protocol launcher

apps/docs/.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export default defineConfig({
6363
items: [
6464
{ text: 'Cherry Studio', link: '/apps/cherry-studio' },
6565
{ text: 'Cursor', link: '/apps/cursor' },
66+
{ text: 'Thunder', link: '/apps/thunder' },
6667
],
6768
},
6869
],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const downloadUrlParams = {
2+
url: 'https://raw.githubusercontent.com/zhensherlock/zhensherlock/main/profile-3d-contrib/profile-night-view.svg',
3+
}

apps/docs/en/apps/thunder.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
layout: doc
3+
---
4+
5+
<script setup lang="ts">
6+
import { ref, computed } from 'vue';
7+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
8+
import { downloadUrl } from 'protocol-launcher/thunder';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { useAppStore } from '../../.vitepress/stores/app';
11+
import {
12+
downloadUrlParams,
13+
} from '../../.vitepress/constants/thunder';
14+
15+
const appStore = useAppStore();
16+
const currentMethod = ref('On-Demand');
17+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/thunder' : 'protocol-launcher');
18+
</script>
19+
20+
# Thunder
21+
22+
[Thunder](https://www.xunlei.com/) is a popular download manager. **Protocol Launcher** allows you to generate deep links to automatically open download resources in Thunder.
23+
24+
## Usage
25+
26+
There are two ways to use this library:
27+
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
28+
- Full Import from the root package is convenient but includes all app modules.
29+
30+
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
31+
32+
<SelectInstallationMethod v-model="currentMethod" />
33+
34+
### Download URL
35+
36+
```ts-vue [{{currentMethod}}]
37+
import { {{ currentMethod === 'On-Demand' ? 'downloadUrl' : 'thunder' }} } from '{{ importPath }}'
38+
39+
const url = {{currentMethod === 'On-Demand' ? '' : 'thunder.'}}downloadUrl({
40+
url: 'https://raw.githubusercontent.com/zhensherlock/zhensherlock/main/profile-3d-contrib/profile-night-view.svg',
41+
})
42+
```
43+
<div class="flex justify-center">
44+
<VPLink :href="downloadUrl(downloadUrlParams)" target="_self">
45+
Open in Thunder
46+
</VPLink>
47+
</div>

apps/docs/en/guide/getting-started.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ import { cherryStudio, cursor } from 'protocol-launcher'
5454

5555
For detailed usage instructions for each application, please refer to their respective guides:
5656

57-
- [Cherry Studio](/en/apps/cherry-studio)
58-
- [Cursor](/en/apps/cursor)
57+
- [Cherry Studio](../apps/cherry-studio.md)
58+
- [Cursor](../apps/cursor.md)
59+
- [Thunder](../apps/thunder.md)

apps/docs/en/guide/what-is-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ Currently, we support the following applications:
2323

2424
- [Cherry Studio](../apps/cherry-studio.md)
2525
- [Cursor](../apps/cursor.md)
26+
- [Thunder](../apps/thunder.md)
2627

2728
More applications will be added in the future.

apps/docs/zh/apps/thunder.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
layout: doc
3+
---
4+
5+
<script setup lang="ts">
6+
import { ref, computed } from 'vue';
7+
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
8+
import { downloadUrl } from 'protocol-launcher/thunder';
9+
import { SelectInstallationMethod } from '../../.vitepress/components';
10+
import { useAppStore } from '../../.vitepress/stores/app';
11+
import {
12+
downloadUrlParams,
13+
} from '../../.vitepress/constants/thunder';
14+
15+
const appStore = useAppStore();
16+
const currentMethod = ref('On-Demand');
17+
const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/thunder' : 'protocol-launcher');
18+
</script>
19+
20+
# Thunder
21+
22+
[Thunder](https://www.xunlei.com/) 是一款流行的下载管理器。**Protocol Launcher** 允许你生成深度链接,以自动在 Thunder 中打开下载资源。
23+
24+
## 使用
25+
26+
提供两种使用方式:
27+
- 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
28+
- 全量导入(从根包导入),使用简单,但会包含所有应用模块。
29+
30+
生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。
31+
32+
<SelectInstallationMethod v-model="currentMethod" />
33+
34+
### 下载文件
35+
36+
```ts-vue [{{currentMethod}}]
37+
import { {{ currentMethod === 'On-Demand' ? 'downloadUrl' : 'thunder' }} } from '{{ importPath }}'
38+
39+
const url = {{currentMethod === 'On-Demand' ? '' : 'thunder.'}}downloadUrl({
40+
url: 'https://raw.githubusercontent.com/zhensherlock/zhensherlock/main/profile-3d-contrib/profile-night-view.svg',
41+
})
42+
```
43+
<div class="flex justify-center">
44+
<VPLink :href="downloadUrl(downloadUrlParams)" target="_self">
45+
在 Thunder 中打开
46+
</VPLink>
47+
</div>

apps/docs/zh/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default defineAdditionalConfig({
3232
items: [
3333
{ text: 'Cherry Studio', link: '/zh/apps/cherry-studio' },
3434
{ text: 'Cursor', link: '/zh/apps/cursor' },
35+
{ text: 'Thunder', link: '/zh/apps/thunder' },
3536
],
3637
},
3738
],

apps/docs/zh/guide/getting-started.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ import { cherryStudio, cursor } from 'protocol-launcher'
5454

5555
有关每个应用程序的详细使用说明,请参阅各自的指南:
5656

57-
- [Cherry Studio](/zh/apps/cherry-studio)
58-
- [Cursor](/zh/apps/cursor)
57+
- [Cherry Studio](../apps/cherry-studio.md)
58+
- [Cursor](../apps/cursor.md)
59+
- [Thunder](../apps/thunder.md)

apps/docs/zh/guide/what-is-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ layout: doc
2323

2424
- [Cherry Studio](../apps/cherry-studio.md)
2525
- [Cursor](../apps/cursor.md)
26+
- [Thunder](../apps/thunder.md)
2627

2728
未来将添加更多应用程序。

0 commit comments

Comments
 (0)