mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-08 06:05:01 +03:00
feat(sub): make external subscription fetch User-Agent configurable (#6613)
* feat(sub): make external subscription fetch User-Agent configurable Some providers reject fetches that do not send a known client User-Agent. Expose externalSubUserAgent as a panel setting (default v2rayNG/1.8.5) and use it when fetching client external subscription URLs. Fixes #6383 * ci: retrigger frontend after npm registry maintenance The frontend job failed solely on `npm audit` while registry.npmjs.org returned 503 (Service Under Maintenance). Lint, typecheck, vitest, vite build, and storybook all passed. Local `npm audit --omit=dev --audit-level=high` now reports 0 vulnerabilities. * fix(sub): fall back to the default UA when the DB is not initialised externalSubUserAgent read the setting through SettingService.getSetting, which calls Model() on database.GetDB() and panics on a nil *gorm.DB. The fetch path's other DB read, service.ExternalSubscriptionHwid, already treats a nil DB as unreachable and sends no header; the new UA lookup did not, so any fetch before InitDB panicked instead of sending the historical v2rayNG/1.8.5. Production initialises the DB before the sub server starts, but the internal/sub fetch tests run without one: under make test-go's -shuffle=on, whenever one of them ran before the first InitDB test the panic aborted the whole package. Reproduced deterministically with go test -run '^TestDoFetchSubscriptionLinks_RejectsOversizedBody$'. --------- Co-authored-by: mrchatam <mrchatam@users.noreply.github.com> Co-authored-by: MHSanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
@@ -1273,6 +1273,8 @@
|
||||
"subDomainDesc": "訂閱服務監聽的域名(留空表示監聽所有域名和 IP)。當「反向代理 URI」為空時,也會作為顯示的訂閱連結的備援域名——如果面板和訂閱透過不同的域名存取(例如位於反向代理之後),請設定「反向代理 URI」。",
|
||||
"subUpdates": "更新間隔",
|
||||
"subUpdatesDesc": "客戶端應用中訂閱 URL 的更新間隔(單位:小時)",
|
||||
"externalSubUserAgent": "外部訂閱 User-Agent",
|
||||
"externalSubUserAgentDesc": "面板擷取用戶外部訂閱 URL 時傳送的 User-Agent。留空則使用預設值(v2rayNG/1.8.5)。部分服務商會拒絕未知用戶端。",
|
||||
"subEncrypt": "編碼",
|
||||
"subEncryptDesc": "訂閱服務返回的內容將採用 Base64 編碼",
|
||||
"subURI": "反向代理 URI",
|
||||
|
||||
Reference in New Issue
Block a user