mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
refactor: 移除 downloadMedia,复用 useContextDownload
- 删除 PoolManager.downloadMedia 方法 - 删除 queue.js 的 downloadMedia 导出 - routes.js 直接使用 getPoolContext().getFirstPage() + useContextDownload
This commit is contained in:
+1
-14
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user