mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 15:29:17 +08:00
fix: 兼容部分不带参数的 URI 输入
This commit is contained in:
parent
95615d1877
commit
ee2fcc7ee3
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.141",
|
"version": "2.14.142",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -332,8 +332,8 @@ function URI_VLESS() {
|
|||||||
const parse = (line) => {
|
const parse = (line) => {
|
||||||
line = line.split('vless://')[1];
|
line = line.split('vless://')[1];
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
let [__, uuid, server, port, addons, name] =
|
let [__, uuid, server, port, ___, addons = '', name] =
|
||||||
/^(.*?)@(.*?):(\d+)\/?\?(.*?)(?:#(.*?))$/.exec(line);
|
/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))$/.exec(line);
|
||||||
port = parseInt(`${port}`, 10);
|
port = parseInt(`${port}`, 10);
|
||||||
uuid = decodeURIComponent(uuid);
|
uuid = decodeURIComponent(uuid);
|
||||||
name = decodeURIComponent(name) ?? `VLESS ${server}:${port}`;
|
name = decodeURIComponent(name) ?? `VLESS ${server}:${port}`;
|
||||||
@ -414,8 +414,8 @@ function URI_Hysteria2() {
|
|||||||
const parse = (line) => {
|
const parse = (line) => {
|
||||||
line = line.split(/(hysteria2|hy2):\/\//)[2];
|
line = line.split(/(hysteria2|hy2):\/\//)[2];
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
let [__, password, server, ___, port, addons, name] =
|
let [__, password, server, ___, port, ____, addons = '', name] =
|
||||||
/^(.*?)@(.*?)(:(\d+))?\/?\?(.*?)(?:#(.*?))$/.exec(line);
|
/^(.*?)@(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))$/.exec(line);
|
||||||
port = parseInt(`${port}`, 10);
|
port = parseInt(`${port}`, 10);
|
||||||
if (isNaN(port)) {
|
if (isNaN(port)) {
|
||||||
port = 443;
|
port = 443;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user