玩了好几个基于mihomo内核开发的代理工具,折腾了一个clash-verge-rev和mihomo-party的通用覆写脚本,并且支持合并多个机场订阅
直接将订阅链接填入url中就可以了,脚本也解决了dns泄露的问题。佬友们如果有其他规则想加,可以自己fork,也可以留言,我去添加一下。
github仓库地址:https://github.com/wanswu/my-backup
完整代码链接(可直连):Clash.js
我将 订阅合并 功能单独摘出来贴下面,包括JavaScript和yaml(任选其一)
实现订阅合并的JavaScript代码
// 多订阅合并,这里添加额外的地址
const proxyProviders = {
"p1": {
"type": "http",
// 订阅 链接
"url": "https://baidu.com",
// 自动更新时间 86400(秒) / 3600 = 24小时
"interval": 86400,
"override": {
// 节点名称前缀 p1,用于区别机场节点
"additional-prefix": "p1 |"
}
},
"p2": {
"type": "http",
"url": "https://google.com",
"interval": 86400,
"override": {
"additional-prefix": "p2 |"
}
},
}
function main(config) {
const proxyCount = config?.proxies?.length ?? 0;
const originalProviders = config?.["proxy-providers"] || {};
const proxyProviderCount = typeof originalProviders === "object" ? Object.keys(originalProviders).length : 0;
if (proxyCount === 0 && proxyProviderCount === 0) {
throw new Error("配置文件中未找到任何代理");
}
// 合并而非覆盖
config["proxy-providers"] = {
...originalProviders, // 保留原有配置
...proxyProviders // 合并新配置(同名则覆盖)
};
return config;
}
实现订阅合并yaml
proxy-providers:
subscribe1:
type: http
# 订阅 链接
url: https://baidu.com
# 自动更新时间 86400(秒) / 3600 = 24小时
interval: 86400
# 节点名称前缀 p1
override:
additional-prefix: "p1 |"
subscribe2:
type: http
url: https://baidu.com
interval: 86400
override:
additional-prefix: "P2 |"
Clash Verge Rev配置教程
Mihomo Party配置教程
在覆写中直接导入即可,Mihomo Party自带dns覆写需要关闭(在应用设置中关闭控制 DNS 设置)
佬友可以通过下面的链接去测试


