Skip to content

Commit 1891cc6

Browse files
committed
fix typo
1 parent a646b47 commit 1891cc6

File tree

1 file changed

+40
-48
lines changed

1 file changed

+40
-48
lines changed

luci-app-openclash/root/etc/uci-defaults/luci-openclash

+40-48
Original file line numberDiff line numberDiff line change
@@ -45,56 +45,14 @@ cat > "/lib/upgrade/keep.d/luci-app-openclash" <<-EOF
4545
EOF
4646

4747
#Set Dashboard Secret
48-
if [ "$(uci -q get openclash.config.dashboard_password)" == "123456" ]; then
49-
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)"
50-
fi
48+
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)"
5149

5250
#Set authentication
53-
if [ -n "$(uci -q get openclash.@authentication[0].enabled)" ]; then
54-
auth_cfg=false
55-
else
56-
auth_cfg=true
57-
fi
58-
59-
if $auth_cfg; then
60-
uci_name_tmp=$(uci add openclash authentication)
61-
uci_set="uci -q set openclash.$uci_name_tmp."
62-
${uci_set}enabled="1"
63-
${uci_set}username="Clash"
64-
${uci_set}password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
65-
fi
66-
67-
#Restore
68-
if [ -f "/tmp/openclash.bak" ]; then
69-
mv -f "/tmp/openclash.bak" "/etc/config/openclash" >/dev/null 2>&1
70-
cp -rf "/tmp/openclash/." "/etc/openclash/" >/dev/null 2>&1
71-
cp -rf "/tmp/openclash_config/." "/etc/openclash/config/" >/dev/null 2>&1
72-
cp -rf "/tmp/openclash_core/." "/etc/openclash/core/" >/dev/null 2>&1
73-
cp -rf "/tmp/openclash_history/." "/etc/openclash/history/" >/dev/null 2>&1
74-
cp -rf "/tmp/openclash_proxy_provider/." "/etc/openclash/proxy_provider/" >/dev/null 2>&1
75-
cp -rf "/tmp/openclash_rule_provider/." "/etc/openclash/rule_provider/" >/dev/null 2>&1
76-
cp -rf "/tmp/openclash_game_rules/." "/etc/openclash/game_rules/" >/dev/null 2>&1
77-
mv -f "/tmp/openclash_custom_rules.list.bak" "/etc/openclash/custom/openclash_custom_rules.list" >/dev/null 2>&1
78-
mv -f "/tmp/openclash_custom_rules_2.list.bak" "/etc/openclash/custom/openclash_custom_rules_2.list" >/dev/null 2>&1
79-
mv -f "/tmp/openclash_custom_hosts.list.bak" "/etc/openclash/custom/openclash_custom_hosts.list" >/dev/null 2>&1
80-
mv -f "/tmp/openclash_custom_fake_filter.list.bak" "/etc/openclash/custom/openclash_custom_fake_filter.list" >/dev/null 2>&1
81-
mv -f "/tmp/openclash_custom_domain_dns.list.bak" "/etc/openclash/custom/openclash_custom_domain_dns.list" >/dev/null 2>&1
82-
if [ -d "/tmp/openclash_dashboard/" ]; then
83-
rm -rf "/usr/share/openclash/ui/dashboard/" >/dev/null 2>&1
84-
cp -rf "/tmp/openclash_dashboard/." "/usr/share/openclash/ui/dashboard/" >/dev/null 2>&1
85-
rm -rf "/tmp/openclash_dashboard/" >/dev/null 2>&1
86-
fi
87-
if [ -d "/tmp/openclash_yacd/" ]; then
88-
rm -rf "/usr/share/openclash/ui/yacd/" >/dev/null 2>&1
89-
cp -rf "/tmp/openclash_yacd/." "/usr/share/openclash/ui/yacd/" >/dev/null 2>&1
90-
rm -rf "/tmp/openclash_yacd/" >/dev/null 2>&1
91-
fi
92-
rm -rf "/etc/openclash/openclash" >/dev/null 2>&1
93-
rm -rf "/etc/openclash/fake_filter.list" >/dev/null 2>&1
94-
rm -rf "/etc/openclash/openclash_servers_fake_filter.conf" >/dev/null 2>&1
95-
rm -rf "/tmp/openclash" >/dev/null 2>&1
96-
rm -rf "/tmp/openclash.bak" >/dev/null 2>&1
97-
fi
51+
uci_name_tmp=$(uci add openclash authentication)
52+
uci_set="uci -q set openclash.$uci_name_tmp."
53+
${uci_set}enabled="1"
54+
${uci_set}username="Clash"
55+
${uci_set}password="$(tr -cd 'a-zA-Z0-9' </dev/urandom 2>/dev/null| head -c8 || date +%N| md5sum |head -c8)"
9856

9957
#Set Core Model
10058
source "/etc/openwrt_release"
@@ -137,6 +95,40 @@ if [ -n "$(uci -q get dhcp.@dnsmasq[0].resolvfile)" ]; then
13795
uci -q set openclash.config.default_resolvfile=$(uci -q get dhcp.@dnsmasq[0].resolvfile)
13896
fi
13997

98+
uci -q commit openclash
99+
100+
#Restore
101+
if [ -f "/tmp/openclash.bak" ]; then
102+
mv -f "/tmp/openclash.bak" "/etc/config/openclash" >/dev/null 2>&1
103+
cp -rf "/tmp/openclash/." "/etc/openclash/" >/dev/null 2>&1
104+
cp -rf "/tmp/openclash_config/." "/etc/openclash/config/" >/dev/null 2>&1
105+
cp -rf "/tmp/openclash_core/." "/etc/openclash/core/" >/dev/null 2>&1
106+
cp -rf "/tmp/openclash_history/." "/etc/openclash/history/" >/dev/null 2>&1
107+
cp -rf "/tmp/openclash_proxy_provider/." "/etc/openclash/proxy_provider/" >/dev/null 2>&1
108+
cp -rf "/tmp/openclash_rule_provider/." "/etc/openclash/rule_provider/" >/dev/null 2>&1
109+
cp -rf "/tmp/openclash_game_rules/." "/etc/openclash/game_rules/" >/dev/null 2>&1
110+
mv -f "/tmp/openclash_custom_rules.list.bak" "/etc/openclash/custom/openclash_custom_rules.list" >/dev/null 2>&1
111+
mv -f "/tmp/openclash_custom_rules_2.list.bak" "/etc/openclash/custom/openclash_custom_rules_2.list" >/dev/null 2>&1
112+
mv -f "/tmp/openclash_custom_hosts.list.bak" "/etc/openclash/custom/openclash_custom_hosts.list" >/dev/null 2>&1
113+
mv -f "/tmp/openclash_custom_fake_filter.list.bak" "/etc/openclash/custom/openclash_custom_fake_filter.list" >/dev/null 2>&1
114+
mv -f "/tmp/openclash_custom_domain_dns.list.bak" "/etc/openclash/custom/openclash_custom_domain_dns.list" >/dev/null 2>&1
115+
if [ -d "/tmp/openclash_dashboard/" ]; then
116+
rm -rf "/usr/share/openclash/ui/dashboard/" >/dev/null 2>&1
117+
cp -rf "/tmp/openclash_dashboard/." "/usr/share/openclash/ui/dashboard/" >/dev/null 2>&1
118+
rm -rf "/tmp/openclash_dashboard/" >/dev/null 2>&1
119+
fi
120+
if [ -d "/tmp/openclash_yacd/" ]; then
121+
rm -rf "/usr/share/openclash/ui/yacd/" >/dev/null 2>&1
122+
cp -rf "/tmp/openclash_yacd/." "/usr/share/openclash/ui/yacd/" >/dev/null 2>&1
123+
rm -rf "/tmp/openclash_yacd/" >/dev/null 2>&1
124+
fi
125+
rm -rf "/etc/openclash/openclash" >/dev/null 2>&1
126+
rm -rf "/etc/openclash/fake_filter.list" >/dev/null 2>&1
127+
rm -rf "/etc/openclash/openclash_servers_fake_filter.conf" >/dev/null 2>&1
128+
rm -rf "/tmp/openclash" >/dev/null 2>&1
129+
rm -rf "/tmp/openclash.bak" >/dev/null 2>&1
130+
fi
131+
140132
uci -q set openclash.config.enable=0
141133
uci -q commit openclash
142134

0 commit comments

Comments
 (0)