feat: 兼容更多 VMess URI 格式

This commit is contained in:
xream 2023-10-09 17:35:40 +08:00
parent b061fca356
commit 40fb0fd7f3
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.14.64", "version": "2.14.66",
"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": {

View File

@ -240,7 +240,7 @@ function URI_VMess() {
params.add = server; params.add = server;
} }
const proxy = { const proxy = {
name: params.ps ?? params.remark, name: params.ps ?? params.remarks,
type: 'vmess', type: 'vmess',
server: params.add, server: params.add,
port: parseInt(getIfPresent(params.port), 10), port: parseInt(getIfPresent(params.port), 10),
@ -272,6 +272,14 @@ function URI_VMess() {
} }
if (proxy.network) { if (proxy.network) {
let transportHost = params.host ?? params.obfsParam; let transportHost = params.host ?? params.obfsParam;
try {
const parsedObfs = JSON.parse(transportHost);
const parsedHost = parsedObfs?.Host;
if (parsedHost) {
transportHost = parsedHost;
}
// eslint-disable-next-line no-empty
} catch (e) {}
let transportPath = params.path; let transportPath = params.path;
if (proxy.network === 'http') { if (proxy.network === 'http') {