Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gwq5210 committed Mar 6, 2024
1 parent 04c3fa8 commit 6c7d75b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
23 changes: 15 additions & 8 deletions v2ray/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ parsers:
- url: https://example.com/profile.yaml
code: |
module.exports.parse = (raw, { axios, yaml, notify, console }) => {
const obj = yaml.parse(raw)
var proxy_groups = obj["proxy-groups"]
proxy_groups.forEach((item, index, arr)=>{
if (item.name !== '我的代理') {
item.proxies.unshift('我的代理')
}
})
return yaml.stringify(obj)
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)
}
```
20 changes: 16 additions & 4 deletions v2ray/rule_change.js
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)
}

0 comments on commit 6c7d75b

Please sign in to comment.