mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-04-21 21:29:37 +08:00
feat: 拉取文件时 日志输出 User-Agent; 脚本上下文参数 $options 中新增 _req 字段, 包含请求信息
This commit is contained in:
parent
e054b71a62
commit
7486517f08
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.19.17",
|
"version": "2.19.18",
|
||||||
"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": {
|
||||||
|
@ -111,7 +111,17 @@ async function downloadSubscription(req, res) {
|
|||||||
proxy,
|
proxy,
|
||||||
noCache,
|
noCache,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
let $options = {};
|
let $options = {
|
||||||
|
_req: {
|
||||||
|
method: req.method,
|
||||||
|
url: req.url,
|
||||||
|
path: req.path,
|
||||||
|
query: req.query,
|
||||||
|
params: req.params,
|
||||||
|
headers: req.headers,
|
||||||
|
body: req.body,
|
||||||
|
},
|
||||||
|
};
|
||||||
if (req.query.$options) {
|
if (req.query.$options) {
|
||||||
try {
|
try {
|
||||||
// 支持 `#${encodeURIComponent(JSON.stringify({arg1: "1"}))}`
|
// 支持 `#${encodeURIComponent(JSON.stringify({arg1: "1"}))}`
|
||||||
@ -376,7 +386,17 @@ async function downloadCollection(req, res) {
|
|||||||
noCache,
|
noCache,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
|
|
||||||
let $options = {};
|
let $options = {
|
||||||
|
_req: {
|
||||||
|
method: req.method,
|
||||||
|
url: req.url,
|
||||||
|
path: req.path,
|
||||||
|
query: req.query,
|
||||||
|
params: req.params,
|
||||||
|
headers: req.headers,
|
||||||
|
body: req.body,
|
||||||
|
},
|
||||||
|
};
|
||||||
if (req.query.$options) {
|
if (req.query.$options) {
|
||||||
try {
|
try {
|
||||||
// 支持 `#${encodeURIComponent(JSON.stringify({arg1: "1"}))}`
|
// 支持 `#${encodeURIComponent(JSON.stringify({arg1: "1"}))}`
|
||||||
|
@ -52,8 +52,8 @@ function createFile(req, res) {
|
|||||||
async function getFile(req, res) {
|
async function getFile(req, res) {
|
||||||
let { name } = req.params;
|
let { name } = req.params;
|
||||||
name = decodeURIComponent(name);
|
name = decodeURIComponent(name);
|
||||||
|
const reqUA = req.headers['user-agent'] || req.headers['User-Agent'];
|
||||||
$.info(`正在下载文件:${name}`);
|
$.info(`正在下载文件:${name}\n请求 User-Agent: ${reqUA}`);
|
||||||
let {
|
let {
|
||||||
url,
|
url,
|
||||||
subInfoUrl,
|
subInfoUrl,
|
||||||
@ -65,7 +65,17 @@ async function getFile(req, res) {
|
|||||||
proxy,
|
proxy,
|
||||||
noCache,
|
noCache,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
let $options = {};
|
let $options = {
|
||||||
|
_req: {
|
||||||
|
method: req.method,
|
||||||
|
url: req.url,
|
||||||
|
path: req.path,
|
||||||
|
query: req.query,
|
||||||
|
params: req.params,
|
||||||
|
headers: req.headers,
|
||||||
|
body: req.body,
|
||||||
|
},
|
||||||
|
};
|
||||||
if (req.query.$options) {
|
if (req.query.$options) {
|
||||||
try {
|
try {
|
||||||
// 支持 `#${encodeURIComponent(JSON.stringify({arg1: "1"}))}`
|
// 支持 `#${encodeURIComponent(JSON.stringify({arg1: "1"}))}`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user