From 9a3cd4f57c978dbedb9d884d96b0d3e19eeea7d3 Mon Sep 17 00:00:00 2001 From: xream Date: Thu, 12 Dec 2024 15:35:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=84=E7=90=86=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/utils/download.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 42a268f..d2837d8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.438", + "version": "2.14.439", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/utils/download.js b/backend/src/utils/download.js index a06785f..68293b6 100644 --- a/backend/src/utils/download.js +++ b/backend/src/utils/download.js @@ -172,7 +172,7 @@ export default async function download( `Downloading...\nUser-Agent: ${userAgent}\nTimeout: ${requestTimeout}\nProxy: ${proxy}\nInsecure: ${!!insecure}\nURL: ${url}`, ); try { - const { body, headers } = await http.get({ + const { body, headers, statusCode } = await http.get({ url, ...(proxy ? { proxy } : {}), ...(isLoon && proxy ? { node: proxy } : {}), @@ -180,6 +180,10 @@ export default async function download( ...(proxy ? getPolicyDescriptor(proxy) : {}), ...(insecure ? insecure : {}), }); + $.info(`statusCode: ${statusCode}`); + if (statusCode < 200 || statusCode >= 400) { + throw new Error(`statusCode: ${statusCode}`); + } if (headers) { const flowInfo = getFlowField(headers);