refactor: 移除 downloadMedia,复用 useContextDownload

- 删除 PoolManager.downloadMedia 方法
- 删除 queue.js 的 downloadMedia 导出
- routes.js 直接使用 getPoolContext().getFirstPage() + useContextDownload
This commit is contained in:
daidai
2026-03-28 09:44:48 +08:00
Unverified
parent 50b09ed740
commit 463881ceda
3 changed files with 8 additions and 42 deletions
+1 -14
View File
@@ -351,18 +351,6 @@ export function createQueueManager(queueConfig, callbacks) {
return await getCookies(workerName, domain);
}
/**
* 使用 Worker 的浏览器下载媒体
* @param {string} url - 媒体 URL
* @returns {Promise<{image?: string, imageUrl?: string, error?: string}>}
*/
async function downloadMedia(url) {
if (!poolContext || !poolContext.downloadMedia) {
throw new Error('Pool 未初始化或不支持 downloadMedia');
}
return await poolContext.downloadMedia(url);
}
return {
addTask,
getStatus,
@@ -370,7 +358,6 @@ export function createQueueManager(queueConfig, callbacks) {
canAcceptNonStreaming,
initializePool,
getPoolContext,
getWorkerCookies,
downloadMedia
getWorkerCookies
};
}