mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-05 02:37:50 +00:00
feat: 转换 scMaxEachPostBytes 为 mihomo 兼容
This commit is contained in:
3 files changed
+169
-5
No files matched your search
@@ -873,12 +873,32 @@ function URI_VLESS() {
|
||||
if (isNotBlank(extra?.['xPaddingBytes'])) {
|
||||
xhttpOpts['x-padding-bytes'] = extra['xPaddingBytes'];
|
||||
}
|
||||
const scMaxEachPostBytes =
|
||||
extra?.['scMaxEachPostBytes'];
|
||||
if (
|
||||
typeof extra?.['scMaxEachPostBytes'] === 'number' &&
|
||||
Number.isFinite(extra['scMaxEachPostBytes'])
|
||||
typeof scMaxEachPostBytes === 'string' ||
|
||||
typeof scMaxEachPostBytes === 'number'
|
||||
) {
|
||||
xhttpOpts['sc-max-each-post-bytes'] =
|
||||
extra['scMaxEachPostBytes'];
|
||||
const normalizedValue = `${scMaxEachPostBytes}`;
|
||||
if (/^\s*[1-9]\d*\s*$/.test(normalizedValue)) {
|
||||
xhttpOpts['sc-max-each-post-bytes'] = parseInt(
|
||||
normalizedValue,
|
||||
10,
|
||||
);
|
||||
} else {
|
||||
const rangeMatch = normalizedValue.match(
|
||||
/^\s*([1-9]\d*)\s*-\s*([1-9]\d*)\s*$/,
|
||||
);
|
||||
if (rangeMatch) {
|
||||
const lowerBound = parseInt(rangeMatch[1], 10);
|
||||
const upperBound = parseInt(rangeMatch[2], 10);
|
||||
|
||||
if (upperBound >= lowerBound) {
|
||||
xhttpOpts['sc-max-each-post-bytes'] =
|
||||
upperBound;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isPlainObject(extra?.xmux)) {
|
||||
const reuseSettings = {};
|
||||
|
||||
Reference in new issue
Block a user