Modify scalar fields
修改端口.js
修改端口 diff.js
Modify according to conditions
条件修改.js
mode is rule:
Add object field
添加 DNS 字段.js
添加 DNS 字段 diff.yaml
Use deepMerge to add rules
添加规则.js
添加规则 diff.yaml
MATCH like YAML does. If the original list didn’t put MATCH at the end, the script won’t fix it for you.
Replace object or array
替换 DNS.js
替换 DNS diff.yaml
Filter proxy
过滤代理.js
过滤代理 diff.yaml
profile.proxies is not an array, the script uses an empty array and ends up with proxies: [].
Modify naming policy group
修改策略组.js
修改策略组 diff.yaml
PROXY is not found, the script will not create a new policy group and will not report an error.
Read remote YAML
远程 YAML.js
远程 YAML 结果 diff.yaml
Read remote JSON
远程 JSON.js
payload.port is not a number, the script retains the original mixed-port.
Request header and request body
POST 请求.js
Logs and Exceptions
记录并抛错.js
- The current override writes
[exception] 脚本执行失败. - Subsequent overwrites will not proceed.
- Normal configuration will return script errors and file paths.
- Encrypted configuration does not expose configuration content and paths in errors or logs.
Return error value
返回数组.js
缺少 main.js
Multiple JavaScript overrides
Files are executed in binding order, with subsequent scripts receiving the return value of the previous script:第一个脚本.js
第二个脚本.js
JavaScript 覆写链结果 diff.yaml
main, the function of the first script will not be reused, but will fail directly.