luci-app-clash: sync with upstream source
This commit is contained in:
parent
af680c1778
commit
f14b57538d
@ -24,7 +24,6 @@ endef
|
||||
define Build/Prepare
|
||||
chmod 777 -R ${CURDIR}/tools/po2lmo
|
||||
${CURDIR}/tools/po2lmo/src/po2lmo ${CURDIR}/po/zh-cn/clash.po ${CURDIR}/po/zh-cn/clash.zh-cn.lmo
|
||||
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
@ -36,6 +35,8 @@ endef
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "$${IPKG_INSTROOT}" ] && exit 0
|
||||
|
||||
mkdir -p /usr/share/clashbackup 2>/dev/null
|
||||
|
||||
if [ -f "/tmp/dnsmasq.d/custom_list.conf" ]; then
|
||||
@ -90,6 +91,9 @@ endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
|
||||
[ -z "$${IPKG_INSTROOT}" ] && exit 0
|
||||
|
||||
rm -rf /tmp/luci*
|
||||
|
||||
if [ -f "/etc/config/clash.bak" ]; then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,6 @@ o.rmempty = false
|
||||
o.description = translate("Enable")
|
||||
|
||||
|
||||
|
||||
o = s:option(ListValue, "core", translate("Core"))
|
||||
o.default = "clashcore"
|
||||
if nixio.fs.access("/etc/clash/clash") then
|
||||
|
||||
@ -10,7 +10,6 @@ local clash = "clash"
|
||||
local http = luci.http
|
||||
|
||||
|
||||
|
||||
kr = Map(clash)
|
||||
s = kr:section(TypedSection, "clash", translate("Subscription Config"))
|
||||
s.anonymous = true
|
||||
|
||||
@ -58,7 +58,6 @@ o.description = translate("Bind Address")
|
||||
o:depends("allow_lan", "true")
|
||||
|
||||
|
||||
|
||||
o = s:option(Value, "dash_port")
|
||||
o.title = translate("Dashboard Port")
|
||||
o.default = 9191
|
||||
|
||||
@ -12,7 +12,7 @@ local dsp = require "luci.dispatcher"
|
||||
domain: pings[i].getAttribute("hint")
|
||||
},
|
||||
function(x, result) {
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color=green>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
pings[result.index].innerHTML = (result.ping ? '<b><font color="green">'+result.ping+'</font></b> ms' : '<b><font color="red"><%:Error%></font></b>');
|
||||
}
|
||||
);
|
||||
|
||||
@ -22,7 +22,7 @@ local dsp = require "luci.dispatcher"
|
||||
domain: pings[i].getAttribute("hint")
|
||||
},
|
||||
function(x, result) {
|
||||
pings[result.index].innerHTML = (result.ping ? "<b><font color=green>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
|
||||
pings[result.index].innerHTML = (result.ping ? '<b><font color="green">'+result.ping+'</font></b> ms' : '<b><font color="red"><%:Error%></font></b>');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td class="align-left" width="50%"><span><%:Global IP%> </span> : <span id="ip-ipify"><font color=red><%:Checking...%></font></span> <span id="ip-ipify-ipip"></span></td> <td width="15%"> <span><%:Google%></span> : <span id="_google"><em><%:Collecting data...%></em></span></td><td width="15%"><%:Youtube%> </span> : <span id="_youtube"><em><%:Collecting data...%></em></span></td><td ><%:Github%> </span> : <span id="_github"><em><%:Collecting data...%></em></span></td></tr>
|
||||
<tr><td class="align-left" width="50%"><span><%:Domestic IP%> </span> : <span id="d-ip"><font color=red><%:Checking...%></font></span></td><td width="15%"> <span><%:Baidu%></span> : <span id="_baidu"><em><%:Collecting data...%></em></span></td> <td width="15%"><%:Music.163%> </span> : <span id="_http-163"><em><%:Collecting data...%></em></span></td><td ><%:iQiyi%> </span> : <span id="_iqiyi"><em><%:Collecting data...%></em></span></td></tr>
|
||||
<tr><td class="align-left" width="50%"><span><%:Global IP%> </span> : <span id="ip-ipify"><font color="red"><%:Checking...%></font></span> <span id="ip-ipify-ipip"></span></td> <td width="15%"> <span><%:Google%></span> : <span id="_google"><em><%:Collecting data...%></em></span></td><td width="15%"><%:Youtube%> </span> : <span id="_youtube"><em><%:Collecting data...%></em></span></td><td ><%:Github%> </span> : <span id="_github"><em><%:Collecting data...%></em></span></td></tr>
|
||||
<tr><td class="align-left" width="50%"><span><%:Domestic IP%> </span> : <span id="d-ip"><font color="red"><%:Checking...%></font></span></td><td width="15%"> <span><%:Baidu%></span> : <span id="_baidu"><em><%:Collecting data...%></em></span></td> <td width="15%"><%:Music.163%> </span> : <span id="_http-163"><em><%:Collecting data...%></em></span></td><td ><%:iQiyi%> </span> : <span id="_iqiyi"><em><%:Collecting data...%></em></span></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
@ -108,15 +108,15 @@ var HTTP = {
|
||||
let timeout = setTimeout(() => {
|
||||
img.onerror = img.onload = null;
|
||||
img = null;
|
||||
document.getElementById(cbElID).innerHTML = '<b><font color=red><%:NO ACCESS%></font></b>'
|
||||
document.getElementById(cbElID).innerHTML = '<b><font color="red"><%:NO ACCESS%></font></b>'
|
||||
}, 1000);
|
||||
img.onerror = () => {
|
||||
clearTimeout(timeout);
|
||||
document.getElementById(cbElID).innerHTML = '<b><font color=red><%:TIMEOUT%></font></b>'
|
||||
document.getElementById(cbElID).innerHTML = '<b><font color="red"><%:TIMEOUT%></font></b>'
|
||||
}
|
||||
img.onload = () => {
|
||||
clearTimeout(timeout);
|
||||
document.getElementById(cbElID).innerHTML = '<b><font color=green><%:NORMAL%></font></b>'
|
||||
document.getElementById(cbElID).innerHTML = '<b><font color="green"><%:NORMAL%></font></b>'
|
||||
}
|
||||
img.src = `https://${domain}/favicon.ico?${+(new Date)}`
|
||||
}
|
||||
@ -152,12 +152,12 @@ var HTTP = {
|
||||
var logo = document.getElementById('_logo');
|
||||
XHR.poll(1, '<%=luci.dispatcher.build_url("admin", "services", "clash", "status")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
web.innerHTML = status.web ? '<a type="button" class="btn" style="background-color:black;padding: 5px;" href="http://'+window.location.hostname+':'+status.dash_port+'/ui" target="_blank"/><b><font color=green><%:OPEN DASHBOARD%></font></b></a>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
clash.innerHTML = status.clash ? '<b><font color=green><%:RUNNING%></font> </b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
ip.innerHTML = status.localip ? '<b><font color=green>'+status.localip+'</font> </b>' : '<em><b><font color=red><%:NOT SET%></font></b></em>';
|
||||
port.innerHTML = status.dash_port ? '<b><font color=green>'+status.dash_port+'</font> </b>' : '<em><b><font color=red><%:NOT SET%></font></b></em>';
|
||||
secret.innerHTML = status.dash_pass ? '<b><font color=green>'+status.dash_pass+'</font> </b>' : '<em><b><font color=red><%:NOT SET%></font></b></em>';
|
||||
emode.innerHTML = status.e_mode ? '<b><font color=green style="text-transform: uppercase;">'+status.e_mode+'</font> </b>' : '<b><font color=red><%:NOT SET%></font></b>';
|
||||
web.innerHTML = status.web ? '<a type="button" class="btn" style="background-color:black;padding: 5px;" href="http://'+window.location.hostname+':'+status.dash_port+'/ui" target="_blank"/><b><font color="green"><%:OPEN DASHBOARD%></font></b></a>' : '<b><font color="red"><%:NOT RUNNING%></font></b>';
|
||||
clash.innerHTML = status.clash ? '<b><font color="green"><%:RUNNING%></font> </b>' : '<b><font color="red"><%:NOT RUNNING%></font></b>';
|
||||
ip.innerHTML = status.localip ? '<b><font color="green">'+status.localip+'</font> </b>' : '<em><b><font color="red"><%:NOT SET%></font></b></em>';
|
||||
port.innerHTML = status.dash_port ? '<b><font color="green">'+status.dash_port+'</font> </b>' : '<em><b><font color="red"><%:NOT SET%></font></b></em>';
|
||||
secret.innerHTML = status.dash_pass ? '<b><font color="green">'+status.dash_pass+'</font> </b>' : '<em><b><font color="red"><%:NOT SET%></font></b></em>';
|
||||
emode.innerHTML = status.e_mode ? '<b><font color="green" style="text-transform: uppercase;">'+status.e_mode+'</font> </b>' : '<b><font color="red"><%:NOT SET%></font></b>';
|
||||
IP.getIpifyIP();
|
||||
IP.getIpipnetIP();
|
||||
|
||||
|
||||
@ -46,21 +46,21 @@
|
||||
if ( x && x.status == 200 ) {
|
||||
|
||||
if(status.clash_core==0){
|
||||
core.innerHTML = status.clash_core ? '<b><font color=red><%:Not Installed%></font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
core.innerHTML = status.clash_core ? '<b><font color="red"><%:Not Installed%></font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}else{
|
||||
core.innerHTML = status.clash_core ? '<b><font color=green>'+status.clash_core+'</font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
core.innerHTML = status.clash_core ? '<b><font color="green">'+status.clash_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}
|
||||
if(status.clashr_core==0){
|
||||
corer.innerHTML = status.clashr_core ? '<b><font color=red><%:Not Installed%></font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
corer.innerHTML = status.clashr_core ? '<b><font color="red"><%:Not Installed%></font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}else{
|
||||
corer.innerHTML = status.clashr_core ? '<b><font color=green>'+status.clashr_core+'</font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
corer.innerHTML = status.clashr_core ? '<b><font color="green">'+status.clashr_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}
|
||||
if(status.clashtun_core==0){
|
||||
coretun.innerHTML = status.clashtun_core ? '<b><font color=red><%:Not Installed%></font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
coretun.innerHTML = status.clashtun_core ? '<b><font color="red"><%:Not Installed%></font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}else{
|
||||
coretun.innerHTML = status.clashtun_core ? '<b><font color=green>'+status.clashtun_core+'</font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
coretun.innerHTML = status.clashtun_core ? '<b><font color="green">'+status.clashtun_core+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
}
|
||||
version.innerHTML = status.current_version ? '<b><font color=green>v'+status.current_version+'</font> </b>' : '<em><b><font color=red><%:Checking...%></font></b></em>';
|
||||
version.innerHTML = status.current_version ? '<b><font color="green">v'+status.current_version+'</font> </b>' : '<em><b><font color="red"><%:Checking...%></font></b></em>';
|
||||
|
||||
}
|
||||
});
|
||||
@ -90,7 +90,7 @@ function version_check(btn)
|
||||
|
||||
else if(status.new_version==0)
|
||||
{
|
||||
version_butt.innerHTML ='<center><input type="button" class="cbi-button cbi-button-reset" value="<%:Error Occured |Return%>" onclick="return check_return(this)"/></center>';
|
||||
version_butt.innerHTML ='<center><input type="button" class="cbi-button cbi-button-reset" value="<%:Error Occu"red" |Return%>" onclick="return check_return(this)"/></center>';
|
||||
|
||||
}
|
||||
else if(status.current_version >= status.new_version)
|
||||
@ -109,12 +109,12 @@ function core_check(btn)
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {
|
||||
if(status.new_core_version > status.clash_core)
|
||||
{
|
||||
core_butt.innerHTML ='<center><b><font color=green><%:New Version :%>'+status.new_core_version+'</font> </b></center>';
|
||||
core_butt.innerHTML ='<center><b><font color="green"><%:New Version :%>'+status.new_core_version+'</font> </b></center>';
|
||||
}
|
||||
|
||||
else if(status.new_core_version==0)
|
||||
{
|
||||
core_butt.innerHTML ='<center><input type="button" class="cbi-button cbi-button-reset" value="<%:Error Occured |Return%>" onclick="return core_return(this)"/></center>';
|
||||
core_butt.innerHTML ='<center><input type="button" class="cbi-button cbi-button-reset" value="<%:Error Occu"red" |Return%>" onclick="return core_return(this)"/></center>';
|
||||
|
||||
}
|
||||
else if(status.clash_core >= status.new_core_version)
|
||||
@ -132,12 +132,12 @@ function clashr_core_check(btn)
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {
|
||||
if(status.new_clashr_core_version > status.clashr_core)
|
||||
{
|
||||
corer_butt.innerHTML ='<center><b><font color=green><%:New Version :%>'+status.new_clashr_core_version+'</font> </b></center>';
|
||||
corer_butt.innerHTML ='<center><b><font color="green"><%:New Version :%>'+status.new_clashr_core_version+'</font> </b></center>';
|
||||
}
|
||||
|
||||
else if(status.new_clashr_core_version==0)
|
||||
{
|
||||
corer_butt.innerHTML ='<center><input type="button" class="cbi-button cbi-button-reset" value="<%:Error Occured |Return%>" onclick="return clashr_core_return(this)"/></center>';
|
||||
corer_butt.innerHTML ='<center><input type="button" class="cbi-button cbi-button-reset" value="<%:Error Occu"red" |Return%>" onclick="return clashr_core_return(this)"/></center>';
|
||||
|
||||
}
|
||||
else if(status.clashr_core >= status.new_clashr_core_version)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
experimental:
|
||||
ignore-resolve-fail: true
|
||||
#authentication:
|
||||
@ -10,9 +11,9 @@ dns:
|
||||
listen: 0.0.0.0:5300
|
||||
enhanced-mode: fake-ip
|
||||
fake-ip-range: 198.18.0.1/16
|
||||
# fake-ip-filter: # fake ip white domain
|
||||
# - *.lan
|
||||
# - localhost.ptlogin2.qq.com
|
||||
#fake-ip-filter:
|
||||
# - '*.lan'
|
||||
# - localhost.ptlogin2.qq.com
|
||||
nameserver:
|
||||
- 114.114.114.114
|
||||
- tls://118.89.110.78:853
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
experimental:
|
||||
ignore-resolve-fail: true
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
experimental:
|
||||
ignore-resolve-fail: true
|
||||
|
||||
|
||||
@ -7,6 +7,9 @@ lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
config_type=$(uci get clash.config.config_type 2>/dev/null)
|
||||
tun_mode=$(uci get clash.config.tun_mode 2>/dev/null)
|
||||
core=$(uci get clash.config.core 2>/dev/null)
|
||||
subscribe_url=$(uci get clash.config.subscribe_url_clash 2>/dev/null)
|
||||
subscribe_urll=$(uci get $name.config.subscribe_url 2>/dev/null)
|
||||
|
||||
REAL_LOG="/usr/share/clash/clash_real.txt"
|
||||
|
||||
if [ $config_type == "sub" ];then
|
||||
@ -72,7 +75,10 @@ if [ "${mode}" -eq 1 ]; then
|
||||
mv /etc/clash/config.yaml /etc/clash/dns.yaml
|
||||
cat /usr/share/clash/dns.yaml /etc/clash/dns.yaml > $CONFIG_YAML 2>/dev/null
|
||||
rm -rf /etc/clash/dns.yaml
|
||||
sed -i "1i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
if [ ! -z ${subscribe_url} ] || [ ! -z ${subscribe_url} ];then
|
||||
sed -i "1i\# ${subscribe_url} ${subscribe_urll}" $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
sed -i "2i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/port: ${http_port}/a\socks-port: ${socks_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/socks-port: ${socks_port}/a\redir-port: ${redir_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
|
||||
@ -123,7 +129,10 @@ elif [ "${core}" -eq 3 ] && [ ! -z "${tun_mode}" ]; then
|
||||
cat /usr/share/clash/tundns_3.yaml /etc/clash/dns.yaml > $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
rm -rf /etc/clash/dns.yaml
|
||||
sed -i "1i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
if [ ! -z ${subscribe_url} ] || [ ! -z ${subscribe_url} ];then
|
||||
sed -i "1i\# ${subscribe_url} ${subscribe_urll}" $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
sed -i "2i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/port: ${http_port}/a\socks-port: ${socks_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/socks-port: ${socks_port}/a\redir-port: ${redir_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
|
||||
@ -174,8 +183,10 @@ else
|
||||
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML 2>/dev/null
|
||||
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
|
||||
sed -i "1i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
if [ ! -z ${subscribe_url} ] || [ ! -z ${subscribe_url} ];then
|
||||
sed -i "1i\# ${subscribe_url} ${subscribe_urll}" $CONFIG_YAML 2>/dev/null
|
||||
fi
|
||||
sed -i "2i\port: ${http_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/port: ${http_port}/a\socks-port: ${socks_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/socks-port: ${socks_port}/a\redir-port: ${redir_port}" $CONFIG_YAML 2>/dev/null
|
||||
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user