mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 16:18:59 +08:00
fix: QuickSettingOperator does not respect default settings
This commit is contained in:
parent
b2a797cd25
commit
7468089f04
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.5.3",
|
||||
"version": "2.5.4",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -8,31 +8,34 @@ function QuickSettingOperator(args) {
|
||||
return {
|
||||
name: 'Quick Setting Operator',
|
||||
func: (proxies) => {
|
||||
if (convert(args.useless)) {
|
||||
if (get(args.useless)) {
|
||||
const filter = UselessFilter();
|
||||
proxies = filter.func(proxies);
|
||||
}
|
||||
|
||||
return proxies.map((proxy) => {
|
||||
proxy.udp = convert(args.udp);
|
||||
proxy.tfo = convert(args.tfo);
|
||||
proxy['skip-cert-verify'] = convert(args.scert);
|
||||
proxy.udp = get(args.udp, proxy.udp);
|
||||
proxy.tfo = get(args.tfo, proxy.tfo);
|
||||
proxy['skip-cert-verify'] = get(
|
||||
args.scert,
|
||||
proxy['skip-cert-verify'],
|
||||
);
|
||||
if (proxy.type === 'vmess') {
|
||||
proxy.aead = convert(args['vmess aead']);
|
||||
proxy.aead = get(args['vmess aead'], proxy.aead);
|
||||
}
|
||||
return proxy;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
function convert(value) {
|
||||
function get(value, defaultValue) {
|
||||
switch (value) {
|
||||
case 'ENABLED':
|
||||
return true;
|
||||
case 'DISABLED':
|
||||
return false;
|
||||
default:
|
||||
return undefined;
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ import $ from '@/core/app';
|
||||
import { success } from '@/restful/response';
|
||||
|
||||
export default function register($app) {
|
||||
$app.post('/api/sort/sub', sortSubs);
|
||||
$app.post('/api/sort/collection', sortCollections);
|
||||
$app.post('/api/sort/subs', sortSubs);
|
||||
$app.post('/api/sort/collections', sortCollections);
|
||||
$app.post('/api/sort/artifacts', sortArtifacts);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user