diff --git a/.DS_Store b/.DS_Store
index e58a26d..a116766 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml
index 9b0e804..9d91c2c 100644
--- a/backend/.idea/workspace.xml
+++ b/backend/.idea/workspace.xml
@@ -20,10 +20,13 @@
-
+
+
+
+
@@ -89,7 +92,8 @@
-
+
+
@@ -109,7 +113,7 @@
-
+
@@ -117,10 +121,10 @@
-
+
-
+
@@ -128,10 +132,10 @@
-
+
-
+
@@ -139,10 +143,10 @@
-
+
-
+
@@ -150,10 +154,10 @@
-
+
-
+
@@ -161,10 +165,10 @@
-
+
-
+
@@ -172,10 +176,10 @@
-
+
-
+
@@ -183,10 +187,10 @@
-
+
-
+
@@ -194,10 +198,10 @@
-
+
-
+
@@ -205,10 +209,10 @@
-
+
-
+
@@ -216,10 +220,10 @@
-
+
-
+
@@ -227,10 +231,10 @@
-
+
-
+
@@ -238,10 +242,10 @@
-
+
-
+
@@ -249,10 +253,10 @@
-
+
-
+
@@ -260,10 +264,10 @@
-
+
-
+
@@ -271,10 +275,10 @@
-
+
-
+
@@ -282,7 +286,7 @@
-
+
diff --git a/backend/sub-store.js b/backend/sub-store.js
index 583d9eb..99168e3 100644
--- a/backend/sub-store.js
+++ b/backend/sub-store.js
@@ -74,11 +74,9 @@ const DEFAULT_SUPPORTED_PLATFORMS = {
const AVAILABLE_FILTERS = {
"Keyword Filter": KeywordFilter,
- "Discard Keyword Filter": DiscardKeywordFilter,
"Useless Filter": UselessFilter,
"Region Filter": RegionFilter,
"Regex Filter": RegexFilter,
- "Discard Regex Filter": DiscardRegexFilter,
"Type Filter": TypeFilter,
"Script Filter": ScriptFilter
}
@@ -182,7 +180,7 @@ async function parseSub(sub, platform) {
if (filter) {
$filter.addFilters(filter(item.args));
proxies = $filter.process(proxies);
- $.log(`Applying filter "${item.type}" with arguments:\n >>> ${item.args || "None"}`);
+ $.log(`Applying filter "${item.type}" with arguments:\n >>> ${JSON.stringify(item.args) || "None"}`);
}
} else if (item.type.indexOf("Operator") !== -1) {
const operator = AVAILABLE_OPERATORS[item.type];
@@ -1635,21 +1633,14 @@ function ScriptOperator(script) {
/**************************** Filters ***************************************/
// filter by keywords
-function KeywordFilter(keywords) {
+function KeywordFilter({keywords=[], keep = true}) {
return {
name: "Keyword Filter",
func: (proxies) => {
- return proxies.map(proxy => keywords.some(k => proxy.name.indexOf(k) !== -1));
- }
- }
-}
-
-function DiscardKeywordFilter(keywords) {
- return {
- name: "Discard Keyword Filter",
- func: proxies => {
- const filter = KeywordFilter(keywords).func;
- return NOT(filter(proxies));
+ return proxies.map(proxy => {
+ const selected = keywords.some(k => proxy.name.indexOf(k) !== -1);
+ return keep ? selected : !selected;
+ });
}
}
}
@@ -1686,21 +1677,17 @@ function RegionFilter(regions) {
}
// filter by regex
-function RegexFilter(regex) {
+function RegexFilter({regex=[], keep = true}) {
return {
name: "Regex Filter",
func: (proxies) => {
- return proxies.map(proxy => regex.some(r => r.test(proxy.name)));
- }
- }
-}
-
-function DiscardRegexFilter(regex) {
- return {
- name: "Discard Regex Filter",
- func: proxies => {
- const filter = RegexFilter(regex).func;
- return NOT(filter(proxies));
+ return proxies.map(proxy => {
+ const selected = regex.some(r => {
+ r = new RegExp(r);
+ return r.test(proxy.name)
+ });
+ return keep ? selected : !selected;
+ });
}
}
}
diff --git a/web/src/App.vue b/web/src/App.vue
index 699f1c0..27e0b05 100644
--- a/web/src/App.vue
+++ b/web/src/App.vue
@@ -49,7 +49,7 @@ export default {
},
created() {
- this.$vuetify.theme.dark = false;
+ this.$vuetify.theme.dark = true;
this.$vuetify.theme.themes.dark.primary = '#0899ab';
this.$vuetify.theme.themes.light.primary = '#d73964';
diff --git a/web/src/components/KeywordFilter.vue b/web/src/components/KeywordFilter.vue
index dd0716b..18febe3 100644
--- a/web/src/components/KeywordFilter.vue
+++ b/web/src/components/KeywordFilter.vue
@@ -4,7 +4,7 @@
filter_list
关键词过滤
-
+
mdi-delete
@@ -24,14 +24,14 @@
- 模式
+ 工作模式
-
+
-
+
@@ -61,8 +61,10 @@
diff --git a/web/src/components/RegexFilter.vue b/web/src/components/RegexFilter.vue
index f171315..5f5a0d6 100644
--- a/web/src/components/RegexFilter.vue
+++ b/web/src/components/RegexFilter.vue
@@ -4,7 +4,7 @@
code
正则过滤
-
+
mdi-delete
@@ -28,14 +28,14 @@
- 模式
+ 工作模式
-
+
-
+
@@ -65,13 +65,15 @@
diff --git a/web/src/components/RegionFilter.vue b/web/src/components/RegionFilter.vue
index fc73567..27c8715 100644
--- a/web/src/components/RegionFilter.vue
+++ b/web/src/components/RegionFilter.vue
@@ -18,7 +18,7 @@
区域过滤器
- 根据区域过滤节点,至少需要保留一个区域!
+ 根据区域过滤节点,至少需要保留一个区域!选中的区域会被保留。
diff --git a/web/src/components/TypeFilter.vue b/web/src/components/TypeFilter.vue
index 02e6069..7258576 100644
--- a/web/src/components/TypeFilter.vue
+++ b/web/src/components/TypeFilter.vue
@@ -18,7 +18,7 @@
节点类型过滤器
- 根据节点类型过滤节点,至少需要保留一种类型!
+ 根据节点类型过滤节点,至少需要保留一种类型!选中的类型会被保留。
diff --git a/web/src/config.js b/web/src/config.js
index e770cfa..77f362b 100644
--- a/web/src/config.js
+++ b/web/src/config.js
@@ -1,3 +1,3 @@
-const DEBUG = false;
+const DEBUG = true;
export const BACKEND_BASE = DEBUG ? `http://192.168.1.134:3000` : `https://sub.store`;
\ No newline at end of file
diff --git a/web/src/views/SubEditor.vue b/web/src/views/SubEditor.vue
index d28bd41..a15d73a 100644
--- a/web/src/views/SubEditor.vue
+++ b/web/src/views/SubEditor.vue
@@ -173,6 +173,8 @@
import {showError, showInfo} from "@/utils";
import TypeFilter from "@/components/TypeFilter";
import RegionFilter from "@/components/RegionFilter";
+import KeywordFilter from "@/components/KeywordFilter";
+import RegexFilter from "@/components/RegexFilter";
const AVAILABLE_PROCESSORS = {
"Type Filter": {
@@ -182,11 +184,19 @@ const AVAILABLE_PROCESSORS = {
"Region Filter": {
component: "RegionFilter",
name: "区域过滤器"
+ },
+ "Keyword Filter": {
+ component: "KeywordFilter",
+ name: "关键词过滤器"
+ },
+ "Regex Filter": {
+ component: "RegexFilter",
+ name: "正则过滤器"
}
}
export default {
- components: {RegionFilter, TypeFilter},
+ components: {KeywordFilter, RegexFilter, RegionFilter, TypeFilter},
data: function () {
return {
selectedProcess: null,