Closed ghost closed 4 years ago
你的ipk是哪下载的?你可以尝试删除/etc/openclash/rule_providers.list里的换行符
你的ipk是哪下载的?你可以尝试删除/etc/openclash/rule_providers.list里的换行符
就github这里下载的啊。。 /etc/openclash/rule_providers.list没有看到这个windows换行符,用dos2unix处理过一遍也没解决,很奇怪。 我还有台r2s pi,刷的friendlywrt(op 19.07.1),装的是openclash 0.39.4版本,也有一样的问题。
你点这个自定义删除最后的字符试试
用自定义的方式手工写入规则集名称是可以的,但从列表选择就有上述的问题。
还是没找到原因,但有办法解决。
我不太会lua,但是我试着在rule-providers-settings.lua添加了一行代码,读rule_providers.list的时候强制性的把换行符替换掉(虽然我确实没看到rule_providers.list里有换行符),然后就可以了,大概在150行的位置:
if IsYamlFile(e[t].filename) or IsYmlFile(e[t].filename) then
e[t].name=luci.sys.exec(string.format("grep -F ',%s' /etc/openclash/rule_providers.list |awk -F ',' '{print $1}' 2>/dev/null",e[t].filename))
if e[t].name ~= "" and e[t].name ~= nil then
//加入下面这行,强制做一次换行符替换操作
e[t].name=string.gsub(e[t].name, "[\r\n]", "")
o:value(e[t].name)
end
end
end
end
可能game rule provider那里也要做一样的处理。 这个完全是我现搜现学写的,就不发PR现眼了,请作者帮忙完善下合并进去吧,谢谢!
另外,第三方规则集列表管理页(rule-providers-manage)里: Apple SoftwareUpdate 和Twitch 这两条规则好像删不掉,下载也是失败的。
主要是我不能复现,原因没找到
嗯,我再重刷几个干净的系统试试吧,确实没发现代码哪里会有换行符引入。
-- Sent from Canary (https://canarymail.io)
On 星期一, 8月 31, 2020 at 5:31 下午, vernesong <notifications@github.com (mailto:notifications@github.com)> wrote:
主要是我不能复现,原因没找到
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub (https://github.com/vernesong/OpenClash/issues/700#issuecomment-683672634), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAI56YSO5EFRYPKCEM3ETX3SDNUXXANCNFSM4QPC37EQ).
我可能找到问题的症结所在了,这个估计是openwrt版本的坑。 我分别用x86软路由,rockchip的r2s pi,qca8563的gl-inet ar750s三台机器测试。
r2s用官方的friendlywrt(基于op 19.07.1)时,有上述问题, 用https://github.com/klever1988/nanopi-openwrt 这里的现成固件(用的lean的lede,应该是基于op 18.06),没有上述问题。
x86软路由和ar750s,分别用lean的代码和op 19.07.3的代码纯净编译,不做任何特殊设置和打包任何配置或数据文件,只打包编译最新版的openclash。 用lean的代码编译的都没问题,用op19.07.3编译的都有这个换行符问题。整个编译和刷机过程就没用过windows电脑。
当然,你要说你的也是19.07的op但是没这问题。。。。我这就算白干了,反正目前来看是和op的版本高度相关。
就跟之前我说geoip 数据在op19.07下无法下载一样,也不知道具体哪里的问题,但问题确实就有,后面也不知道是openclash更新还是op本身更新后问题自己消失了。
强制替换换行符这个,你评估下看要不要加进去吧,应该也没什么太大影响,不行我就自己手改我本地代码先顶着,鬼知道会不会op哪天更新下就好了。
其实就是 https://github.com/vernesong/OpenClash/issues/693 的继续深挖。
现在可以确定就是/etc/config/openclash设置文件中,rule_provider_config部分出现了windows下的换行符,导致最终生成的clash config文件格式错误,继而导致clash启动失败。
正确的格式应该是这样的:
手工修改config文件是可以暂时解决问题,但没找到问题根源。
为了避免其他因素的影响,我找了台x86软路由重新刷过重新编译纯净openwrt 19.7.3系统,手动用ipk文件安装了openclash最近的v0.39.8版本。
然后在第三方规则集与策略组管理中,随便启用一个第三方规则集,点击保存后,查看/etc/config/openclash文件,就出现了上面的问题。
之前没用过这个功能,不知道是不是最近引入的还是一直都有。感觉调试日志也没什么帮助,但还是帖一下。