feat: 增加 _subDisplayName _collectionDisplayName

This commit is contained in:
xream 2024-09-18 19:42:53 +08:00
parent 6e425e5908
commit 5d09fe782f
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
5 changed files with 14 additions and 7 deletions

View File

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

View File

@ -210,8 +210,6 @@ function produce(proxies, targetPlatform, type, opts = {}) {
);
proxies = proxies.map((proxy) => {
proxy._subName = proxy.subName;
proxy._collectionName = proxy.collectionName;
proxy._resolved = proxy.resolved;
if (!isNotBlank(proxy.name)) {
@ -268,7 +266,7 @@ function produce(proxies, targetPlatform, type, opts = {}) {
proxies.length > 0 &&
proxies.every((p) => p.type === 'wireguard')
) {
list = `#!name=${proxies[0]?.subName}
list = `#!name=${proxies[0]?._subName}
#!desc=${proxies[0]?._desc ?? ''}
#!category=${proxies[0]?._category ?? ''}
${list}`;

View File

@ -147,6 +147,7 @@ async function compareSub(req, res) {
original.forEach((proxy, i) => {
proxy.id = i;
proxy._subName = sub.name;
proxy._subDisplayName = sub.displayName;
});
// apply processors
@ -238,7 +239,9 @@ async function compareCollection(req, res) {
currentProxies.forEach((proxy) => {
proxy._subName = sub.name;
proxy._subDisplayName = sub.displayName;
proxy._collectionName = collection.name;
proxy._collectionDisplayName = collection.displayName;
});
// apply processors
@ -277,6 +280,7 @@ async function compareCollection(req, res) {
original.forEach((proxy, i) => {
proxy.id = i;
proxy._collectionName = collection.name;
proxy._collectionDisplayName = collection.displayName;
});
const processed = await ProxyUtils.process(

View File

@ -152,6 +152,7 @@ async function produceArtifact({
proxies.forEach((proxy) => {
proxy._subName = sub.name;
proxy._subDisplayName = sub.displayName;
});
// apply processors
proxies = await ProxyUtils.process(
@ -253,7 +254,9 @@ async function produceArtifact({
currentProxies.forEach((proxy) => {
proxy._subName = sub.name;
proxy._subDisplayName = sub.displayName;
proxy._collectionName = collection.name;
proxy._collectionDisplayName = collection.displayName;
});
// apply processors
@ -310,6 +313,7 @@ async function produceArtifact({
proxies.forEach((proxy) => {
proxy._collectionName = collection.name;
proxy._collectionDisplayName = collection.displayName;
});
// apply own processors
@ -340,6 +344,7 @@ async function produceArtifact({
}
exist[proxy.name] = true;
}
console.log(proxies);
return ProxyUtils.produce(proxies, platform, produceType, produceOpts);
} else if (type === 'rule') {
const allRules = $.read(RULES_KEY);

View File

@ -10,8 +10,8 @@ function operator(proxies = [], targetPlatform, context) {
// 2. 域名解析后 会多一个 `_resolved` 字段, 表示是否解析成功
// 3. 域名解析后会有`_IPv4`, `_IPv6`, `_IP`(若有多个步骤, 只取第一次成功的 v4 或 v6 数据), `_IP4P`(若解析类型为 IPv6 且符合 IP4P 类型, 将自动转换), `_domain` 字段, `_resolved_ips` 为解析出的所有 IP
// 4. 节点字段 `exec` 为 `ssr-local` 路径, 默认 `/usr/local/bin/ssr-local`; 端口从 10000 开始递增(暂不支持配置)
// 5. `_subName` 为单条订阅名
// 6. `_collectionName` 为组合订阅名
// 5. `_subName` 为单条订阅名, `_subDisplayName` 为单条订阅显示名
// 6. `_collectionName` 为组合订阅名, `_collectionDisplayName` 为组合订阅显示名
// 7. `tls-fingerprint` 为 tls 指纹
// 8. `underlying-proxy` 为前置代理
// 9. `trojan`, `tuic`, `hysteria`, `hysteria2`, `juicity` 会在解析时设置 `tls`: true (会使用 tls 类协议的通用逻辑), 输出时删除
@ -152,7 +152,7 @@ function operator(proxies = [], targetPlatform, context) {
// 1. https://t.me/zhetengsha/948
// context 为传入的上下文
// 其中 source 为 订阅和组合订阅的数据, 有三种情况, 按需判断 (若只需要取订阅/组合订阅名称 直接用 `_subName` 和 `_collectionName` 即可)
// 其中 source 为 订阅和组合订阅的数据, 有三种情况, 按需判断 (若只需要取订阅/组合订阅名称 直接用 `_subName` `_subDisplayName` `_collectionName` `_collectionDisplayName` 即可)
// 若存在 `source._collection` 且 `source._collection.subscriptions` 中的 key 在 `source` 上也存在, 说明输出结果为组合订阅, 但是脚本设置在单条订阅上