luci-app-clash: bump to 1.5.1

This commit is contained in:
CN_SZTL 2020-02-03 17:28:06 +08:00
parent 0334d5b436
commit f56f6064c4
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
12 changed files with 68 additions and 34 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-clash
PKG_VERSION:=1.5.0
PKG_VERSION:=1.5.1
PKG_MAINTAINER:=frainzy1477

View File

@ -71,6 +71,13 @@ o.default = 123456
o.rmempty = false
o.description = translate("Dashboard Secret")
o = s:option(ListValue, "p_mode", translate("Proxy Mode"))
o.description = translate("Choose proxy mode")
o:value("Rule", "RULE")
o:value("Global", "GLOBAL")
o:value("Direct", "DIRECT")
o.default = "Rule"
o = s:option(ListValue, "level", translate("Log level"))
o.description = translate("Choose Log Level")
o:value("info", "info")

View File

@ -2,7 +2,6 @@
local m, s, o
local clash = "clash"
local uci = luci.model.uci.cursor()
--local ipkg = require("luci.model.ipkg")
local fs = require "nixio.fs"
local sys = require "luci.sys"
local sid = arg[1]

View File

@ -2,7 +2,6 @@
local m, s, o
local clash = "clash"
local uci = luci.model.uci.cursor()
--local ipkg = require("luci.model.ipkg")
local fs = require "nixio.fs"
local sys = require "luci.sys"
local sid = arg[1]

View File

@ -10,8 +10,8 @@
<table width="100%" cellspacing="10">
<tr><td width="50%"><span><%:Clash Client%></span></td><td id="_clash"><em><%:Collecting data...%></em></td> </tr>
<tr><td width="50%"><span><%:Clash Mode%></span></td><td id="_emode"><em><%:Collecting data...%></em></td> </tr>
<tr><td width="50%"><span><%:Clash Config%></span></td><td id="_conf_path"><b><font color="red"><%:NOT RUNNING%></font></b></td> </tr>
<tr><td width="50%"><span><%:View Config%></span></td><td id="_conf"><em><%:Collecting data...%></em></td> </tr>
<tr><td width="50%"><span><%:Clash Config%></span></td><td id="_conf"><em><%:Collecting data...%></em></td> </tr>
<tr><td width="50%"><span><%:Config Type%></span></td><td id="_conf_path"><em><%:Collecting data...%></em></td> </tr>
<tr><td width="50%"><span><%:Clash Dashboard%></span></td><td id="_web"><em> <%:Collecting data...%> </em></td> </tr>
</table>
@ -173,7 +173,10 @@ var HTTP = {
}
if(status.typeconf==3){
conf_path.innerHTML = status.clash ? '<b><font color="green"><%:CUSTOM%></font></b>' : '<b><font color="red"><%:NOT RUNNING%></font></b>';
}
}
if(status.typeconf==0 || status.typeconf==''){
conf_path.innerHTML = status.typeconf ? '<b><font color="red"><%:NOT SELECTED%></font></b>' : '<b><font color="red"><%:NOT RUNNING%></font></b>';
}
IP.getIpifyIP();
IP.getIpipnetIP();

View File

@ -471,7 +471,7 @@ msgid "Custom"
msgstr "自定义"
msgid "Config Type"
msgstr "配置类型"
msgstr "Clash配置类型"
msgid "Select Configuration type"
msgstr "选择配置类型”"
@ -809,8 +809,8 @@ msgstr "强制使用同名"
msgid "Enable to overwrite config file"
msgstr "启用覆盖配置文件"
msgid "Clash Config"
msgstr "Clash配置"
msgid "Config Type"
msgstr "Clash配置类型"
msgid "SUBSCRIBE"
msgstr "订阅配置"
@ -911,10 +911,10 @@ msgstr "正在下载规则..."
msgid "Downloading..."
msgstr "正在下载规则..."
msgid "VIEW CONFIG"
msgstr "查看配置"
msgid "Clash Config"
msgstr "Clash配置"
msgid "View Config"
msgid "VIEW CONFIG"
msgstr "查看配置"
msgid "If config does not show refresh page"
@ -936,4 +936,19 @@ msgid "4.Click on ADD, Set the corresponding policy group of the downloaded game
msgstr "4. 单击添加,设置下载游戏规则的相应策略组(策略组类型建议:FallBack。"
msgid "5.Select ClashTun Core type and start client"
msgstr "5. 在客户端页选择ClashTun内核(https://github.com/comzyh/clash/releases)和启用游戏规则。"
msgstr "5. 在客户端页选择ClashTun内核(https://github.com/comzyh/clash/releases)和启用游戏规则。"
msgid "RULE"
msgstr "规则模式"
msgid "GLOBAL"
msgstr "全局模式"
msgid "DIRECT"
msgstr "直接模式"
msgid "Proxy Mode"
msgstr "代理模式"
msgid "Choose proxy mode"
msgstr "选择代理模式"

View File

@ -22,6 +22,7 @@ config clash 'config'
option loadgroups '1'
option dnscache '0'
option config_type '1'
option p_mode 'Rule'
config groups
option old_name '❌AdBlock'

View File

@ -220,7 +220,11 @@ rules(){
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports "${redir_port}"
iptables -t nat -A zone_lan_prerouting -p tcp -j clash
if [ -z "$(iptables -nvL zone_lan_prerouting -t nat)" ]; then
iptables -t nat -A PREROUTING -p tcp -j clash
else
iptables -t nat -A zone_lan_prerouting -p tcp -j clash
fi
fake_ip_range=$(egrep '^ {0,}fake-ip-range' /etc/clash/config.yaml |grep fake-ip-range: |awk -F ': ' '{print $2}')
@ -234,7 +238,11 @@ rules(){
if [ -f /usr/sbin/ip6tables ] && [ "${ipv6}" -eq 1 ]; then
ip6tables -t nat -N clash_ipv6
ip6tables -t nat -A clash_ipv6 -p tcp -j REDIRECT --to-ports "${redir_port}"
ip6tables -t nat -A zone_lan_prerouting -p tcp -j clash_ipv6
if [ -z "$(ip6tables -nvL zone_lan_prerouting -t nat)" ]; then
ip6tables -t nat -A PREROUTING -p tcp -j clash_ipv6
else
ip6tables -t nat -A zone_lan_prerouting -p tcp -j clash_ipv6
fi
fi
elif [ "${core}" -eq 3 ];then
@ -523,11 +531,16 @@ remove_mark(){
if [ -f /usr/sbin/ip6tables ] && [ "${ipv6}" -eq 1 ]; then
ip6tables -t nat -F clash_ipv6 2>/dev/null1 && ip6tables -t nat -X clash_ipv6 2>/dev/null
if [ -z "$(ip6tables -nvL zone_lan_prerouting -t nat)" ]; then
ip6tables -t nat -D PREROUTING -p tcp -j clash_ipv6 >/dev/null 2>&1
else
mangle_indexs=$(ip6tables -nvL zone_lan_prerouting -t nat | sed 1,2d | sed -n '/clash_ipv6/=' | sort -r)
for mangle_index in $mangle_indexs; do
ip6tables -t nat -D zone_lan_prerouting $mangle_index 2>/dev/null
done
fi
fi
if [ "${core}" -eq 3 ];then
@ -593,14 +606,15 @@ stop(){
fi
iptables -t nat -F clash >/dev/null 2>&1 && iptables -t nat -X clash >/dev/null 2>&1
if [ -z "$(iptables -nvL zone_lan_prerouting -t nat)" ]; then
iptables -t nat -D PREROUTING -p tcp -j clash >/dev/null 2>&1
else
nat_indexs=$(iptables -nvL zone_lan_prerouting -t nat | sed 1,2d | sed -n '/clash/=' | sort -r)
for nat_index in $nat_indexs; do
iptables -t nat -D zone_lan_prerouting $nat_index >/dev/null 2>&1
done
fi
fake=$(iptables -nvL OUTPUT -t nat |sed 1,2d |sed -n '/198.18.0.0\/16/=' |sort -r)
for fake in $fake; do
iptables -t nat -D OUTPUT $fake >/dev/null 2>&1

View File

@ -1,7 +1,6 @@
#!/bin/bash /etc/rc.common
. /lib/functions.sh
dnsforwader=$(uci get clash.config.dnsforwader 2>/dev/null)
enable_list=$(uci get clash.config.cus_list 2>/dev/null)
if [ $enable_list -eq 1 ];then
@ -37,11 +36,7 @@ add_address(){
rm -rf /tmp/server.conf /usr/share/clashbackup/address.list >/dev/null 2>&1
}
if [ "${dnsforwader}" -eq 1 ];then
add_address >/dev/null 2>&1
fi
add_address >/dev/null 2>&1
if [ -d /tmp/dnsmasq.clash ];then
rm -rf /tmp/dnsmasq.clash

View File

@ -4,7 +4,7 @@ experimental:
tun:
enable: true
device-url: dev://utun
dns-listen: 0.0.0.0:5300
dns-listen: 0.0.0.0:53
dns:
enable: true
@ -19,4 +19,4 @@ dns:
- udp://8.8.4.4:53
- tcp://1.1.1.1

View File

@ -31,13 +31,14 @@ sleep 2
da_password=$(uci get clash.config.dash_pass 2>/dev/null)
redir_port=$(uci get clash.config.redir_port 2>/dev/null)
http_port=$(uci get clash.config.http_port 2>/dev/null)
socks_port=$(uci get clash.config.socks_port 2>/dev/null)
socks_port=$(uci get clash.config.socks_port 2>/dev/null)
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
bind_addr=$(uci get clash.config.bind_addr 2>/dev/null)
allow_lan=$(uci get clash.config.allow_lan 2>/dev/null)
log_level=$(uci get clash.config.level 2>/dev/null)
subtype=$(uci get clash.config.subcri 2>/dev/null)
tun_mode=$(uci get clash.config.tun_mode 2>/dev/null)
p_mode=$(uci get clash.config.p_mode 2>/dev/null)
if [ "${mode}" -eq 1 ]; then
@ -69,8 +70,8 @@ if [ "${mode}" -eq 1 ]; then
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
if [ $allow_lan == "true" ]; then
sed -i "/allow-lan: ${allow_lan}/a\bind-address: \"${bind_addr}\"" $CONFIG_YAML 2>/dev/null
sed -i "/bind-address: \"${bind_addr}\"/a\mode: Rule" $CONFIG_YAML 2>/dev/null
sed -i "/mode: Rule/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
sed -i "/bind-address: \"${bind_addr}\"/a\mode: ${p_mode}" $CONFIG_YAML 2>/dev/null
sed -i "/mode: ${p_mode}/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
@ -119,8 +120,8 @@ elif [ "${tun_mode}" -eq 1 ]; then
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
if [ $allow_lan == "true" ]; then
sed -i "/allow-lan: ${allow_lan}/a\bind-address: \"${bind_addr}\"" $CONFIG_YAML 2>/dev/null
sed -i "/bind-address: \"${bind_addr}\"/a\mode: Rule" $CONFIG_YAML 2>/dev/null
sed -i "/mode: Rule/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
sed -i "/bind-address: \"${bind_addr}\"/a\mode: ${p_mode}" $CONFIG_YAML 2>/dev/null
sed -i "/mode: ${p_mode}/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null
@ -177,8 +178,8 @@ else
sed -i "/redir-port: ${redir_port}/a\allow-lan: ${allow_lan}" $CONFIG_YAML 2>/dev/null
if [ $allow_lan == "true" ]; then
sed -i "/allow-lan: ${allow_lan}/a\bind-address: \"${bind_addr}\"" $CONFIG_YAML 2>/dev/null
sed -i "/bind-address: \"${bind_addr}\"/a\mode: Rule" $CONFIG_YAML 2>/dev/null
sed -i "/mode: Rule/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
sed -i "/bind-address: \"${bind_addr}\"/a\mode: ${p_mode}" $CONFIG_YAML 2>/dev/null
sed -i "/mode: ${p_mode}/a\log-level: ${log_level}" $CONFIG_YAML 2>/dev/null
sed -i "/log-level: ${log_level}/a\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML 2>/dev/null
sed -i "/external-controller: 0.0.0.0:${dash_port}/a\secret: \"${da_password}\"" $CONFIG_YAML 2>/dev/null
sed -i "/secret: \"${da_password}\"/a\external-ui: \"/usr/share/clash/dashboard\"" $CONFIG_YAML 2>/dev/null