From 03e320cbd032f4ec45f3a29722a92bb6d6fb867a Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 13 Jan 2025 20:09:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=84=E5=90=88=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=8D=95=E6=9D=A1=E8=AE=A2=E9=98=85=E4=B9=9F?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=8F=E4=BC=A0=20User-Agent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/restful/download.js | 1 + backend/src/restful/sync.js | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 4a83f04..0a0bdfd 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.16.12", + "version": "2.16.13", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/download.js b/backend/src/restful/download.js index b4d0ebb..10ec82e 100644 --- a/backend/src/restful/download.js +++ b/backend/src/restful/download.js @@ -441,6 +441,7 @@ async function downloadCollection(req, res) { $options, proxy, noCache, + ua: reqUA, }); let subUserInfoOfSub; // forward flow header from the first subscription in this collection diff --git a/backend/src/restful/sync.js b/backend/src/restful/sync.js index b73e6a8..ba9d751 100644 --- a/backend/src/restful/sync.js +++ b/backend/src/restful/sync.js @@ -216,6 +216,12 @@ async function produceArtifact({ await Promise.all( subnames.map(async (name) => { const sub = findByName(allSubs, name); + const passThroughUA = sub.passThroughUA; + if (passThroughUA) { + $.info( + `订阅开启了透传 User-Agent, 使用请求的 User-Agent: ${ua}`, + ); + } try { $.info(`正在处理子订阅:${sub.name}...`); let raw; @@ -237,7 +243,7 @@ async function produceArtifact({ try { return await download( url, - sub.ua, + ua || sub.ua, undefined, proxy || sub.proxy ||