mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 05:39:01 +08:00
feat: Base64 Pre-processor 检测解码是否正常
This commit is contained in:
parent
75012503f8
commit
589a6bfadb
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.16.4",
|
||||
"version": "2.16.5",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { safeLoad } from '@/utils/yaml';
|
||||
import { Base64 } from 'js-base64';
|
||||
import $ from '@/core/app';
|
||||
|
||||
function HTML() {
|
||||
const name = 'HTML';
|
||||
@ -35,8 +36,15 @@ function Base64Encoded() {
|
||||
);
|
||||
};
|
||||
const parse = function (raw) {
|
||||
raw = Base64.decode(raw);
|
||||
return raw;
|
||||
const decoded = Base64.decode(raw);
|
||||
if (!/^\w+:\/\/\w+/m.test(decoded)) {
|
||||
$.error(
|
||||
`Base64 Pre-processor error: decoded line does not start with protocol`,
|
||||
);
|
||||
return raw;
|
||||
}
|
||||
|
||||
return decoded;
|
||||
};
|
||||
return { name, test, parse };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user