Skip to content

Commit 589a6bf

Browse files
committed
feat: Base64 Pre-processor 检测解码是否正常
1 parent 7501250 commit 589a6bf

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.16.4",
3+
"version": "2.16.5",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
55
"main": "src/main.js",
66
"scripts": {

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { safeLoad } from '@/utils/yaml';
22
import { Base64 } from 'js-base64';
3+
import $ from '@/core/app';
34

45
function HTML() {
56
const name = 'HTML';
@@ -35,8 +36,15 @@ function Base64Encoded() {
3536
);
3637
};
3738
const parse = function (raw) {
38-
raw = Base64.decode(raw);
39-
return raw;
39+
const decoded = Base64.decode(raw);
40+
if (!/^\w+:\/\/\w+/m.test(decoded)) {
41+
$.error(
42+
`Base64 Pre-processor error: decoded line does not start with protocol`,
43+
);
44+
return raw;
45+
}
46+
47+
return decoded;
4048
};
4149
return { name, test, parse };
4250
}

0 commit comments

Comments
 (0)