Compare commits

...

4 Commits

Author SHA1 Message Date
xream
1d12dc55bd feat: 单条订阅和文件支持链接参数 produceType raw, 此时返回原始数据的数组 2025-05-17 20:22:24 +08:00
xream
af9a2c86c1 fix: 修复 Surge/Loon VMess aead
Some checks failed
build / build (push) Has been cancelled
2025-05-12 12:26:14 +08:00
xream
98892fa100 fix: 修复 QX VMess aead 2025-05-12 11:06:13 +08:00
xream
6e2411e2c2 doc: demo.js 2025-05-12 01:42:42 +08:00
9 changed files with 27 additions and 10 deletions

View File

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

View File

@@ -86,10 +86,10 @@ vmess = "vmess" equals address
(uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "none";
if (proxy.aead) {
proxy.alterId = 0;
if (proxy.aead === false) {
proxy.alterId = 1;
} else {
proxy.alterId = proxy.alterId || 0;
proxy.alterId = 0;
}
handleObfs();
}

View File

@@ -84,10 +84,10 @@ vmess = "vmess" equals address
(uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "none";
if (proxy.aead) {
proxy.alterId = 0;
if (proxy.aead === false) {
proxy.alterId = 1;
} else {
proxy.alterId = proxy.alterId || 0;
proxy.alterId = 0;
}
handleObfs();
}

View File

@@ -55,10 +55,11 @@ shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/
vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "none";
// Surfboard 与 Surge 默认不一致, 不管 Surfboard https://getsurfboard.com/docs/profile-format/proxy/external-proxy/vmess
if (proxy.aead) {
proxy.alterId = 0;
} else {
proxy.alterId = proxy.alterId || 0;
proxy.alterId = 1;
}
handleWebsocket();
handleShadowTLS();

View File

@@ -53,10 +53,11 @@ shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/
vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "none";
// Surfboard 与 Surge 默认不一致, 不管 Surfboard https://getsurfboard.com/docs/profile-format/proxy/external-proxy/vmess
if (proxy.aead) {
proxy.alterId = 0;
} else {
proxy.alterId = proxy.alterId || 0;
proxy.alterId = 1;
}
handleWebsocket();
handleShadowTLS();

View File

@@ -365,7 +365,7 @@ function vmess(proxy) {
// AEAD
if (isPresent(proxy, 'aead')) {
result.append(`,alterId=0`);
result.append(`,alterId=${proxy.aead ? 0 : 1}`);
} else {
result.append(`,alterId=${proxy.alterId}`);
}

View File

@@ -64,6 +64,7 @@ async function getFile(req, res) {
ignoreFailedRemoteFile,
proxy,
noCache,
produceType,
} = req.query;
let $options = {
_req: {
@@ -128,6 +129,10 @@ async function getFile(req, res) {
if (noCache) {
$.info(`指定不使用缓存: ${noCache}`);
}
if (produceType) {
produceType = decodeURIComponent(produceType);
$.info(`指定生产类型: ${produceType}`);
}
const allFiles = $.read(FILES_KEY);
const file = findByName(allFiles, name);
@@ -144,6 +149,7 @@ async function getFile(req, res) {
$options,
proxy,
noCache,
produceType,
});
try {

View File

@@ -173,6 +173,9 @@ async function produceArtifact({
raw.push(sub.content);
}
}
if (produceType === 'raw') {
return (Array.isArray(raw) ? raw : [raw]).flat();
}
// parse proxies
let proxies = (Array.isArray(raw) ? raw : [raw])
.map((i) => ProxyUtils.parse(i))
@@ -570,6 +573,9 @@ async function produceArtifact({
}
}
}
if (produceType === 'raw') {
return (Array.isArray(raw) ? raw : [raw]).flat();
}
const files = (Array.isArray(raw) ? raw : [raw]).flat();
let filesContent = files
.filter((i) => i != null && i !== '')

View File

@@ -120,7 +120,10 @@ function operator(proxies = [], targetPlatform, context) {
// downloadFile, // 下载二进制文件, 见 backend/src/utils/download.js
// MMDB, // Node.js 环境 可用于模拟 Surge/Loon 的 $utils.ipasn, $utils.ipaso, $utils.geoip. 具体见 https://t.me/zhetengsha/1269
// isValidUUID, // 辅助判断是否为有效的 UUID
// Buffer, // https://github.com/feross/buffer
// Base64, // https://github.com/dankogai/js-base64
// }
// 为兼容 https://github.com/xishang0128/sparkle 的 JavaScript 覆写, 也可以直接使用 `b64d`(Base64 解码), `b64e`(Base64 编码), `Buffer`, `yaml`(简单兼容了下 `yaml.parse` 和 `yaml.stringify`)
// 如果只是为了快速修改或者筛选 可以参考 脚本操作支持节点快捷脚本 https://t.me/zhetengsha/970 和 脚本筛选支持节点快捷脚本 https://t.me/zhetengsha/1009
// ⚠️ 注意: 函数式(即本文件这样的 function operator() {}) 和快捷操作(下面使用 $server) 只能二选一