mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-03 13:10:36 +08:00
feat: 远程订阅支持换行符连接的多个订阅链接(前端版本 > 2.14.13
可输入)
This commit is contained in:
parent
5a645081d1
commit
3054d5cd5d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.103",
|
"version": "2.14.104",
|
||||||
"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": {
|
||||||
|
@ -20,7 +20,13 @@ async function compareSub(req, res) {
|
|||||||
content = sub.content;
|
content = sub.content;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
content = await download(sub.url, sub.ua);
|
content = await Promise.all(
|
||||||
|
sub.url
|
||||||
|
.split(/[\r\n]+/)
|
||||||
|
.map((i) => i.trim())
|
||||||
|
.filter((i) => i.length)
|
||||||
|
.map((url) => download(url, sub.ua)),
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
failed(
|
failed(
|
||||||
res,
|
res,
|
||||||
@ -34,7 +40,9 @@ async function compareSub(req, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// parse proxies
|
// parse proxies
|
||||||
const original = ProxyUtils.parse(content);
|
const original = (Array.isArray(content) ? content : [content])
|
||||||
|
.map((i) => ProxyUtils.parse(i))
|
||||||
|
.flat();
|
||||||
|
|
||||||
// add id
|
// add id
|
||||||
original.forEach((proxy, i) => {
|
original.forEach((proxy, i) => {
|
||||||
@ -80,10 +88,18 @@ async function compareCollection(req, res) {
|
|||||||
if (sub.source === 'local') {
|
if (sub.source === 'local') {
|
||||||
raw = sub.content;
|
raw = sub.content;
|
||||||
} else {
|
} else {
|
||||||
raw = await download(sub.url, sub.ua);
|
raw = await Promise.all(
|
||||||
|
sub.url
|
||||||
|
.split(/[\r\n]+/)
|
||||||
|
.map((i) => i.trim())
|
||||||
|
.filter((i) => i.length)
|
||||||
|
.map((url) => download(url, sub.ua)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// parse proxies
|
// parse proxies
|
||||||
let currentProxies = ProxyUtils.parse(raw);
|
let currentProxies = (Array.isArray(raw) ? raw : [raw])
|
||||||
|
.map((i) => ProxyUtils.parse(i))
|
||||||
|
.flat();
|
||||||
|
|
||||||
currentProxies.forEach((proxy) => {
|
currentProxies.forEach((proxy) => {
|
||||||
proxy.subName = sub.name;
|
proxy.subName = sub.name;
|
||||||
|
@ -30,16 +30,31 @@ async function produceArtifact({ type, name, platform, url, ua, content }) {
|
|||||||
const sub = findByName(allSubs, name);
|
const sub = findByName(allSubs, name);
|
||||||
let raw;
|
let raw;
|
||||||
if (url) {
|
if (url) {
|
||||||
raw = await download(url, ua);
|
raw = await Promise.all(
|
||||||
|
url
|
||||||
|
.split(/[\r\n]+/)
|
||||||
|
.map((i) => i.trim())
|
||||||
|
.filter((i) => i.length)
|
||||||
|
.map((url) => download(url, ua)),
|
||||||
|
);
|
||||||
} else if (content) {
|
} else if (content) {
|
||||||
raw = content;
|
raw = content;
|
||||||
} else if (sub.source === 'local') {
|
} else if (sub.source === 'local') {
|
||||||
raw = sub.content;
|
raw = sub.content;
|
||||||
} else {
|
} else {
|
||||||
raw = await download(sub.url, sub.ua);
|
raw = await Promise.all(
|
||||||
|
sub.url
|
||||||
|
.split(/[\r\n]+/)
|
||||||
|
.map((i) => i.trim())
|
||||||
|
.filter((i) => i.length)
|
||||||
|
.map((url) => download(url, sub.ua)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// parse proxies
|
// parse proxies
|
||||||
let proxies = ProxyUtils.parse(raw);
|
let proxies = (Array.isArray(raw) ? raw : [raw])
|
||||||
|
.map((i) => ProxyUtils.parse(i))
|
||||||
|
.flat();
|
||||||
|
|
||||||
proxies.forEach((proxy) => {
|
proxies.forEach((proxy) => {
|
||||||
proxy.subName = sub.name;
|
proxy.subName = sub.name;
|
||||||
});
|
});
|
||||||
@ -90,10 +105,18 @@ async function produceArtifact({ type, name, platform, url, ua, content }) {
|
|||||||
if (sub.source === 'local') {
|
if (sub.source === 'local') {
|
||||||
raw = sub.content;
|
raw = sub.content;
|
||||||
} else {
|
} else {
|
||||||
raw = await download(sub.url, sub.ua);
|
raw = await await Promise.all(
|
||||||
|
sub.url
|
||||||
|
.split(/[\r\n]+/)
|
||||||
|
.map((i) => i.trim())
|
||||||
|
.filter((i) => i.length)
|
||||||
|
.map((url) => download(url, sub.ua)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// parse proxies
|
// parse proxies
|
||||||
let currentProxies = ProxyUtils.parse(raw);
|
let currentProxies = (Array.isArray(raw) ? raw : [raw])
|
||||||
|
.map((i) => ProxyUtils.parse(i))
|
||||||
|
.flat();
|
||||||
|
|
||||||
currentProxies.forEach((proxy) => {
|
currentProxies.forEach((proxy) => {
|
||||||
proxy.subName = sub.name;
|
proxy.subName = sub.name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user