mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
feat: 单条订阅和文件支持链接参数 produceType raw, 此时返回原始数据的数组
This commit is contained in:
parent
af9a2c86c1
commit
1d12dc55bd
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.19.40",
|
"version": "2.19.41",
|
||||||
"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": {
|
||||||
|
@ -64,6 +64,7 @@ async function getFile(req, res) {
|
|||||||
ignoreFailedRemoteFile,
|
ignoreFailedRemoteFile,
|
||||||
proxy,
|
proxy,
|
||||||
noCache,
|
noCache,
|
||||||
|
produceType,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
let $options = {
|
let $options = {
|
||||||
_req: {
|
_req: {
|
||||||
@ -128,6 +129,10 @@ async function getFile(req, res) {
|
|||||||
if (noCache) {
|
if (noCache) {
|
||||||
$.info(`指定不使用缓存: ${noCache}`);
|
$.info(`指定不使用缓存: ${noCache}`);
|
||||||
}
|
}
|
||||||
|
if (produceType) {
|
||||||
|
produceType = decodeURIComponent(produceType);
|
||||||
|
$.info(`指定生产类型: ${produceType}`);
|
||||||
|
}
|
||||||
|
|
||||||
const allFiles = $.read(FILES_KEY);
|
const allFiles = $.read(FILES_KEY);
|
||||||
const file = findByName(allFiles, name);
|
const file = findByName(allFiles, name);
|
||||||
@ -144,6 +149,7 @@ async function getFile(req, res) {
|
|||||||
$options,
|
$options,
|
||||||
proxy,
|
proxy,
|
||||||
noCache,
|
noCache,
|
||||||
|
produceType,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -173,6 +173,9 @@ async function produceArtifact({
|
|||||||
raw.push(sub.content);
|
raw.push(sub.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (produceType === 'raw') {
|
||||||
|
return (Array.isArray(raw) ? raw : [raw]).flat();
|
||||||
|
}
|
||||||
// parse proxies
|
// parse proxies
|
||||||
let proxies = (Array.isArray(raw) ? raw : [raw])
|
let proxies = (Array.isArray(raw) ? raw : [raw])
|
||||||
.map((i) => ProxyUtils.parse(i))
|
.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();
|
const files = (Array.isArray(raw) ? raw : [raw]).flat();
|
||||||
let filesContent = files
|
let filesContent = files
|
||||||
.filter((i) => i != null && i !== '')
|
.filter((i) => i != null && i !== '')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user