Skip to content

Commit dd5e07d

Browse files
committed
Merge branch 'dev'
2 parents d0141ee + 50ef8b8 commit dd5e07d

17 files changed

+177
-121
lines changed

luci-app-openclash/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=luci-app-openclash
4-
PKG_VERSION:=0.46.011
4+
PKG_VERSION:=0.46.014
55
PKG_RELEASE:=beta
66
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
77

@@ -100,7 +100,6 @@ endef
100100
define Package/$(PKG_NAME)/postinst
101101
#!/bin/sh
102102
sed -i "s/v0.00.00-beta/v$(PKG_VERSION)-beta/g" /www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1
103-
/etc/init.d/network restart >/dev/null 2>&1 &
104103
exit 0
105104
endef
106105

luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua

-11
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,6 @@ end
387387
o:value("DIRECT")
388388
o:value("REJECT")
389389

390-
o = s:option(ListValue, "AntiIP", translate("Anti IP"))
391-
o:depends("rule_name", "lhie1")
392-
o.rmempty = true
393-
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
394-
if groupname ~= nil and groupname ~= "" then
395-
o:value(groupname)
396-
end
397-
end
398-
o:value("DIRECT")
399-
o:value("REJECT")
400-
401390
o = s:option(ListValue, "Domestic", translate("Domestic"))
402391
o:depends("rule_name", "lhie1")
403392
o:depends("rule_name", "ConnersHua")

luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-config.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424

2525
m = Map(openclash, translate("Edit Rule Providers"))
2626
m.pageaction = false
27-
m.description=translate("规则集使用介绍:https://lancellc.gitbook.io/clash/clash-config-file/rule-provider")
27+
m.description=translate("规则集使用介绍:https://wiki.metacubex.one/config/rule-providers/content/")
2828
m.redirect = luci.dispatcher.build_url("admin/services/openclash/rule-providers-settings")
2929
if m.uci:get(openclash, sid) ~= "rule_providers" then
3030
luci.http.redirect(m.redirect)

luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-settings.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ m.description=translate("Attention:")..
2121
"<br/>"..
2222
"<br/>"..translate("When setting this page, if the groups is empty, please go to the <server and group management> page to add")..
2323
"<br/>"..
24-
"<br/>"..translate("Introduction to rule set usage: https://lancellc.gitbook.io/clash/clash-config-file/rule-provider")
24+
"<br/>"..translate("Introduction to rule set usage: https://wiki.metacubex.one/config/rule-providers/content/")
2525

2626
function IsRuleFile(e)
2727
e=e or""

luci-app-openclash/luasrc/model/cbi/openclash/servers.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ m.description=translate("Attention:")..
1515
"<br/>"..translate("1. Before modifying the configuration file, please click the button below to read the configuration file")..
1616
"<br/>"..translate("2. Proxy-providers address can be directly filled in the subscription link")..
1717
"<br/>"..
18-
"<br/>"..translate("Introduction to proxy usage: https://lancellc.gitbook.io/clash/clash-config-file/proxies")..
19-
"<br/>"..translate("Introduction to proxy-provider usage: https://lancellc.gitbook.io/clash/clash-config-file/proxy-provider")
18+
"<br/>"..translate("Introduction to proxy usage: https://wiki.metacubex.one/config/proxies/")..
19+
"<br/>"..translate("Introduction to proxy-provider usage: https://wiki.metacubex.one/config/proxy-providers/")
2020

2121
s = m:section(TypedSection, "openclash")
2222
s.anonymous = true

luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm

+69-4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,34 @@
5050

5151
<body>
5252
<div id="selectPopup" class="select-popup hidden">
53+
<table width="100%"><tr>
54+
<td width="25%" align="center"><%:Compiled Version Selected (Auto-save when you click to update or download)%></td>
55+
<td width="25%" align="center"><select id="CORE_VERSION_CDN">
56+
<option value="linux-386"><%:linux-386%></option>
57+
<option value="linux-amd64"><%:linux-amd64(x86-64)%></option>
58+
<option value="linux-amd64-v3"><%:linux-amd64-v3(x86-64)%></option>
59+
<option value="linux-armv5"><%:linux-armv5%></option>
60+
<option value="linux-armv6"><%:linux-armv6%></option>
61+
<option value="linux-armv7"><%:linux-armv7%></option>
62+
<option value="linux-arm64"><%:linux-arm64(armv8)%></option>
63+
<option value="linux-loong64-abi1"><%:linux-loong64-abi1%></option>
64+
<option value="linux-loong64-abi2"><%:linux-loong64-abi2%></option>
65+
<option value="linux-riscv64"><%:linux-riscv64%></option>
66+
<option value="linux-s390x"><%:linux-s390x%></option>
67+
<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>
68+
<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>
69+
<option value="linux-mips64"><%:linux-mips64%></option>
70+
<option value="linux-mips64le"><%:linux-mips64le%></option>
71+
<option value="linux-mipsle-softfloat"><%:linux-mipsle-softfloat%></option>
72+
<option value="linux-mipsle-hardfloat"><%:linux-mipsle-hardfloat%></option>
73+
<option value="0"><%:Not Set%></option>
74+
</select></td>
75+
<td width="25%" align="center"><%:Release Branch Selected (Auto-save when you click to update or download)%></td>
76+
<td width="25%" align="center"><select id="RELEASE_BRANCH_CDN">
77+
<option value="master">Master</option>
78+
<option value="dev">Developer</option>
79+
</select></td>
80+
</tr></table>
5381
<div class="select-popup-header"><%:Choose CDN For Downloading:%></div>
5482
<div class="select-popup-body">
5583
<div class="select-option" data-value="https://fastly.jsdelivr.net/">https://fastly.jsdelivr.net/</div>
@@ -66,6 +94,33 @@
6694

6795
<script type="text/javascript">
6896
//<![CDATA[
97+
98+
var core_version_cdn = document.getElementById('CORE_VERSION_CDN');
99+
var release_branch_cdn = document.getElementById('RELEASE_BRANCH_CDN');
100+
101+
function get_update_info() {
102+
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_info")%>', null, function(x, status) {
103+
if ( x && x.status == 200 ) {
104+
if ( status.corever != "0" && status.corever != "" ) {
105+
core_version_cdn.value = status.corever;
106+
}
107+
else {
108+
core_version_cdn.value = "0";
109+
}
110+
if ( status.release_branch != "" ) {
111+
release_branch_cdn.value = status.release_branch;
112+
}
113+
else {
114+
release_branch_cdn.value = "master";
115+
}
116+
}
117+
else {
118+
core_version_cdn.value = "0";
119+
release_branch_cdn.value = "master";
120+
}
121+
});
122+
};
123+
69124
function isValidURL(str) {
70125
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
71126
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
@@ -108,6 +163,7 @@
108163

109164
function select_git_cdn(btn, type) {
110165
var selectPopup = document.getElementById('selectPopup');
166+
get_update_info();
111167
selectPopup.classList.remove('hidden');
112168

113169
var customOptionInput = document.getElementById('customOptionInput');
@@ -141,6 +197,8 @@
141197
};
142198

143199
function select_window(event, type) {
200+
var v = core_version_cdn.value;
201+
var r = release_branch_cdn.value;
144202
var selectOptions = document.getElementsByClassName('select-option');
145203
var target = event.target;
146204
if (target.classList.contains('select-option') && target.dataset.value === 'custom') {
@@ -168,12 +226,19 @@
168226
customOptionInput.style.display = 'none';
169227
addCustomOption.style.display = 'none';
170228
if (type === 'core_download') {
171-
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', {url: target.dataset.value}, function(x, status) {
172-
});
229+
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r}, function(x, status) {
230+
if (x && x.status == 200) {
231+
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', {url: target.dataset.value}, function(x, status) {});
232+
}
233+
});
173234
}
174235
else {
175-
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', {url: target.dataset.value}, function(x, status) {
176-
});
236+
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r}, function(x, status) {
237+
if (x && x.status == 200) {
238+
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', {url: target.dataset.value}, function(x, status) {});
239+
}
240+
});
241+
177242
}
178243

179244
selectPopup.classList.add('hidden');

luci-app-openclash/luasrc/view/openclash/update.htm

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
if (x && x.status == 200) {
559559
btn.value = '<%:One Click Check Update With CDN%>';
560560
btn.disabled = true;
561-
var r = confirm("<%:Check and Update all Cores and OpenClash?%>")
561+
var r = confirm("<%:Check and Update all Cores and OpenClash?%>");
562562
if (r == true) {
563563
btn.disabled = false;
564564
return select_git_cdn("one_key_update");

luci-app-openclash/po/zh-cn/openclash.zh-cn.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ msgid "Has No Rules Field, Update Exit..."
17021702
msgstr "规则部分校验失败,请稍后再试..."
17031703

17041704
msgid "Has Incompatible Proxy-Group, Update Exit, Please Wait For OpenClash Update To Adapt..."
1705-
msgstr "含有未支持的新策略组,更新停止,请等待 OpenClash 版本更新适配..."
1705+
msgstr "含有未支持的策略组,更新停止,请等待 OpenClash 版本更新适配..."
17061706

17071707
msgid "Check The Downloaded Rule File For Updates..."
17081708
msgstr "检查下载的规则文件是否有更新..."

luci-app-openclash/root/etc/init.d/openclash

+19-13
Original file line numberDiff line numberDiff line change
@@ -3118,6 +3118,7 @@ revert_firewall()
31183118

31193119
get_config()
31203120
{
3121+
enable=$(uci -q get openclash.config.enable)
31213122
rule_source=$(uci -q get openclash.config.rule_source)
31223123
enable_custom_clash_rules=$(uci -q get openclash.config.enable_custom_clash_rules)
31233124
da_password=$(uci -q get openclash.config.dashboard_password)
@@ -3295,17 +3296,7 @@ stop()
32953296
fi
32963297

32973298
LOG_OUT "Step 5: Restart Dnsmasq..."
3298-
redirect_dns=$(uci -q get openclash.config.redirect_dns)
3299-
dnsmasq_server=$(uci -q get openclash.config.dnsmasq_server)
3300-
dnsmasq_noresolv=$(uci -q get openclash.config.dnsmasq_noresolv)
3301-
dnsmasq_resolvfile=$(uci -q get openclash.config.dnsmasq_resolvfile)
3302-
cachesize_dns=$(uci -q get openclash.config.cachesize_dns)
3303-
dnsmasq_cachesize=$(uci -q get openclash.config.dnsmasq_cachesize)
3304-
filter_aaaa_dns=$(uci -q get openclash.config.filter_aaaa_dns)
3305-
dnsmasq_filter_aaaa=$(uci -q get openclash.config.dnsmasq_filter_aaaa)
3306-
default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
3307-
revert_dns "$redirect_dns" "$enable" "$default_resolvfile" "$dnsmasq_noresolv" "$dnsmasq_resolvfile" "$cachesize_dns" "$dnsmasq_cachesize" "$filter_aaaa_dns" "$dnsmasq_filter_aaaa" "$dnsmasq_server"
3308-
/etc/init.d/dnsmasq restart >/dev/null 2>&1
3299+
revert_dnsmasq
33093300

33103301
LOG_OUT "Step 6: Delete OpenClash Residue File..."
33113302
if [ "$enable" != "1" ]; then
@@ -3334,6 +3325,21 @@ stop()
33343325
echo "OpenClash Already Stop!"
33353326
}
33363327

3328+
revert_dnsmasq()
3329+
{
3330+
get_config
3331+
redirect_dns=$(uci -q get openclash.config.redirect_dns)
3332+
dnsmasq_server=$(uci -q get openclash.config.dnsmasq_server)
3333+
dnsmasq_noresolv=$(uci -q get openclash.config.dnsmasq_noresolv)
3334+
dnsmasq_resolvfile=$(uci -q get openclash.config.dnsmasq_resolvfile)
3335+
cachesize_dns=$(uci -q get openclash.config.cachesize_dns)
3336+
dnsmasq_cachesize=$(uci -q get openclash.config.dnsmasq_cachesize)
3337+
filter_aaaa_dns=$(uci -q get openclash.config.filter_aaaa_dns)
3338+
dnsmasq_filter_aaaa=$(uci -q get openclash.config.dnsmasq_filter_aaaa)
3339+
default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
3340+
revert_dns "$redirect_dns" "$enable" "$default_resolvfile" "$dnsmasq_noresolv" "$dnsmasq_resolvfile" "$cachesize_dns" "$dnsmasq_cachesize" "$filter_aaaa_dns" "$dnsmasq_filter_aaaa" "$dnsmasq_server"
3341+
/etc/init.d/dnsmasq restart >/dev/null 2>&1
3342+
}
33373343

33383344
restart()
33393345
{
@@ -3368,7 +3374,7 @@ reload()
33683374
if pidof clash >/dev/null && [ "$enable" == "1" ] && [ "$1" == "revert" ]; then
33693375
set_lock
33703376
revert_firewall 2>/dev/null
3371-
/etc/init.d/dnsmasq restart >/dev/null 2>&1
3377+
revert_dnsmasq 2>/dev/null
33723378
SLOG_CLEAN
33733379
del_lock
33743380
fi
@@ -3377,7 +3383,7 @@ reload()
33773383
do_run_mode 2>/dev/null
33783384
get_config 2>/dev/null
33793385
set_firewall 2>/dev/null
3380-
/etc/init.d/dnsmasq restart >/dev/null 2>&1
3386+
change_dns "$enable_redirect_dns" "$disable_masq_cache"
33813387
SLOG_CLEAN
33823388
del_lock
33833389
fi

luci-app-openclash/root/usr/share/openclash/openclash_download_dashboard.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
UNPACK_FILE_DIR="/usr/share/openclash/ui/dashboard/"
1313
BACKUP_FILE_DIR="/usr/share/openclash/ui/dashboard_backup/"
1414
if [ "$DASH_TYPE" == "Official" ]; then
15-
DOWNLOAD_PATH="https://codeload.github.com/Dreamacro/clash-dashboard/zip/refs/heads/gh-pages"
15+
DOWNLOAD_PATH="https://codeload.github.com/ayanamist/clash-dashboard/zip/refs/heads/gh-pages"
1616
FILE_PATH_INCLUDE="clash-dashboard-gh-pages"
1717
else
1818
DOWNLOAD_PATH="https://codeload.github.com/MetaCubeX/Razord-meta/zip/refs/heads/gh-pages"

luci-app-openclash/root/usr/share/openclash/openclash_rule.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,15 @@
107107
Value_1 = YAML.load_file('/tmp/rules.yaml');
108108
OLD_GROUP = Value['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq;
109109
NEW_GROUP = Value_1['rules'].collect{|x| x.split(',')[2] or x.split(',')[1]}.uniq;
110-
puts (OLD_GROUP | NEW_GROUP).eql?(OLD_GROUP)
110+
if (OLD_GROUP | NEW_GROUP).eql?(OLD_GROUP) then
111+
if (OLD_GROUP | NEW_GROUP).eql?(NEW_GROUP) then
112+
puts true
113+
else
114+
puts false
115+
end
116+
else
117+
puts false
118+
end
111119
")" && [ -f "/usr/share/openclash/res/${rule_name}.yaml" ]; then
112120
LOG_OUT "Error: Updated Others Rules【$rule_name】Has Incompatible Proxy-Group, Update Exit, Please Wait For OpenClash Update To Adapt..."
113121
rm -rf /tmp/rules.yaml >/dev/null 2>&1

luci-app-openclash/root/usr/share/openclash/openclash_streaming_unlock.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,13 @@ end
646646
function get_auth_info()
647647
port = UCI:get("openclash", "config", "cn_port")
648648
passwd = UCI:get("openclash", "config", "dashboard_password") or ""
649-
ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
650-
649+
local lan_int_name = UCI:get("openclash", "config", "lan_interface_name") or "0"
650+
if lan_int_name == "0" then
651+
ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
652+
else
653+
ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
654+
end
655+
651656
if not ip or ip == "" then
652657
ip = SYS.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
653658
end

luci-app-openclash/root/usr/share/openclash/openclash_update.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ uci -q commit openclash
113113
opkg remove --force-depends --force-remove luci-app-openclash
114114
LOG_OUT "Installing The New Version, Please Do Not Refresh The Page or Do Other Operations..."
115115
opkg install /tmp/openclash.ipk
116-
if [ "$?" == "0" ]; then
116+
if [ "$?" != "0" ] || [ -z "$(opkg info *openclash |grep Installed-Time)" ]; then
117+
opkg install /tmp/openclash.ipk
118+
fi
119+
if [ "$?" == "0" ] && [ -n "$(opkg info *openclash |grep Installed-Time)" ]; then
117120
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
118121
LOG_OUT "OpenClash Update Successful, About To Restart!"
119122
uci -q set openclash.config.enable=1

0 commit comments

Comments
 (0)