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: url 支持 credentials; 修改导出文件名格式
This commit is contained in:
parent
312caa6880
commit
47307716b2
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.18.0",
|
"version": "2.18.1",
|
||||||
"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": {
|
||||||
|
@ -63,13 +63,17 @@ function getCollection(req, res) {
|
|||||||
`sub-store_collection_${name}_${new Date()
|
`sub-store_collection_${name}_${new Date()
|
||||||
.toLocaleString('zh-CN', {
|
.toLocaleString('zh-CN', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
day: 'numeric',
|
month: '2-digit',
|
||||||
month: 'numeric',
|
day: '2-digit',
|
||||||
hour: 'numeric',
|
hour: '2-digit',
|
||||||
minute: 'numeric',
|
minute: '2-digit',
|
||||||
second: 'numeric',
|
second: '2-digit',
|
||||||
|
hour12: false,
|
||||||
})
|
})
|
||||||
.replace(/\D/g, '')}.json`,
|
.replace(
|
||||||
|
/^(\d+?)\/(\d+?)\/(\d+?)\s*?(\d+?):(\d+?):(\d+?)$/,
|
||||||
|
'$1-$2-$3_$4-$5-$6',
|
||||||
|
)}.json`,
|
||||||
)}"`,
|
)}"`,
|
||||||
)
|
)
|
||||||
.send(JSON.stringify(collection));
|
.send(JSON.stringify(collection));
|
||||||
|
@ -213,13 +213,17 @@ function getWholeFile(req, res) {
|
|||||||
`sub-store_file_${name}_${new Date()
|
`sub-store_file_${name}_${new Date()
|
||||||
.toLocaleString('zh-CN', {
|
.toLocaleString('zh-CN', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
day: 'numeric',
|
month: '2-digit',
|
||||||
month: 'numeric',
|
day: '2-digit',
|
||||||
hour: 'numeric',
|
hour: '2-digit',
|
||||||
minute: 'numeric',
|
minute: '2-digit',
|
||||||
second: 'numeric',
|
second: '2-digit',
|
||||||
|
hour12: false,
|
||||||
})
|
})
|
||||||
.replace(/\D/g, '')}.json`,
|
.replace(
|
||||||
|
/^(\d+?)\/(\d+?)\/(\d+?)\s*?(\d+?):(\d+?):(\d+?)$/,
|
||||||
|
'$1-$2-$3_$4-$5-$6',
|
||||||
|
)}.json`,
|
||||||
)}"`,
|
)}"`,
|
||||||
)
|
)
|
||||||
.send(JSON.stringify(file));
|
.send(JSON.stringify(file));
|
||||||
|
@ -31,13 +31,17 @@ export default function register($app) {
|
|||||||
`sub-store_data_${new Date()
|
`sub-store_data_${new Date()
|
||||||
.toLocaleString('zh-CN', {
|
.toLocaleString('zh-CN', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
day: 'numeric',
|
month: '2-digit',
|
||||||
month: 'numeric',
|
day: '2-digit',
|
||||||
hour: 'numeric',
|
hour: '2-digit',
|
||||||
minute: 'numeric',
|
minute: '2-digit',
|
||||||
second: 'numeric',
|
second: '2-digit',
|
||||||
|
hour12: false,
|
||||||
})
|
})
|
||||||
.replace(/\D/g, '')}.json`,
|
.replace(
|
||||||
|
/^(\d+?)\/(\d+?)\/(\d+?)\s*?(\d+?):(\d+?):(\d+?)$/,
|
||||||
|
'$1-$2-$3_$4-$5-$6',
|
||||||
|
)}.json`,
|
||||||
)}"`,
|
)}"`,
|
||||||
)
|
)
|
||||||
.send(
|
.send(
|
||||||
|
@ -268,13 +268,17 @@ function getSubscription(req, res) {
|
|||||||
`sub-store_subscription_${name}_${new Date()
|
`sub-store_subscription_${name}_${new Date()
|
||||||
.toLocaleString('zh-CN', {
|
.toLocaleString('zh-CN', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
day: 'numeric',
|
month: '2-digit',
|
||||||
month: 'numeric',
|
day: '2-digit',
|
||||||
hour: 'numeric',
|
hour: '2-digit',
|
||||||
minute: 'numeric',
|
minute: '2-digit',
|
||||||
second: 'numeric',
|
second: '2-digit',
|
||||||
|
hour12: false,
|
||||||
})
|
})
|
||||||
.replace(/\D/g, '')}.json`,
|
.replace(
|
||||||
|
/^(\d+?)\/(\d+?)\/(\d+?)\s*?(\d+?):(\d+?):(\d+?)$/,
|
||||||
|
'$1-$2-$3_$4-$5-$6',
|
||||||
|
)}.json`,
|
||||||
)}"`,
|
)}"`,
|
||||||
)
|
)
|
||||||
.send(JSON.stringify(sub));
|
.send(JSON.stringify(sub));
|
||||||
|
11
backend/src/vendor/open-api.js
vendored
11
backend/src/vendor/open-api.js
vendored
@ -373,6 +373,17 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
|
|||||||
headersTimeout: opts.timeout,
|
headersTimeout: opts.timeout,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
const url = new URL(opts.url);
|
||||||
|
if (url.username || url.password) {
|
||||||
|
opts.headers = {
|
||||||
|
...(opts.headers || {}),
|
||||||
|
Authorization: `Basic ${Buffer.from(
|
||||||
|
`${url.username || ''}:${
|
||||||
|
url.password || ''
|
||||||
|
}`,
|
||||||
|
).toString('base64')}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
const response = await request(opts.url, {
|
const response = await request(opts.url, {
|
||||||
...opts,
|
...opts,
|
||||||
method: method.toUpperCase(),
|
method: method.toUpperCase(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user