-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
module.exports.parse = (raw, { yaml }) => { | ||
const rawObj = yaml.parse(raw) | ||
rawObj.proxy-groups | ||
return yaml.stringify({ ...rawObj, 'proxy-groups': groups, rules }) | ||
module.exports.parse = (raw, { axios, yaml, notify, console }) => { | ||
const obj = yaml.parse(raw) | ||
var proxy_groups = obj["proxy-groups"] | ||
const names = new Set(['我的代理', '节点选择', '自动选择', '故障转移', 'ChatGPT', 'TikTok']); | ||
proxy_groups.forEach((item, index, arr) => { | ||
if (!names.has(item.name)) { | ||
item.proxies.unshift('我的代理') | ||
} | ||
}) | ||
var rules = obj.rules | ||
rules.forEach((item, index, arr) => { | ||
if (item.startsWith('MATCH,')) { | ||
arr[index] = 'MATCH,我的代理' | ||
} | ||
}) | ||
return yaml.stringify(obj) | ||
} |