Files
Thing/src/modules/downloader/index.ts
T
2026-08-11 17:19:36 +08:00

69 lines
2.0 KiB
TypeScript

import type { ModuleConfig } from '@/types/module'
import type { SearchIndexItem } from '@/stores/searchIndex'
const searchItems: SearchIndexItem[] = [
{
title: '下载任务',
description: '查看与管理下载任务',
keywords: ['下载', 'download', '任务', 'task'],
tab: 'tasks'
},
{
title: '添加下载',
description: '添加 HTTP/HTTPS 直链下载',
keywords: ['添加', '链接', 'url', 'add', '新建'],
tab: 'tasks'
},
{
title: '下载设置',
description: '配置下载目录、并发数与速度限制',
keywords: ['设置', 'setting', '速度', '目录', '并发'],
tab: 'settings'
},
{
title: '下载目录',
description: '设置任务默认保存目录',
keywords: ['目录', '保存', '路径', 'dir', 'folder', '下载位置'],
tab: 'settings'
},
{
title: '并发下载数',
description: '设置同时下载的任务数量上限',
keywords: ['并发', '数量', 'concurrent', '线程'],
tab: 'settings'
},
{
title: '速度限制',
description: '设置全局下载/上传限速',
keywords: ['限速', '速度', '速率', 'rate', 'limit', '带宽'],
tab: 'settings'
},
{
title: '浏览器扩展',
description: '安装 Thing Extension 接管浏览器下载',
keywords: ['扩展', 'extension', '浏览器', 'chrome', 'edge'],
tab: 'extension'
}
]
export const moduleConfig: ModuleConfig = {
id: 'downloader',
name: '下载器',
icon: 'downloader',
description: '多线程 HTTP 下载管理',
category: 'network',
defaultEnabled: true,
loader: () => import('./DownloaderModule.vue'),
searchItems,
// 下载引擎在进程内运行,无需外部进程管理
lifecycle: {
onEnable: async () => {
// 引擎在应用启动时已自动运行,模块启用时无需额外操作
},
onDisable: async () => {
// 模块禁用时不停止引擎(引擎在应用退出时统一清理)
}
},
order: 50
}