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",
|
||||
"version": "2.19.40",
|
||||
"version": "2.19.41",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -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 {
|
||||
|
@ -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 !== '')
|
||||
|
Loading…
x
Reference in New Issue
Block a user