mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-01 14:13:15 +08:00
feat: Sub-Store 生成的订阅地址支持传入 订阅链接/User-Agent/节点内容 可以复用此订阅的其他设置
例如: 建一个 name 为 sub 的订阅, 配置好节点操作 以后可以自由传入参数 无需在 Sub-Store 前端创建新的配置 `/download/sub?target=Surge&content=encodeURIComponent编码过的本地节点` `/download/sub?target=Surge&url=encodeURIComponent编码过的订阅链接&ua=encodeURIComponent编码过的User-Agent`
This commit is contained in:
@@ -22,14 +22,18 @@ export default function register($app) {
|
||||
$app.get('/api/sync/artifact/:name', syncArtifact);
|
||||
}
|
||||
|
||||
async function produceArtifact({ type, name, platform }) {
|
||||
async function produceArtifact({ type, name, platform, url, ua, content }) {
|
||||
platform = platform || 'JSON';
|
||||
|
||||
if (type === 'subscription') {
|
||||
const allSubs = $.read(SUBS_KEY);
|
||||
const sub = findByName(allSubs, name);
|
||||
let raw;
|
||||
if (sub.source === 'local') {
|
||||
if (url) {
|
||||
raw = await download(url, ua);
|
||||
} else if (content) {
|
||||
raw = content;
|
||||
} else if (sub.source === 'local') {
|
||||
raw = sub.content;
|
||||
} else {
|
||||
raw = await download(sub.url, sub.ua);
|
||||
|
||||
Reference in New Issue
Block a user