mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-12 00:59:01 +08:00
refactor: Refactor the arguments of the Flag Operator
This commit is contained in:
parent
acd0a62496
commit
a420c126c2
6
backend/dist/cron-sync-artifacts.min.js
vendored
6
backend/dist/cron-sync-artifacts.min.js
vendored
File diff suppressed because one or more lines are too long
6
backend/dist/sub-store-parser.loon.min.js
vendored
6
backend/dist/sub-store-parser.loon.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.7.1",
|
"version": "2.7.2",
|
||||||
"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": {
|
||||||
|
@ -104,12 +104,12 @@ function QuickSettingOperator(args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add or remove flag for proxies
|
// add or remove flag for proxies
|
||||||
function FlagOperator(add = true) {
|
function FlagOperator({ mode }) {
|
||||||
return {
|
return {
|
||||||
name: 'Flag Operator',
|
name: 'Flag Operator',
|
||||||
func: (proxies) => {
|
func: (proxies) => {
|
||||||
return proxies.map((proxy) => {
|
return proxies.map((proxy) => {
|
||||||
if (!add) {
|
if (mode === 'remove') {
|
||||||
// no flag
|
// no flag
|
||||||
proxy.name = removeFlag(proxy.name);
|
proxy.name = removeFlag(proxy.name);
|
||||||
} else {
|
} else {
|
||||||
|
@ -57,7 +57,7 @@ function doMigrationV2() {
|
|||||||
|
|
||||||
// 5. delete builtin rules
|
// 5. delete builtin rules
|
||||||
delete $.cache.builtin;
|
delete $.cache.builtin;
|
||||||
$.info('Migration complete!');
|
$.info('Migration complete!');
|
||||||
|
|
||||||
function migrateDisplayName(item) {
|
function migrateDisplayName(item) {
|
||||||
const displayName = item['display-name'];
|
const displayName = item['display-name'];
|
||||||
@ -110,6 +110,13 @@ function doMigrationV2() {
|
|||||||
}
|
}
|
||||||
} else if (p.type.indexOf('Keyword') !== -1) {
|
} else if (p.type.indexOf('Keyword') !== -1) {
|
||||||
// drop keyword operators and keyword filters
|
// drop keyword operators and keyword filters
|
||||||
|
} else if (p.type === 'Flag Operator') {
|
||||||
|
// set default args
|
||||||
|
const add = typeof p.args === 'undefined' ? true : p.args;
|
||||||
|
p.args = {
|
||||||
|
mode: add ? 'add' : 'remove',
|
||||||
|
};
|
||||||
|
newProcesses.push(p);
|
||||||
} else {
|
} else {
|
||||||
newProcesses.push(p);
|
newProcesses.push(p);
|
||||||
}
|
}
|
||||||
|
6
backend/sub-store.min.js
vendored
6
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user