mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
feat: /api/sub/flow/:name 接口支持指定远程订阅 url(可携带订阅 url 支持的参数, 例如 flowUserAgent)
This commit is contained in:
@@ -34,6 +34,11 @@ export default function register($app) {
|
||||
async function getFlowInfo(req, res) {
|
||||
let { name } = req.params;
|
||||
name = decodeURIComponent(name);
|
||||
let { url } = req.query;
|
||||
if (url) {
|
||||
url = decodeURIComponent(url);
|
||||
$.info(`指定远程订阅 URL: ${url}`);
|
||||
}
|
||||
const allSubs = $.read(SUBS_KEY);
|
||||
const sub = findByName(allSubs, name);
|
||||
if (!sub) {
|
||||
@@ -68,8 +73,8 @@ async function getFlowInfo(req, res) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
let url =
|
||||
`${sub.url}`
|
||||
url =
|
||||
`${url || sub.url}`
|
||||
.split(/[\r\n]+/)
|
||||
.map((i) => i.trim())
|
||||
.filter((i) => i.length)?.[0] || '';
|
||||
|
||||
Reference in New Issue
Block a user