feat: sing-box Hysteria up/down 跟文档不一致, 但是懒得全转, 只处理最常见的 Mbps

This commit is contained in:
xream 2025-04-28 10:23:30 +08:00
parent 0d2920fadd
commit e0f6b3e692
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.19.34",
"version": "2.19.35",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {

View File

@ -567,12 +567,13 @@ const hysteriaParser = (proxy = {}) => {
if (proxy['fast-open']) parsedProxy.udp_fragment = true;
// eslint-disable-next-line no-control-regex
const reg = new RegExp('^[0-9]+[ \t]*[KMGT]*[Bb]ps$');
if (reg.test(`${proxy.up}`)) {
// sing-box 跟文档不一致, 但是懒得全转, 只处理最常见的 Mbps
if (reg.test(`${proxy.up}`) && !`${proxy.up}`.endsWith('Mbps')) {
parsedProxy.up = `${proxy.up}`;
} else {
parsedProxy.up_mbps = parseInt(`${proxy.up}`, 10);
}
if (reg.test(`${proxy.down}`)) {
if (reg.test(`${proxy.down}`) && !`${proxy.down}`.endsWith('Mbps')) {
parsedProxy.down = `${proxy.down}`;
} else {
parsedProxy.down_mbps = parseInt(`${proxy.down}`, 10);