Compare commits

..

2 Commits

Author SHA1 Message Date
xream
1faa3fb793 fix: 修复 VMess URI IPv6 格式
Some checks are pending
build / build (push) Waiting to run
2025-03-13 19:26:53 +08:00
xream
47307716b2 feat: url 支持 credentials; 修改导出文件名格式 2025-03-13 17:42:48 +08:00
7 changed files with 57 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.18.0",
"version": "2.18.2",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {

View File

@@ -23,7 +23,11 @@ export default function URI_Producer() {
) {
delete proxy.tls;
}
if (proxy.server && isIPv6(proxy.server)) {
if (
!['vmess'].includes(proxy.type) &&
proxy.server &&
isIPv6(proxy.server)
) {
proxy.server = `[${proxy.server}]`;
}
switch (proxy.type) {

View File

@@ -63,13 +63,17 @@ function getCollection(req, res) {
`sub-store_collection_${name}_${new Date()
.toLocaleString('zh-CN', {
year: 'numeric',
day: 'numeric',
month: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
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));

View File

@@ -213,13 +213,17 @@ function getWholeFile(req, res) {
`sub-store_file_${name}_${new Date()
.toLocaleString('zh-CN', {
year: 'numeric',
day: 'numeric',
month: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
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));

View File

@@ -31,13 +31,17 @@ export default function register($app) {
`sub-store_data_${new Date()
.toLocaleString('zh-CN', {
year: 'numeric',
day: 'numeric',
month: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
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(

View File

@@ -268,13 +268,17 @@ function getSubscription(req, res) {
`sub-store_subscription_${name}_${new Date()
.toLocaleString('zh-CN', {
year: 'numeric',
day: 'numeric',
month: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
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));

View File

@@ -373,6 +373,17 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
headersTimeout: opts.timeout,
};
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, {
...opts,
method: method.toUpperCase(),