From efbc6ecd848cae54f1556792f4dbffc9b20e177a Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 25 Mar 2024 03:50:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=81=E9=87=8F=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=94=B1=20EB=20=E6=8F=90=E5=8D=87=E5=88=B0?= =?UTF-8?q?=20YB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/utils/flow.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index 28a2390..d2656be 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.264", + "version": "2.14.265", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/utils/flow.js b/backend/src/utils/flow.js index 9e2b7cf..a35fb1e 100644 --- a/backend/src/utils/flow.js +++ b/backend/src/utils/flow.js @@ -138,10 +138,10 @@ export function parseFlowHeaders(flowHeaders) { return { expires, total, usage: { upload, download } }; } export function flowTransfer(flow, unit = 'B') { - const unitList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']; + const unitList = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; let unitIndex = unitList.indexOf(unit); - return flow < 1024 + return flow < 1024 || unitIndex === unitList.length - 1 ? { value: flow.toFixed(1), unit: unit } : flowTransfer(flow / 1024, unitList[++unitIndex]); }