Skip to content

Commit 62cb4d6

Browse files
committed
feat: 区域过滤和协议过滤支持保留模式和过滤模式(前端需 > 2.14.344)
1 parent 9426f12 commit 62cb4d6

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

backend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.16.63",
3+
"version": "2.16.64",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"scripts": {

backend/src/core/proxy-utils/processors/index.js

+18-4
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,12 @@ function UselessFilter() {
849849
}
850850

851851
// filter by regions
852-
function RegionFilter(regions) {
852+
function RegionFilter(input) {
853+
let regions = input?.value || input;
854+
if (!Array.isArray(regions)) {
855+
regions = [];
856+
}
857+
const keep = input?.keep ?? true;
853858
const REGION_MAP = {
854859
HK: '🇭🇰',
855860
TW: '🇹🇼',
@@ -866,7 +871,8 @@ function RegionFilter(regions) {
866871
// this would be high memory usage
867872
return proxies.map((proxy) => {
868873
const flag = getFlag(proxy.name);
869-
return regions.some((r) => REGION_MAP[r] === flag);
874+
const selected = regions.some((r) => REGION_MAP[r] === flag);
875+
return keep ? selected : !selected;
870876
});
871877
},
872878
};
@@ -898,11 +904,19 @@ function buildRegex(str, ...options) {
898904
}
899905

900906
// filter by proxy types
901-
function TypeFilter(types) {
907+
function TypeFilter(input) {
908+
let types = input?.value || input;
909+
if (!Array.isArray(types)) {
910+
types = [];
911+
}
912+
const keep = input?.keep ?? true;
902913
return {
903914
name: 'Type Filter',
904915
func: (proxies) => {
905-
return proxies.map((proxy) => types.some((t) => proxy.type === t));
916+
return proxies.map((proxy) => {
917+
const selected = types.some((t) => proxy.type === t);
918+
return keep ? selected : !selected;
919+
});
906920
},
907921
};
908922
}

0 commit comments

Comments
 (0)