diff --git a/backend/package.json b/backend/package.json index 363c8f9..0d3aed2 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.257", + "version": "2.14.258", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/products/cron-sync-artifacts.js b/backend/src/products/cron-sync-artifacts.js index f4f8c0d..598dbce 100644 --- a/backend/src/products/cron-sync-artifacts.js +++ b/backend/src/products/cron-sync-artifacts.js @@ -128,10 +128,19 @@ async function doSync() { files.map((item) => [item.path, item]), ); } - const url = files[encodeURIComponent(artifact.name)]?.raw_url; - artifact.url = isGitLab - ? url - : url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1'); + const raw_url = + files[encodeURIComponent(artifact.name)]?.raw_url; + const new_url = isGitLab + ? raw_url + : raw_url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1'); + $.info( + `上传配置完成\n文件列表: ${Object.keys(files).join( + ', ', + )}\n当前文件: ${encodeURIComponent( + artifact.name, + )}\n响应返回的原始链接: ${raw_url}\n处理完的新链接: ${new_url}`, + ); + artifact.url = new_url; } } diff --git a/backend/src/restful/download.js b/backend/src/restful/download.js index a5a6b0e..a6897f3 100644 --- a/backend/src/restful/download.js +++ b/backend/src/restful/download.js @@ -79,8 +79,7 @@ async function downloadSubscription(req, res) { if ( sub.source !== 'local' || - ['localFirst', 'remoteFirst'].includes(sub.mergeSources) || - url + ['localFirst', 'remoteFirst'].includes(sub.mergeSources) ) { try { url = `${url || sub.url}` diff --git a/backend/src/restful/sync.js b/backend/src/restful/sync.js index e462c5e..18e68aa 100644 --- a/backend/src/restful/sync.js +++ b/backend/src/restful/sync.js @@ -563,10 +563,19 @@ async function syncArtifacts() { files.map((item) => [item.path, item]), ); } - const url = files[encodeURIComponent(artifact.name)]?.raw_url; - artifact.url = isGitLab - ? url - : url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1'); + const raw_url = + files[encodeURIComponent(artifact.name)]?.raw_url; + const new_url = isGitLab + ? raw_url + : raw_url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1'); + $.info( + `上传配置完成\n文件列表: ${Object.keys(files).join( + ', ', + )}\n当前文件: ${encodeURIComponent( + artifact.name, + )}\n响应返回的原始链接: ${raw_url}\n处理完的新链接: ${new_url}`, + ); + artifact.url = new_url; } } @@ -660,10 +669,18 @@ async function syncArtifact(req, res) { isGitLab = true; files = Object.fromEntries(files.map((item) => [item.path, item])); } - const url = files[encodeURIComponent(artifact.name)]?.raw_url; - artifact.url = isGitLab - ? url - : url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1'); + const raw_url = files[encodeURIComponent(artifact.name)]?.raw_url; + const new_url = isGitLab + ? raw_url + : raw_url?.replace(/\/raw\/[^/]*\/(.*)/, '/raw/$1'); + $.info( + `上传配置完成\n文件列表: ${Object.keys(files).join( + ', ', + )}\n当前文件: ${encodeURIComponent( + artifact.name, + )}\n响应返回的原始链接: ${raw_url}\n处理完的新链接: ${new_url}`, + ); + artifact.url = new_url; $.write(allArtifacts, ARTIFACTS_KEY); success(res, artifact); } catch (err) {