mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f35837ff9f | ||
|
|
c2c39c5de6 | ||
|
|
87a4b14ae2 | ||
|
|
ff1dacda87 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.16.63",
|
"version": "2.17.2",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ async function processFn(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
script = content;
|
script = content;
|
||||||
|
$arguments = item.args.arguments || {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -699,6 +699,52 @@ function URI_VLESS() {
|
|||||||
};
|
};
|
||||||
return { name, test, parse };
|
return { name, test, parse };
|
||||||
}
|
}
|
||||||
|
function URI_AnyTLS() {
|
||||||
|
const name = 'URI AnyTLS Parser';
|
||||||
|
const test = (line) => {
|
||||||
|
return /^anytls:\/\//.test(line);
|
||||||
|
};
|
||||||
|
const parse = (line) => {
|
||||||
|
line = line.split(/anytls:\/\//)[1];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
let [__, password, server, port, addons = '', name] =
|
||||||
|
/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(line);
|
||||||
|
password = decodeURIComponent(password);
|
||||||
|
port = parseInt(`${port}`, 10);
|
||||||
|
if (isNaN(port)) {
|
||||||
|
port = 443;
|
||||||
|
}
|
||||||
|
password = decodeURIComponent(password);
|
||||||
|
if (name != null) {
|
||||||
|
name = decodeURIComponent(name);
|
||||||
|
}
|
||||||
|
name = name ?? `AnyTLS ${server}:${port}`;
|
||||||
|
|
||||||
|
const proxy = {
|
||||||
|
type: 'anytls',
|
||||||
|
name,
|
||||||
|
server,
|
||||||
|
port,
|
||||||
|
password,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const addon of addons.split('&')) {
|
||||||
|
let [key, value] = addon.split('=');
|
||||||
|
key = key.replace(/_/g, '-');
|
||||||
|
value = decodeURIComponent(value);
|
||||||
|
if (['alpn'].includes(key)) {
|
||||||
|
proxy[key] = value ? value.split(',') : undefined;
|
||||||
|
} else if (['insecure'].includes(key)) {
|
||||||
|
proxy['skip-cert-verify'] = /(TRUE)|1/i.test(value);
|
||||||
|
} else {
|
||||||
|
proxy[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return proxy;
|
||||||
|
};
|
||||||
|
return { name, test, parse };
|
||||||
|
}
|
||||||
function URI_Hysteria2() {
|
function URI_Hysteria2() {
|
||||||
const name = 'URI Hysteria2 Parser';
|
const name = 'URI Hysteria2 Parser';
|
||||||
const test = (line) => {
|
const test = (line) => {
|
||||||
@@ -1544,6 +1590,7 @@ export default [
|
|||||||
URI_Hysteria(),
|
URI_Hysteria(),
|
||||||
URI_Hysteria2(),
|
URI_Hysteria2(),
|
||||||
URI_Trojan(),
|
URI_Trojan(),
|
||||||
|
URI_AnyTLS(),
|
||||||
Clash_All(),
|
Clash_All(),
|
||||||
Surge_Direct(),
|
Surge_Direct(),
|
||||||
Surge_SSH(),
|
Surge_SSH(),
|
||||||
|
|||||||
@@ -849,7 +849,12 @@ function UselessFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// filter by regions
|
// filter by regions
|
||||||
function RegionFilter(regions) {
|
function RegionFilter(input) {
|
||||||
|
let regions = input?.value || input;
|
||||||
|
if (!Array.isArray(regions)) {
|
||||||
|
regions = [];
|
||||||
|
}
|
||||||
|
const keep = input?.keep ?? true;
|
||||||
const REGION_MAP = {
|
const REGION_MAP = {
|
||||||
HK: '🇭🇰',
|
HK: '🇭🇰',
|
||||||
TW: '🇹🇼',
|
TW: '🇹🇼',
|
||||||
@@ -866,7 +871,8 @@ function RegionFilter(regions) {
|
|||||||
// this would be high memory usage
|
// this would be high memory usage
|
||||||
return proxies.map((proxy) => {
|
return proxies.map((proxy) => {
|
||||||
const flag = getFlag(proxy.name);
|
const flag = getFlag(proxy.name);
|
||||||
return regions.some((r) => REGION_MAP[r] === flag);
|
const selected = regions.some((r) => REGION_MAP[r] === flag);
|
||||||
|
return keep ? selected : !selected;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -898,11 +904,19 @@ function buildRegex(str, ...options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// filter by proxy types
|
// filter by proxy types
|
||||||
function TypeFilter(types) {
|
function TypeFilter(input) {
|
||||||
|
let types = input?.value || input;
|
||||||
|
if (!Array.isArray(types)) {
|
||||||
|
types = [];
|
||||||
|
}
|
||||||
|
const keep = input?.keep ?? true;
|
||||||
return {
|
return {
|
||||||
name: 'Type Filter',
|
name: 'Type Filter',
|
||||||
func: (proxies) => {
|
func: (proxies) => {
|
||||||
return proxies.map((proxy) => types.some((t) => proxy.type === t));
|
return proxies.map((proxy) => {
|
||||||
|
const selected = types.some((t) => proxy.type === t);
|
||||||
|
return keep ? selected : !selected;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,10 +123,10 @@ export default function Egern_Producer() {
|
|||||||
proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
||||||
next_hop: proxy.next_hop,
|
next_hop: proxy.next_hop,
|
||||||
};
|
};
|
||||||
if (proxy.plugin === 'obfs') {
|
if (original.plugin === 'obfs') {
|
||||||
proxy.obfs = proxy['plugin-opts'].mode;
|
proxy.obfs = original['plugin-opts'].mode;
|
||||||
proxy.obfs_host = proxy['plugin-opts'].host;
|
proxy.obfs_host = original['plugin-opts'].host;
|
||||||
proxy.obfs_uri = proxy['plugin-opts'].path;
|
proxy.obfs_uri = original['plugin-opts'].path;
|
||||||
}
|
}
|
||||||
} else if (proxy.type === 'hysteria2') {
|
} else if (proxy.type === 'hysteria2') {
|
||||||
proxy = {
|
proxy = {
|
||||||
@@ -144,9 +144,12 @@ export default function Egern_Producer() {
|
|||||||
port_hopping: proxy.ports,
|
port_hopping: proxy.ports,
|
||||||
port_hopping_interval: proxy['hop-interval'],
|
port_hopping_interval: proxy['hop-interval'],
|
||||||
};
|
};
|
||||||
if (proxy['obfs-password'] && proxy.obfs == 'salamander') {
|
if (
|
||||||
|
original['obfs-password'] &&
|
||||||
|
original.obfs == 'salamander'
|
||||||
|
) {
|
||||||
proxy.obfs = 'salamander';
|
proxy.obfs = 'salamander';
|
||||||
proxy.obfs_password = proxy['obfs-password'];
|
proxy.obfs_password = original['obfs-password'];
|
||||||
}
|
}
|
||||||
} else if (proxy.type === 'tuic') {
|
} else if (proxy.type === 'tuic') {
|
||||||
proxy = {
|
proxy = {
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ export default function URI_Producer() {
|
|||||||
'password',
|
'password',
|
||||||
'server',
|
'server',
|
||||||
'port',
|
'port',
|
||||||
|
'tls',
|
||||||
].includes(key)
|
].includes(key)
|
||||||
) {
|
) {
|
||||||
const i = key.replace(/-/, '_');
|
const i = key.replace(/-/, '_');
|
||||||
@@ -542,6 +543,50 @@ export default function URI_Producer() {
|
|||||||
)}`;
|
)}`;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'anytls':
|
||||||
|
let anytlsParams = [];
|
||||||
|
Object.keys(proxy).forEach((key) => {
|
||||||
|
if (
|
||||||
|
![
|
||||||
|
'name',
|
||||||
|
'type',
|
||||||
|
'password',
|
||||||
|
'server',
|
||||||
|
'port',
|
||||||
|
'tls',
|
||||||
|
].includes(key)
|
||||||
|
) {
|
||||||
|
const i = key.replace(/-/, '_');
|
||||||
|
if (['alpn'].includes(key)) {
|
||||||
|
if (proxy[key]) {
|
||||||
|
anytlsParams.push(
|
||||||
|
`${i}=${encodeURIComponent(
|
||||||
|
Array.isArray(proxy[key])
|
||||||
|
? proxy[key][0]
|
||||||
|
: proxy[key],
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (['skip-cert-verify'].includes(key)) {
|
||||||
|
if (proxy[key]) {
|
||||||
|
anytlsParams.push(`insecure=1`);
|
||||||
|
}
|
||||||
|
} else if (proxy[key]) {
|
||||||
|
anytlsParams.push(
|
||||||
|
`${i.replace(/-/g, '_')}=${encodeURIComponent(
|
||||||
|
proxy[key],
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
result = `anytls://${encodeURIComponent(proxy.password)}@${
|
||||||
|
proxy.server
|
||||||
|
}:${proxy.port}/?${anytlsParams.join('&')}#${encodeURIComponent(
|
||||||
|
proxy.name,
|
||||||
|
)}`;
|
||||||
|
break;
|
||||||
case 'wireguard':
|
case 'wireguard':
|
||||||
let wireguardParams = [];
|
let wireguardParams = [];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user