vernesong / OpenClash

A Clash Client For OpenWrt
MIT License
16.8k stars 3.1k forks source link

[Feature] Config Enable和dashboard_password可不可以优先保留原有配置呢? #3663

Closed ghost closed 9 months ago

ghost commented 9 months ago

Verify Steps

Describe the Feature

现在 luci-app-openclash/root/etc/uci-defaults/luci-openclash 文件中,默认就把openclash整体的enable关掉了,而且控制面板密码默认就生成一个随机值。

我自己编译固件的时候,想保留这两个参数都很麻烦,每次都要手工改这个文件注释掉这两段,编译完再改回来,否则编译出来的固件默认openclash就不启动,面板密码也是随机的。


uci -q set openclash.config.enable=0

uci -q set openclash.config.dashboard_password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"

Describe the Solution

能不能让这两个选项优先读取已有的配置信息呢? 如果用户使能了就使能,否则可以默认不使能; 用户设置了什么密码就用什么密码,如果没有设置密码再去生成随机密码。

谢谢!

Describe Alternatives

No response

Additional Context

No response

ghost commented 9 months ago

已提交PR https://github.com/vernesong/OpenClash/pull/3664 望V大审核采纳,谢谢

ghost commented 9 months ago

刚开始还纳闷为什么要提这个issue,这和你要求不矛盾啊。

if [ "$(uci -q get openclash.config.dashboard_password)" == "123456" ]; then
   uci -q set openclash.config.dashboard_password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
fi

看你pr才发现,V大怎么改成每次安装或更新都会重置密码了。


支持