mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 11:28:59 +08:00
chore: YAML 解析兼容
This commit is contained in:
parent
a91f978042
commit
751e50bf99
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.195",
|
"version": "2.14.196",
|
||||||
"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": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import YAML from 'static-js-yaml';
|
import YAML from '@/utils/yaml';
|
||||||
import download from '@/utils/download';
|
import download from '@/utils/download';
|
||||||
import { isIPv4, isIPv6, isValidPortNumber } from '@/utils';
|
import { isIPv4, isIPv6, isValidPortNumber } from '@/utils';
|
||||||
import PROXY_PROCESSORS, { ApplyProcessor } from './processors';
|
import PROXY_PROCESSORS, { ApplyProcessor } from './processors';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { safeLoad } from 'static-js-yaml';
|
import { safeLoad } from '@/utils/yaml';
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
|
|
||||||
function HTML() {
|
function HTML() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import YAML from 'static-js-yaml';
|
import YAML from '@/utils/yaml';
|
||||||
|
|
||||||
function QXFilter() {
|
function QXFilter() {
|
||||||
const type = 'SINGLE';
|
const type = 'SINGLE';
|
||||||
|
29
backend/src/utils/yaml.js
Normal file
29
backend/src/utils/yaml.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import YAML from 'static-js-yaml';
|
||||||
|
|
||||||
|
function retry(fn, content, ...args) {
|
||||||
|
try {
|
||||||
|
return fn(content, ...args);
|
||||||
|
} catch (e) {
|
||||||
|
return fn(content.replace(/!<str>/g, ''), ...args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function safeLoad(content, ...args) {
|
||||||
|
return retry(YAML.safeLoad, content, ...args);
|
||||||
|
}
|
||||||
|
export function load(content, ...args) {
|
||||||
|
return retry(YAML.load, content, ...args);
|
||||||
|
}
|
||||||
|
export function safeDump(...args) {
|
||||||
|
return YAML.safeDump(...args);
|
||||||
|
}
|
||||||
|
export function dump(...args) {
|
||||||
|
return YAML.dump(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
safeLoad,
|
||||||
|
load,
|
||||||
|
safeDump,
|
||||||
|
dump,
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user