luci-app-clash: bump to 0.37.1

This commit is contained in:
CN_SZTL 2019-09-07 15:23:28 +08:00
parent 8387b23b0b
commit 0dbdf49d3b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
39 changed files with 922 additions and 2237 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-clash
PKG_VERSION:=0.33.0
PKG_VERSION:=0.37.1
PKG_RELEASE:=1
PKG_MAINTAINER:=frainzy1477
@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/luci-app-clash
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
SUBMENU:=2. Services
TITLE:=LuCI app for clash
DEPENDS:=+bash +coreutils-nohup +wget
PKGARCH:=all
@ -28,6 +28,7 @@ rm -rf /tmp/luci*
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
@ -66,6 +67,8 @@ define Package/$(PKG_NAME)/install
$(INSTALL_BIN) ./root/usr/share/clash/check_version.sh $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/check_core_version.sh $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/installed_core.sh $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/proxy.sh $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/yum_change.sh $(1)/usr/share/clash/
$(INSTALL_BIN) ./root/usr/share/clash/web/* $(1)/usr/share/clash/web
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/index.html $(1)/usr/share/clash/dashboard/

View File

@ -13,10 +13,11 @@ function index()
entry({"admin", "services", "clash", "settings", "port"},cbi("clash/port"),_("Proxy Ports"), 100).leaf = true
entry({"admin", "services", "clash", "settings", "dns"},cbi("clash/dns"),_("DNS Settings"), 120).leaf = true
entry({"admin", "services", "clash", "settings", "access"},cbi("clash/access"),_("Access Control"), 130).leaf = true
entry({"admin", "services", "clash", "config"},cbi("clash/config"),_("Config"), 140).leaf = true
entry({"admin", "services", "clash", "servers"}, arcombine(cbi("clash/servers"),cbi("clash/servers-config")),_("Servers"), 140).leaf = true
entry({"admin", "services", "clash", "config"},cbi("clash/config"),_("Config"), 150).leaf = true
entry({"admin","services","clash","status"},call("action_status")).leaf=true
entry({"admin", "services", "clash", "log"},cbi("clash/log"),_("Logs"), 150).leaf = true
entry({"admin", "services", "clash", "update"},cbi("clash/update"),_("Update"), 160).leaf = true
entry({"admin", "services", "clash", "log"},cbi("clash/log"),_("Logs"), 160).leaf = true
entry({"admin", "services", "clash", "update"},cbi("clash/update"),_("Update"), 170).leaf = true
entry({"admin","services","clash","check_status"},call("check_status")).leaf=true
@ -61,6 +62,10 @@ local function new_core_version()
return luci.sys.exec("sed -n 1p /usr/share/clash/new_core_version")
end
local function e_mode()
return luci.sys.exec("grep enhanced-mode: /etc/clash/config.yaml |awk -F ':' '{print $2}'")
end
local function clash_core()
return luci.sys.exec("sh /usr/share/clash/installed_core.sh && sed -n 1p /usr/share/clash/installed_core")
end
@ -73,7 +78,8 @@ function check_status()
current_version = current_version(),
new_version = new_version(),
clash_core = clash_core(),
new_core_version = new_core_version()
new_core_version = new_core_version(),
e_mode = e_mode()
})
end
@ -88,7 +94,8 @@ function action_status()
new_version = new_version(),
dash_pass = dash_pass(),
clash_core = clash_core(),
new_core_version = new_core_version()
new_core_version = new_core_version(),
e_mode = e_mode()
})
end

View File

@ -55,7 +55,7 @@ o.write = function()
uci:commit("clash")
os.execute("mv /etc/clash/config.yaml /etc/clash/config.bak")
os.execute("rm -rf /tmp/clash.log")
SYS.call("bash /usr/share/clash/clash.sh >>/tmp/clash.log 2>&1 &")
SYS.call("sh /usr/share/clash/clash.sh >>/tmp/clash.log 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "clash", "client"))
end

View File

@ -16,7 +16,7 @@ sul =ful:section(SimpleSection, "", translate(""))
o = sul:option(FileUpload, "")
o.title = translate("Upload Config")
o.template = "clash/clash_upload"
o.description = translate("NB: Rename your config file to config.yaml before upload. file will save to /etc/clash")
o.description = translate("NB: Only upload file with name config.yml or config.yaml")
um = sul:option(DummyValue, "", nil)
um.template = "clash/clash_dvalue"
@ -40,7 +40,12 @@ http.setfilehandler(
if eof and fd then
fd:close()
fd = nil
um.value = translate("File saved to") .. ' "/etc/clash/' .. meta.file .. '"'
local clash_conf = "/etc/clash/config.yml"
if NXFS.access(clash_conf) then
os.execute("mv /etc/clash/config.yml /etc/clash/config.yaml")
os.execute("rm -rf /etc/clash/config.yml")
end
um.value = translate("File saved to") .. ' "/etc/clash/config.yaml"'
os.execute("/etc/init.d/clash restart >/dev/null 2>&1 &")
end
end

View File

@ -39,6 +39,15 @@ end
o.description = translate("NB: press ENTER to create a blank line at the end of input.")
o:depends("mode", 1)
local clash_conf = "/etc/clash/config.yaml"
if NXFS.access(clash_conf) then
local apply = luci.http.formvalue("cbi.apply")
if apply then
SYS.call("sh /usr/share/clash/yum_change.sh 2>&1 &")
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
end
end
return m

View File

@ -51,4 +51,13 @@ o:value("warning", "warning")
o:value("error", "error")
o:value("debug", "debug")
local clash_conf = "/etc/clash/config.yaml"
if NXFS.access(clash_conf) then
local apply = luci.http.formvalue("cbi.apply")
if apply then
SYS.call("sh /usr/share/clash/yum_change.sh 2>&1 &")
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
end
end
return m

View File

@ -0,0 +1,198 @@
-- Copyright (C) 2017 yushi studio <ywb94@qq.com> github.com/ywb94
-- Licensed to the public under the GNU General Public License v3.
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]
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
local server_table = {}
local encrypt_methods_ss = {
-- aead
"AEAD_AES_128_GCM",
"AEAD_AES_192_GCM",
"AEAD_AES_256_GCM",
"AEAD_CHACHA20_POLY1305",
-- stream
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
"chacha20",
"chacha20-ietf",
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305",
}
local securitys = {
"auto",
"none",
"aes-128-gcm",
"chacha20-poly1305"
}
m = Map(clash, translate("Edit Server"))
m.redirect = luci.dispatcher.build_url("admin/services/clash/servers")
if m.uci:get(clash, sid) ~= "servers" then
luci.http.redirect(m.redirect)
return
end
-- [[ Servers Setting ]]--
s = m:section(NamedSection, sid, "servers")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "type", translate("Server Node Type"))
o:value("ss", translate("Shadowsocks"))
o:value("vmess", translate("Vmess"))
o:value("socks5", translate("Socks5"))
o:value("http", translate("HTTP(S)"))
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
o = s:option(Value, "name", translate("Alias"))
o.default = "Server"
o.rmempty = false
o = s:option(Value, "server", translate("Server Address"))
o.datatype = "host"
o.rmempty = false
o = s:option(Value, "port", translate("Server Port"))
o.datatype = "port"
o.rmempty = false
o = s:option(Value, "password", translate("Password"))
o.password = true
o.rmempty = true
o:depends("type", "ss")
o = s:option(ListValue, "cipher", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
o.rmempty = true
o:depends("type", "ss")
o = s:option(ListValue, "securitys", translate("Encrypt Method"))
for _, v in ipairs(securitys) do o:value(v, v:upper()) end
o.rmempty = true
o:depends("type", "vmess")
o = s:option(ListValue, "obfs", translate("obfs-mode"))
o.rmempty = false
o.default = " "
o:value(" ", translate("none"))
o:value("tls")
o:value("http")
o:value("websocket", translate("websocket (ws)"))
o:depends("type", "ss")
o = s:option(ListValue, "obfs_vmess", translate("obfs-mode"))
o.rmempty = false
o.default = "none"
o:value("none")
o:value("websocket", translate("websocket (ws)"))
o:depends("type", "vmess")
o = s:option(Value, "host", translate("obfs-hosts"))
o.datatype = "host"
o.rmempty = true
o:depends("obfs", "tls")
o:depends("obfs", "http")
o = s:option(ListValue, "udp", translate("udp"))
o.rmempty = false
o.default = "false"
o:value("true")
o:value("false")
o:depends("type", "ss")
o = s:option(ListValue, "tls_custom", translate("tls"))
o.rmempty = false
o.default = "false"
o:value("true")
o:value("false")
o:depends("obfs", "websocket")
o = s:option(Value, "custom_host", translate("host"))
o.rmempty = true
o:depends("obfs", "websocket")
-- [[ WS部分 ]]--
-- WS路径
o = s:option(Value, "path", translate("Path"))
o.rmempty = true
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "websocket")
o = s:option(Value, "custom", translate("headers"))
o.rmempty = true
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "websocket")
-- AlterId
o = s:option(Value, "alterId", translate("AlterId"))
o.datatype = "port"
o.default = 16
o.rmempty = true
o:depends("type", "vmess")
-- VmessId
o = s:option(Value, "uuid", translate("VmessId (UUID)"))
o.rmempty = true
o.default = uuid
o:depends("type", "vmess")
-- 验证用户名
o = s:option(Value, "auth_name", translate("Auth Username"))
o:depends("type", "socks5")
o:depends("type", "http")
o.rmempty = true
-- 验证密码
o = s:option(Value, "auth_pass", translate("Auth Password"))
o:depends("type", "socks5")
o:depends("type", "http")
o.rmempty = true
-- [[ skip-cert-verify ]]--
o = s:option(ListValue, "skip_cert_verify", translate("Skip Cert Verify"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends("obfs", "websocket")
o:depends("type", "vmess")
o:depends("type", "socks5")
o:depends("type", "http")
-- [[ TLS ]]--
o = s:option(ListValue, "tls", translate("TLS"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends("type", "vmess")
o:depends("type", "socks5")
o:depends("type", "http")
return m

View File

@ -0,0 +1,79 @@
local clash = "clash"
local SYS = require "luci.sys"
local uci = luci.model.uci.cursor()
k = Map(clash)
--k.pageaction = false
s = k:section(TypedSection, "clash")
s.anonymous = true
y = s:option(ListValue, "enable_servers", translate("Enable Create Config"))
y.default = 0
y:value("0", translate("disabled"))
y:value("1", translate("enabled"))
y.description = translate("Enable to create custom config.yaml. Note that this will overide any configuration you already have")
o = s:option(Button,"Delete_Severs")
o.title = translate("Delete Severs")
o.inputtitle = translate("Delete Severs")
o.description = translate("Perform this action to delete all servers")
o.inputstyle = "reset"
o.write = function()
uci:delete_all("clash", "servers", function(s) return true end)
luci.sys.call("uci commit clash")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "servers"))
end
o = s:option(Button,"Create_Severs")
o.title = translate("Create Config")
o.inputtitle = translate("Create Config")
o.description = translate("Perform this action to generate new configuration")
o:depends("enable_servers", "1")
o.inputstyle = "apply"
o.write = function()
uci:set("clash", "enable_servers", "enable", 1)
luci.sys.call("uci commit clash")
SYS.call("sh /usr/share/clash/proxy.sh 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash", "servers"))
end
s = k:section(TypedSection, "servers")
s.anonymous = true
s.addremove = true
s.sortable = false
s.template = "cbi/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/clash/servers/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
end
end
o = s:option(DummyValue, "type", translate("Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "name", translate("Alias"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "server", translate("Server Address"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "port", translate("Server Port"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
return k

View File

@ -8,6 +8,7 @@
<fieldset class="cbi-section">
<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 Dashboard%></span></td><td id="_web"><em> <%:Collecting data...%> </em></td> </tr>
<tr><td width="50%"><span><%:Yacd Dashboard%></span></td><td id="_webb"><em> <%:Collecting data...%> </em></td> </tr>
</table>
@ -141,17 +142,19 @@ var HTTP = {
var ip = document.getElementById('_ip');
var port = document.getElementById('_port');
var secret = document.getElementById('_secret');
var emode = document.getElementById('_emode');
var version = document.getElementById('_version');
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>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
webb.innerHTML = status.web ? '<a type="button" class="btn" style="background-color:black;padding: 5px;" href="http://'+window.location.hostname+'/clash" target="_blank"/><b><font color=green><%:OPEN DASHBOARD%></font></b></a>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
clash.innerHTML = status.clash ? '<b><font color=green><%:RUNNING%></font> </b>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
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>';
webb.innerHTML = status.web ? '<a type="button" class="btn" style="background-color:black;padding: 5px;" href="http://'+window.location.hostname+'/clash" 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>';
logo.innerHTML = status.localip ? '<img id="logo" src="http://'+window.location.hostname+'/logo.png" width="150" onclick="return homepage()">' : '<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><%:NO CONFIG%></font></b>';
HTTP.checker('www.baidu.com', '_baidu');
HTTP.checker('www.google.com', '_google');
HTTP.checker('www.youtube.com', '_youtube');

View File

@ -3,7 +3,7 @@
<thead align="center">
<tr>
<th align="center"><%:App Name%></th>
<th align="center"><%:Installed Version%></th>
<th align="center"><%:Version%></th>
<th align="center"><%:Check Update%></th>
</tr>

View File

@ -70,9 +70,15 @@ msgstr "正在检查..."
msgid "Not Installed"
msgstr "未安装"
msgid "Installed Version"
msgid "Version"
msgstr "已安装版本"
msgid "NO CONFIG"
msgstr "没配置"
msgid "Clash Mode"
msgstr "Clash模式"
msgid "App Name"
msgstr "应用程序名称"
@ -241,8 +247,8 @@ msgstr "更新GEOIP数据库"
msgid "Upload Config"
msgstr "上传配置"
msgid "NB: Rename your config file to config.yaml before upload. file will save to /etc/clash"
msgstr "注意:上传之前请将配置文件重命名为config.yaml。文件将保存到 /etc/clash"
msgid "NB: Only upload file with name config.yml or config.yaml"
msgstr "注意:仅上载名为config.yml或config.yaml的文件"
msgid "Subcription Url"
msgstr "订阅URL"
@ -261,3 +267,75 @@ msgstr "服务器订阅地址"
msgid "Changes to config file must be made from source"
msgstr "必须从源文件更改配置文件"
msgid "Servers"
msgstr "自定义节点"
msgid "Enable to create custom config.yaml. Note that this will overide any configuration you already have"
msgstr "启用以创建自定义config.yaml。注意这会覆盖/etc/clash/config.yaml"
msgid "Create Config"
msgstr "创建配置"
msgid "host"
msgstr "主机名"
msgid "Enable Create Config"
msgstr "启用创建配置"
msgid "Perform this action to delete all servers"
msgstr "执行此操作以删除所有服务器"
msgid "Perform this action to generate new configuration"
msgstr "执行此操作以生成新配置"
msgid "Delete Severs"
msgstr "清空节点"
msgid "Type"
msgstr "节点类型"
msgid "Alias"
msgstr "节点别名"
msgid "Server Address"
msgstr "服务器地址"
msgid "Server Port"
msgstr "服务器端口"
msgid "Edit Server"
msgstr "编辑服务器配置"
msgid "Server Node Type"
msgstr "服务器节点类型"
msgid "Using incorrect encryption mothod may causes service fail to start"
msgstr "输入不正确的参数组合可能会导致服务无法启动"
msgid "Password"
msgstr "密码"
msgid "Encrypt Method"
msgstr "加密方式"
msgid "UDP"
msgstr "UDP"
msgid "obfs-mode"
msgstr "传输协议"
msgid "obfs-hosts"
msgstr "混淆参数"
msgid "Auth Username"
msgstr "登录用户名"
msgid "Auth Password"
msgstr "登录密码"
msgid "Skip Cert Verify"
msgstr "忽略许可验证"
msgid "None"
msgstr "未配置"

File diff suppressed because it is too large Load Diff

View File

@ -16,3 +16,4 @@ config clash 'config'
option v2ray 'https://tgbot.lbyczf.com/v2rayn2clash?url='
option surge 'https://tgbot.lbyczf.com/surge2clash?url='
option cusrule '0'
option enable_servers '0'

View File

@ -45,71 +45,8 @@ del_cron(){
}
yml_change(){
#===========================================================================================================================
mode=$(uci get clash.config.mode 2>/dev/null)
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)
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
log_level=$(uci get clash.config.level 2>/dev/null)
subtype=$(uci get clash.config.subcri 2>/dev/null)
if [ $mode -eq 1 ]; then
sed -i "/Proxy:/i\#clash-openwrt" $CONFIG_YAML
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML
sed -i "/#=============/a\ " $CONFIG_YAML
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML
mv /etc/clash/config.yaml /etc/clash/dns.yaml
cat /usr/share/clash/dns.yaml /etc/clash/dns.yaml > $CONFIG_YAML
rm -rf /etc/clash/dns.yaml
sed -i "1i\port: ${http_port}" $CONFIG_YAML
sed -i "2i\socks-port: ${socks_port}" $CONFIG_YAML
sed -i "3i\redir-port: ${redir_port}" $CONFIG_YAML
sed -i "4i\allow-lan: true" $CONFIG_YAML
sed -i "5i\mode: Rule" $CONFIG_YAML
sed -i "6i\log-level: ${log_level}" $CONFIG_YAML
sed -i "7i\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML
sed -i "8i\secret: '${da_password}'" $CONFIG_YAML
sed -i "9i\external-ui: "/usr/share/clash/dashboard"" $CONFIG_YAML
sed -i "10i\ " $CONFIG_YAML
sed -i "11i\ " $CONFIG_YAML
sed -i '/#=============/ d' $CONFIG_YAML
else
if [ $subtype == "v2rayn2clash" ];then
sed -i "/Proxy:/i\#clash-openwrt" $CONFIG_YAML
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML
sed -i "/#=============/a\ " $CONFIG_YAML
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML
mv $CONFIG_YAML /etc/clash/dns.yaml
cat /usr/share/clash/dns.yaml /etc/clash/dns.yaml > $CONFIG_YAML
rm -rf /etc/clash/dns.yaml
else
sed -i "/dns:/i\#clash-openwrt" $CONFIG_YAML
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML
fi
sed -i "1i\port: ${http_port}" $CONFIG_YAML
sed -i "2i\socks-port: ${socks_port}" $CONFIG_YAML
sed -i "3i\redir-port: ${redir_port}" $CONFIG_YAML
sed -i "4i\allow-lan: true" $CONFIG_YAML
sed -i "5i\mode: Rule" $CONFIG_YAML
sed -i "6i\log-level: ${log_level}" $CONFIG_YAML
sed -i "7i\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML
sed -i "8i\secret: '${da_password}'" $CONFIG_YAML
sed -i "9i\external-ui: "/usr/share/clash/dashboard"" $CONFIG_YAML
sed -i "10i\ " $CONFIG_YAML
sed -i "11i\ " $CONFIG_YAML
sed -i '/#=============/ d' $CONFIG_YAML
fi
#===========================================================================================================================
yml_change() {
sh /usr/share/clash/yum_change.sh >/dev/null 2>&1
}
@ -181,6 +118,7 @@ rules(){
dns_port=$(grep listen: $CONFIG_YAML |awk -F ':' '{print $3}' |tr -cd "[0-9]")
redir_port=$(uci get clash.config.redir_port 2>/dev/null)
iptables -t nat -N clash_tcp
iptables -t nat -N clash_udp
iptables -t nat -A clash_tcp -d 0.0.0.0/8 -j RETURN
@ -209,7 +147,9 @@ rules(){
iptables -t nat -I PREROUTING 1 -p udp --dport 53 -j clash_udp
iptables -t nat -A PREROUTING -p tcp -j clash_tcp
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.1/24 -j REDIRECT --to-ports $redir_port
#===========================================================================================================================

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
subscribe_url=$(uci get clash.config.subscribe_url 2>/dev/null)
subtype=$(uci get clash.config.subcri 2>/dev/null)
urlv2ray=$(uci get clash.config.v2ray 2>/dev/null)
@ -11,19 +11,19 @@ if pidof clash >/dev/null; then
/etc/init.d/clash stop 2>/dev/null
rm -rf /etc/clash/config.bak 2> /dev/null
if [ $subtype == "clash" ];then
wget-ssl --timeout=30 --tries=2 --user-agent="User-Agent: Mozilla" $subscribe_url -O 2>&1 >1 $CONFIG_YAML
wget-ssl --no-check-certificate --timeout=30 --tries=2 --user-agent="User-Agent: Mozilla/OpenWRT" $subscribe_url -O 2>&1 >1 $CONFIG_YAML
elif [ $subtype == "v2rayn2clash" ];then
if [ $cusrule == 1 ];then
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML_TEMP
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML_TEMP
if [ -f $CONFIG_YAML_TEMP ];then
sed -i '/Rule:/,$d' $CONFIG_YAML_TEMP
cat $CONFIG_YAML_TEMP $CONFIG_YAML_RULE > $CONFIG_YAML
fi
else
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
fi
elif [ $subtype == "surge2clash" ];then
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $urlsurge.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $urlsurge.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
fi
rm -rf $CONFIG_YAML_TEMP 2> /dev/null
uci set clash.config.enable=1 2> /dev/null
@ -32,19 +32,19 @@ uci commit clash 2> /dev/null
else
rm -rf /etc/clash/config.bak 2> /dev/null
if [ $subtype == "clash" ];then
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $subscribe_url -O 2>&1 >1 $CONFIG_YAML
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $subscribe_url -O 2>&1 >1 $CONFIG_YAML
elif [ $subtype == "v2rayn2clash" ];then
if [ $cusrule == 1 ];then
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML_TEMP
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML_TEMP
if [ -f $CONFIG_YAML_TEMP ];then
sed -i '/Rule:/,$d' $CONFIG_YAML_TEMP
cat $CONFIG_YAML_TEMP $CONFIG_YAML_RULE > $CONFIG_YAML
fi
else
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $urlv2ray.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
fi
elif [ $subtype == "surge2clash" ];then
wget-ssl --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla" $urlsurge.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
wget-ssl --no-check-certificate --timeout=30 --tries=5 --user-agent="User-Agent: Mozilla/OpenWRT" $urlsurge.$subscribe_url -O 2>&1 >1 $CONFIG_YAML
fi
rm -rf $CONFIG_YAML_TEMP 2> /dev/null
fi

View File

@ -10,17 +10,14 @@ dns:
enable: true
listen: 0.0.0.0:5300
enhanced-mode: fake-ip
# # experimental hosts, support wildcard
# (e.g. *.clash.dev Even *.foo.*.example.com)
# # static domain has a higher priority
# than wildcard domain (foo.example.com > *.example.com)
# # NOTE: hosts don't work with `fake-ip`
# hosts:
# '*.clash.dev': 127.0.0.1
# 'alpha.clash.dev': '::1'
nameserver:
- 101.132.183.99
- 8.8.8.8
- 119.29.29.29
- 114.114.114.114
- 114.114.115.115
- tls://dns.rubyfish.cn:853
- https://1.1.1.1/dns-query
- https://1.1.1.1/dns-query

View File

@ -0,0 +1,249 @@
#!/bin/sh /etc/rc.common
. /lib/functions.sh
enable_create=$(uci get clash.config.enable_servers 2>/dev/null)
if [ "$enable_create" == "1" ];then
status=$(ps|grep -c /usr/share/clash/proxy.sh)
[ "$status" -gt "3" ] && exit 0
CONFIG_YAML_RULE="/usr/share/clash/rule.yaml"
SERVER_FILE="/tmp/servers.yaml"
CONFIG_YAML="/etc/clash/config.yaml"
CONFIG_YAML_BAK="/etc/clash/config.bak"
TEMP_FILE="/tmp/dns_temp.yaml"
SERVERS="/tmp/servers_temp.yaml"
Proxy_Group="/tmp/Proxy_Group"
RULE_PROXY="/tmp/tempserv.yaml"
servers_set()
{
local section="$1"
config_get "type" "$section" "type" ""
config_get "name" "$section" "name" ""
config_get "server" "$section" "server" ""
config_get "port" "$section" "port" ""
config_get "cipher" "$section" "cipher" ""
config_get "password" "$section" "password" ""
config_get "securitys" "$section" "securitys" ""
config_get "udp" "$section" "udp" ""
config_get "obfs" "$section" "obfs" ""
config_get "obfs_vmess" "$section" "obfs_vmess" ""
config_get "host" "$section" "host" ""
config_get "custom" "$section" "custom" ""
config_get "custom_host" "$section" "custom_host" ""
config_get "tls" "$section" "tls" ""
config_get "tls_custom" "$section" "tls_custom" ""
config_get "skip_cert_verify" "$section" "skip_cert_verify" ""
config_get "path" "$section" "path" ""
config_get "alterId" "$section" "alterId" ""
config_get "uuid" "$section" "uuid" ""
config_get "auth_name" "$section" "auth_name" ""
config_get "auth_pass" "$section" "auth_pass" ""
if [ -z "$type" ]; then
return
fi
if [ -z "$server" ]; then
return
fi
if [ -z "$name" ]; then
name="Server"
fi
if [ -z "$port" ]; then
return
fi
if [ ! -z "$udp" ] && [ "$obfs" ] || [ "$obfs" = " " ]; then
udpp=", udp: $udp"
fi
if [ "$obfs" != "none" ]; then
if [ "$obfs" = "websocket" ]; then
obfss="plugin: v2ray-plugin"
else
obfss="plugin: obfs"
fi
else
obfs=""
fi
if [ "$obfs_vmess" = "websocket" ]; then
obfs_vmesss=", network: ws"
fi
if [ ! -z "$host" ]; then
host="host: $host"
fi
if [ ! -z "$custom" ] && [ "$type" = "vmess" ]; then
custom=", ws-headers: { Host: $custom }"
fi
if [ "$tls" = "true" ] && [ "$type" = "vmess" ]; then
tlss=", tls: $tls"
elif [ "$tls" = "true" ]; then
tlss=", tls: $tls"
fi
if [ ! -z "$path" ]; then
if [ "$type" != "vmess" ]; then
paths="path: '$path'"
else
path=", ws-path: $path"
fi
fi
if [ "$skip_cert_verify" = "true" ] && [ "$type" != "ss" ]; then
skip_cert_verifys=", skip-cert-verify: $skip_cert_verify"
elif [ "$skip_cert_verify" = "true" ]; then
skip_cert_verifys=", skip-cert-verify: $skip_cert_verify"
fi
if [ "$type" = "ss" ] && [ "$obfs" = " " ]; then
echo "- { name: \"$name\", type: $type, server: $server, port: $port, cipher: $cipher, password: "$password"$udpp }" >>$SERVER_FILE
elif [ "$type" = "ss" ] && [ "$obfs" = "websocket" ] || [ "$obfs" = "tls" ] ||[ "$obfs" = "http" ]; then
cat >> "$SERVER_FILE" <<-EOF
- name: "$name"
type: $type
server: $server
port: $port
cipher: $cipher
password: "$password"
EOF
if [ ! -z "$udp" ]; then
cat >> "$SERVER_FILE" <<-EOF
udp: $udp
EOF
fi
if [ ! -z "$obfss" ] && [ ! "$host" ]; then
cat >> "$SERVER_FILE" <<-EOF
$obfss
plugin-opts:
mode: $obfs
EOF
fi
if [ ! -z "$obfss" ] && [ "$host" ]; then
cat >> "$SERVER_FILE" <<-EOF
$obfss
plugin-opts:
mode: $obfs
$host
EOF
fi
if [ "$tls_custom" = "true" ] && [ "$type" = "ss" ]; then
cat >> "$SERVER_FILE" <<-EOF
tls: true
EOF
fi
if [ "$skip_cert_verify" = "true" ] && [ "$type" = "ss" ]; then
cat >> "$SERVER_FILE" <<-EOF
skip_cert_verifys: true
EOF
fi
if [ ! -z "$path" ]; then
cat >> "$SERVER_FILE" <<-EOF
$paths
EOF
fi
if [ ! -z "$custom_host" ]; then
cat >> "$SERVER_FILE" <<-EOF
host: "$custom_host"
EOF
fi
if [ ! -z "$custom" ]; then
cat >> "$SERVER_FILE" <<-EOF
headers:
custom: $custom
EOF
fi
fi
if [ "$type" = "vmess" ]; then
echo "- { name: \"$name\", type: $type, server: $server, port: $port, uuid: $uuid, alterId: $alterId, cipher: $securitys$obfs_vmesss$path$custom$tlss$skip_cert_verifys }" >>$SERVER_FILE
fi
if [ "$type" = "socks5" ] || [ "$type" = "http" ]; then
echo "- { name: \"$name\", type: $type, server: $server, port: $port, username: $auth_name, password: $auth_pass$skip_cert_verify$tls }" >>$SERVER_FILE
fi
}
config_load clash
config_foreach servers_set "servers"
size=$(ls -l $SERVER_FILE|awk '{print $5}')
if [ $size -ne 0 ]; then
sed -i "1i\Proxy:" $SERVER_FILE
egrep '^ {0,}-' $SERVER_FILE |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,.*//' >$Proxy_Group 2>&1
sed -i "s/^ \{0,\}/ - /" $Proxy_Group 2>/dev/null
sed -i "1i " $Proxy_Group
sed -i "2i\Proxy Group:" $Proxy_Group
sed -i "3i\ - name: Proxy" $Proxy_Group
sed -i "4i\ type: select" $Proxy_Group
sed -i "5i\ proxies:" $Proxy_Group
cat $Proxy_Group $CONFIG_YAML_RULE > $RULE_PROXY
mode=$(uci get clash.config.mode 2>/dev/null)
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)
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
log_level=$(uci get clash.config.level 2>/dev/null)
cat >> "$TEMP_FILE" <<-EOF
port: ${http_port}
socks-port: ${socks_port}
redir-port: ${redir_port}
allow-lan: true
mode: Rule
log-level: ${log_level}
external-controller: 0.0.0.0:${dash_port}
secret: '${da_password}'
external-ui: "/usr/share/clash/dashboard"
#experimental:
# ignore-resolve-fail: true
#local SOCKS5/HTTP(S) server
#authentication:
# - "user1:pass1"
# - "user2:pass2"
dns:
enable: true
listen: 0.0.0.0:5300
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/24
# hosts:
# '*.clash.dev': 127.0.0.1
# 'alpha.clash.dev': '::1'
nameserver:
- 101.132.183.99
- 8.8.8.8
- 119.29.29.29
- 114.114.114.114
- 114.114.115.115
- tls://dns.rubyfish.cn:853
- https://1.1.1.1/dns-query
EOF
cat $TEMP_FILE $SERVER_FILE > $SERVERS
if [ -f $CONFIG_YAML ]; then
rm -rf $CONFIG_YAML
fi
cat $SERVERS $RULE_PROXY > $CONFIG_YAML
rm -rf $SERVERS $RULE_PROXY $Proxy_Group $TEMP_FILE
fi
rm -rf $SERVER_FILE
fi

View File

@ -1,8 +1,3 @@
- name: "Overseas"
type: select
proxies:
- "Proxy"
- "DIRECT"
- name: "GlobalTV"
type: select
proxies:
@ -19,107 +14,82 @@
- "REJECT"
Rule:
- DOMAIN-SUFFIX,zjhu.edu.cn,DIRECT
- DOMAIN,gs.apple.com,Proxy
- DOMAIN-SUFFIX,mzstatic.com,DIRECT
- DOMAIN-SUFFIX,akadns.net,DIRECT
- DOMAIN-SUFFIX,aaplimg.com,DIRECT
- DOMAIN-SUFFIX,cdn-apple.com,DIRECT
- DOMAIN-SUFFIX,hbo.com,Proxy
- DOMAIN-SUFFIX,hbogo.com,Proxy
- DOMAIN-SUFFIX,hboasia.com,Proxy
- DOMAIN-SUFFIX,hbogo.com,Proxy
- DOMAIN-SUFFIX,hbogoasia.hk,Proxy
- DOMAIN,itunes.apple.com, DIRECT
- DOMAIN,beta.itunes.apple.com, DIRECT
- DOMAIN-SUFFIX,apple.com, DIRECT
- DOMAIN-SUFFIX,icloud.com,DIRECT
- DOMAIN-SUFFIX,icloud-content.com,DIRECT
- DOMAIN,e.crashlytics.com,REJECT
- DOMAIN-KEYWORD,bilibili,DIRECT
- DOMAIN-SUFFIX,acgvideo.com,DIRECT
- DOMAIN-SUFFIX,hdslb.com,DIRECT
- DOMAIN-KEYWORD,qiyi,DIRECT
- DOMAIN-SUFFIX,qy.net,DIRECT
- IP-CIDR,101.227.0.0/16,DIRECT
- IP-CIDR,101.224.0.0/13,DIRECT
- IP-CIDR,119.176.0.0/12,DIRECT
- DOMAIN-SUFFIX,api.mob.app.letv.com,DIRECT
- DOMAIN-KEYWORD,nowtv100,DIRECT
- DOMAIN-KEYWORD,rthklive,DIRECT
- DOMAIN-SUFFIX,mytvsuper.com,DIRECT
- DOMAIN-SUFFIX,tvb.com,DIRECT
- DOMAIN-SUFFIX,music.126.net,DIRECT
- DOMAIN-SUFFIX,music.163.com,DIRECT
- DOMAIN-SUFFIX,vv.video.qq.com,DIRECT
- IP-CIDR,106.11.0.0/16,DIRECT
- DOMAIN-SUFFIX,edgedatg.com,Overseas
- DOMAIN-SUFFIX,go.com,Overseas
- DOMAIN,linear-abematv.akamaized.net,Overseas
- DOMAIN-SUFFIX,abema.io,Overseas
- DOMAIN-SUFFIX,abema.tv,Overseas
- DOMAIN-SUFFIX,akamaized.net,Overseas
- DOMAIN-SUFFIX,ameba.jp,Overseas
- DOMAIN-SUFFIX,hayabusa.io,Overseas
- DOMAIN-SUFFIX,amazonaws.com,Overseas
- DOMAIN-SUFFIX,bahamut.com.tw,Overseas
- DOMAIN-SUFFIX,gamer.com.tw,Overseas
- DOMAIN-SUFFIX,hinet.net,Overseas
- DOMAIN-KEYWORD,bbcfmt,Overseas
- DOMAIN-KEYWORD,co.uk,Overseas
- DOMAIN-KEYWORD,uk-live,Overseas
- DOMAIN-SUFFIX,bbc.co,Overseas
- DOMAIN-SUFFIX,bbc.co.uk,Overseas
- DOMAIN-SUFFIX,bbc.com,Overseas
- DOMAIN-SUFFIX,bbci.co,Overseas
- DOMAIN-SUFFIX,bbci.co.uk,Overseas
- DOMAIN-SUFFIX,chocotv.com.tw,Overseas
- DOMAIN-KEYWORD,epicgames,Overseas
- DOMAIN-SUFFIX,helpshift.com,Overseas
- DOMAIN-KEYWORD,foxplus,Overseas
- DOMAIN-SUFFIX,config.fox.com,Overseas
- DOMAIN-SUFFIX,emome.net,Overseas
- DOMAIN-SUFFIX,fox.com,Overseas
- DOMAIN-SUFFIX,foxdcg.com,Overseas
- DOMAIN-SUFFIX,foxnow.com,Overseas
- DOMAIN-SUFFIX,foxplus.com,Overseas
- DOMAIN-SUFFIX,foxplay.com,Overseas
- DOMAIN-SUFFIX,ipinfo.io,Overseas
- DOMAIN-SUFFIX,mstage.io,Overseas
- DOMAIN-SUFFIX,now.com,Overseas
- DOMAIN-SUFFIX,theplatform.com,Overseas
- DOMAIN-SUFFIX,hbo.com,Overseas
- DOMAIN-SUFFIX,hbogo.com,Overseas
- DOMAIN-SUFFIX,hbogoasia.hk,Overseas
- DOMAIN-SUFFIX,happyon.jp,Overseas
- DOMAIN-SUFFIX,hulu.com,Overseas
- DOMAIN-SUFFIX,huluim.com,Overseas
- DOMAIN-SUFFIX,imkan.tv,Overseas
- DOMAIN-SUFFIX,joox.com,Overseas
- DOMAIN-SUFFIX,edgedatg.com,Proxy
- DOMAIN-SUFFIX,go.com,Proxy
- DOMAIN,linear-abematv.akamaized.net,Proxy
- DOMAIN-SUFFIX,abema.io,Proxy
- DOMAIN-SUFFIX,abema.tv,Proxy
- DOMAIN-SUFFIX,akamaized.net,Proxy
- DOMAIN-SUFFIX,ameba.jp,Proxy
- DOMAIN-SUFFIX,hayabusa.io,Proxy
- DOMAIN-SUFFIX,amazonaws.com,Proxy
- DOMAIN-SUFFIX,bahamut.com.tw,Proxy
- DOMAIN-SUFFIX,gamer.com.tw,Proxy
- DOMAIN-SUFFIX,hinet.net,Proxy
- DOMAIN-KEYWORD,bbcfmt,Proxy
- DOMAIN-KEYWORD,co.uk,Proxy
- DOMAIN-KEYWORD,uk-live,Proxy
- DOMAIN-SUFFIX,bbc.co,Proxy
- DOMAIN-SUFFIX,bbc.co.uk,Proxy
- DOMAIN-SUFFIX,bbc.com,Proxy
- DOMAIN-SUFFIX,bbci.co,Proxy
- DOMAIN-SUFFIX,bbci.co.uk,Proxy
- DOMAIN-SUFFIX,chocotv.com.tw,Proxy
- DOMAIN-KEYWORD,epicgames,Proxy
- DOMAIN-SUFFIX,helpshift.com,Proxy
- DOMAIN-KEYWORD,foxplus,Proxy
- DOMAIN-SUFFIX,config.fox.com,Proxy
- DOMAIN-SUFFIX,emome.net,Proxy
- DOMAIN-SUFFIX,fox.com,Proxy
- DOMAIN-SUFFIX,foxdcg.com,Proxy
- DOMAIN-SUFFIX,foxnow.com,Proxy
- DOMAIN-SUFFIX,foxplus.com,Proxy
- DOMAIN-SUFFIX,foxplay.com,Proxy
- DOMAIN-SUFFIX,ipinfo.io,Proxy
- DOMAIN-SUFFIX,mstage.io,Proxy
- DOMAIN-SUFFIX,now.com,Proxy
- DOMAIN-SUFFIX,theplatform.com,Proxy
- DOMAIN-SUFFIX,hbo.com,Proxy
- DOMAIN-SUFFIX,hbogo.com,Proxy
- DOMAIN-SUFFIX,hbogoasia.hk,Proxy
- DOMAIN-SUFFIX,happyon.jp,Proxy
- DOMAIN-SUFFIX,hulu.com,Proxy
- DOMAIN-SUFFIX,huluim.com,Proxy
- DOMAIN-SUFFIX,imkan.tv,Proxy
- DOMAIN-SUFFIX,joox.com,Proxy
- DOMAIN-SUFFIX,netflix.com,Proxy
- DOMAIN-SUFFIX,netflix.net,Proxy
- DOMAIN-SUFFIX,nflxext.com,Proxy
@ -127,21 +97,15 @@ Rule:
- DOMAIN-SUFFIX,nflximg.net,Proxy
- DOMAIN-SUFFIX,nflxso.net,Proxy
- DOMAIN-SUFFIX,nflxvideo.net,Proxy
- DOMAIN-KEYWORD,spotify,Overseas
- DOMAIN-SUFFIX,scdn.co,Overseas
- DOMAIN-SUFFIX,spoti.fi,Overseas
- DOMAIN-SUFFIX,viu.tv,Overseas
- DOMAIN-KEYWORD,youtube,Overseas
- DOMAIN-SUFFIX,googlevideo.com,Overseas
- DOMAIN-SUFFIX,gvt2.com,Overseas
- DOMAIN-SUFFIX,youtu.be,Overseas
- DOMAIN-KEYWORD,spotify,Proxy
- DOMAIN-SUFFIX,scdn.co,Proxy
- DOMAIN-SUFFIX,spoti.fi,Proxy
- DOMAIN-SUFFIX,viu.tv,Proxy
- DOMAIN-KEYWORD,youtube,Proxy
- DOMAIN-SUFFIX,googlevideo.com,Proxy
- DOMAIN-SUFFIX,gvt2.com,Proxy
- DOMAIN-SUFFIX,youtu.be,Proxy
- DOMAIN-SUFFIX,cn,DIRECT
- DOMAIN-SUFFIX,126.com,DIRECT
- DOMAIN-SUFFIX,126.net,DIRECT
- DOMAIN-SUFFIX,127.net,DIRECT
@ -259,7 +223,6 @@ Rule:
- DOMAIN-SUFFIX,zealer.com,DIRECT
- DOMAIN-SUFFIX,zhihu.com,DIRECT
- DOMAIN-SUFFIX,zhimg.com,DIRECT
- DOMAIN-KEYWORD,amazon,Proxy
- DOMAIN-KEYWORD,google,Proxy
- DOMAIN-KEYWORD,gmail,Proxy
@ -274,7 +237,6 @@ Rule:
- DOMAIN-KEYWORD,blogspot,Proxy
- DOMAIN-SUFFIX,youtu.be,Proxy
- DOMAIN-KEYWORD,whatsapp,Proxy
- DOMAIN-SUFFIX,9to5mac.com,Proxy
- DOMAIN-SUFFIX,abpchina.org,Proxy
- DOMAIN-SUFFIX,adblockplus.org,Proxy
@ -546,7 +508,6 @@ Rule:
- DOMAIN-SUFFIX,ying.com,Proxy
- DOMAIN-SUFFIX,yoyo.org,Proxy
- DOMAIN-SUFFIX,ytimg.com,Proxy
- DOMAIN-SUFFIX,telegra.ph,Proxy
- DOMAIN-SUFFIX,telegram.org,Proxy
- IP-CIDR,91.108.56.0/22,Proxy
@ -555,7 +516,6 @@ Rule:
- IP-CIDR,109.239.140.0/24,Proxy
- IP-CIDR,149.154.160.0/20,Proxy
- IP-CIDR,149.154.164.0/22,Proxy
- DOMAIN-SUFFIX,local,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
@ -567,7 +527,6 @@ Rule:
- DOMAIN-KEYWORD,torrent,DIRECT
- DOMAIN-KEYWORD,tracker,DIRECT
- DOMAIN-SUFFIX,smtp,DIRECT
- DOMAIN-SUFFIX,edgedatg.com,GlobalTV
- DOMAIN-SUFFIX,go.com,GlobalTV
- DOMAIN,linear-abematv.akamaized.net,GlobalTV
@ -891,13 +850,11 @@ Rule:
- DOMAIN,ad.qingting.fm,AdBlock
- DOMAIN,ad-cn.jovcloud.com,AdBlock
- DOMAIN,adsapi.manhuaren.com,AdBlock
- DOMAIN,adclick.g.doubleclick.net,AdBlock
- DOMAIN,googleads.g.doubleclick.net,AdBlock
- DOMAIN,www.googleadservices.com,AdBlock
- DOMAIN,googleadservices.com,AdBlock
- DOMAIN,googleads.g.doubleclick.net,AdBlock
- DOMAIN,adsdk.dmzj.com,AdBlock
- DOMAIN,ads.daydaycook.com.cn,AdBlock
- DOMAIN,adui.tg.meitu.com,AdBlock
@ -1301,6 +1258,7 @@ Rule:
- DOMAIN-SUFFIX,com-hs-hkdy.com,DIRECT
- DOMAIN-SUFFIX,czybjz.com,DIRECT
- DOMAIN-SUFFIX,dandanzan.com,DIRECT
- DOMAIN-SUFFIX,zjhu.edu.cn,DIRECT
- DOMAIN-SUFFIX,fjhps.com,DIRECT
- DOMAIN-SUFFIX,kuyunbo.club,DIRECT
- DOMAIN-SUFFIX,baidu.com,DIRECT
@ -1860,6 +1818,5 @@ Rule:
- IP-CIDR,199.96.56.0/21,Proxy
- IP-CIDR,202.160.128.0/22,Proxy
- IP-CIDR,209.237.192.0/19,Proxy
- GEOIP,CN,DIRECT
- MATCH,Overseas
- MATCH,Proxy

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
<meta name="application-name" content="yacd">
<meta name="description" content="Yet Another Clash Dashboard">
<meta name="theme-color" content="#202020">
<title>yacd - Yet Another Clash Dashboard</title>
<title>Yet Another Clash Dashboard</title>
<link rel="prefetch" href="https://cdn.jsdelivr.net/npm/@hsjs/fonts@0.0.1/robotomono/v5/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2">
<link rel="prefetch" href="https://fonts.loli.net/css?family=Merriweather+Sans:400,700&display=swap" rel="stylesheet">
<meta property="og:image" content="https://user-images.githubusercontent.com/1166872/47304841-536f3d80-d65a-11e8-8908-1917127dafc5.png">
@ -21,20 +21,20 @@
<meta property="og:description" content="Yet Another Clash Dashboard">
<link href="app.83f6698cbf7891b130e2.css" rel="stylesheet">
<link href="app.26d9ccafb71b5570736d.css" rel="stylesheet">
<body>
<div id="app"></div>
<script src="runtime~app.dc7b6d94c7fe054b4bce.js" type="text/javascript"></script>
<script src="runtime~app.271c0a96fd4712ee7d81.js" type="text/javascript"></script>
<script src="core-js~app.b0e192aa2040bbc66d02.js" type="text/javascript"></script>
<script src="core-js~app.2bafdc22a68f45914da2.js" type="text/javascript"></script>
<script src="react~app.6097406f382313d294e3.js" type="text/javascript"></script>
<script src="react~app.69171d2b5aa5144a2a86.js" type="text/javascript"></script>
<script src="app.99489dd938c57b6c22da.js" type="text/javascript"></script>
<script src="app.326175ee257418d645a5.js" type="text/javascript"></script>
</body>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){function t(t){for(var n,o,i=t[0],l=t[1],f=t[2],s=t[3]||[],d=0,h=[];d<i.length;d++)o=i[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&h.push(a[o][0]),a[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t),c.push.apply(c,s);h.length;)h.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var f=r[o];0!==a[f]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return 0===u.length&&(c.forEach(function(e){if(void 0===a[e]){a[e]=null;var t=document.createElement("link");l.nc&&t.setAttribute("nonce",l.nc),t.rel="prefetch",t.as="script",t.href=i(e),document.head.appendChild(t)}}),c.length=0),e}var n={},o={5:0},a={5:0},u=[],c=[];function i(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"e224f2407be3c35c1eb8",4:"5a42cf2d599e6ae44097",6:"1bf4142c0531e8a79fdd",7:"6347f82f57f293361a76"}[e]+".js"}function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{2:1,4:1}[e]&&t.push(o[e]=new Promise(function(t,r){for(var n=({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"b42d1d5155bdec5e6c11",4:"fd22590d9542ad5fc200",6:"063030943ce194cc3bd3",7:"bf6de3d705889f2069d2"}[e]+".css",a=l.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var i=(s=u[c]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(i===n||i===a))return t()}var f=document.getElementsByTagName("style");for(c=0;c<f.length;c++){var s;if((i=(s=f[c]).getAttribute("data-href"))===n||i===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)}).then(function(){o[e]=0}));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=a[e]=[t,n]});t.push(r[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,l.nc&&c.setAttribute("nonce",l.nc),c.src=i(e);var f=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var s=setTimeout(function(){u({type:"timeout",target:c})},12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(t)},l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],s=f.push.bind(f);f.push=t,f=f.slice();for(var d=0;d<f.length;d++)t(f[d]);var p=s;r()}([]);

View File

@ -1 +0,0 @@
!function(e){function t(t){for(var n,o,c=t[0],l=t[1],f=t[2],s=t[3]||[],d=0,h=[];d<c.length;d++)o=c[d],a[o]&&h.push(a[o][0]),a[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t),i.push.apply(i,s);h.length;)h.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var f=r[o];0!==a[f]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return 0===u.length&&(i.forEach(function(e){if(void 0===a[e]){a[e]=null;var t=document.createElement("link");l.nc&&t.setAttribute("nonce",l.nc),t.rel="prefetch",t.as="script",t.href=c(e),document.head.appendChild(t)}}),i.length=0),e}var n={},o={5:0},a={5:0},u=[],i=[];function c(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"993826afdebb153e0805",4:"6f76e629fb04fefe588a",6:"429cb8fa2f4d9b575993",7:"a322784ecacd704a28c6"}[e]+".js"}function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{2:1,4:1}[e]&&t.push(o[e]=new Promise(function(t,r){for(var n=({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"9022775a13e050c1509f",4:"1fba3c440f97fe0e3bb1",6:"7d5d6ed1822d5d0495fb",7:"80c51b1d7a5a45aaeac0"}[e]+".css",a=l.p+n,u=document.getElementsByTagName("link"),i=0;i<u.length;i++){var c=(s=u[i]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(c===n||c===a))return t()}var f=document.getElementsByTagName("style");for(i=0;i<f.length;i++){var s;if((c=(s=f[i]).getAttribute("data-href"))===n||c===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)}).then(function(){o[e]=0}));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=a[e]=[t,n]});t.push(r[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.src=c(e);var f=new Error;u=function(t){i.onerror=i.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var s=setTimeout(function(){u({type:"timeout",target:i})},12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(t)},l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],s=f.push.bind(f);f.push=t,f=f.slice();for(var d=0;d<f.length;d++)t(f[d]);var p=s;r()}([]);

View File

@ -0,0 +1,63 @@
#!/bin/bash
CONFIG_YAML="/etc/clash/config.yaml"
#===========================================================================================================================
mode=$(uci get clash.config.mode 2>/dev/null)
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)
dash_port=$(uci get clash.config.dash_port 2>/dev/null)
log_level=$(uci get clash.config.level 2>/dev/null)
subtype=$(uci get clash.config.subcri 2>/dev/null)
if [ $mode -eq 1 ]; then
sed -i "/Proxy:/i\#clash-openwrt" $CONFIG_YAML
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML
sed -i "/#=============/a\ " $CONFIG_YAML
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML
mv /etc/clash/config.yaml /etc/clash/dns.yaml
cat /usr/share/clash/dns.yaml /etc/clash/dns.yaml > $CONFIG_YAML
rm -rf /etc/clash/dns.yaml
sed -i "1i\port: ${http_port}" $CONFIG_YAML
sed -i "2i\socks-port: ${socks_port}" $CONFIG_YAML
sed -i "3i\redir-port: ${redir_port}" $CONFIG_YAML
sed -i "4i\allow-lan: true" $CONFIG_YAML
sed -i "5i\mode: Rule" $CONFIG_YAML
sed -i "6i\log-level: ${log_level}" $CONFIG_YAML
sed -i "7i\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML
sed -i "8i\secret: '${da_password}'" $CONFIG_YAML
sed -i "9i\external-ui: "/usr/share/clash/dashboard"" $CONFIG_YAML
sed -i "10i\ " $CONFIG_YAML
sed -i "11i\ " $CONFIG_YAML
sed -i '/#=============/ d' $CONFIG_YAML
else
if [ $subtype == "v2rayn2clash" ];then
sed -i "/Proxy:/i\#clash-openwrt" $CONFIG_YAML
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML
sed -i "/#=============/a\ " $CONFIG_YAML
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML
mv $CONFIG_YAML /etc/clash/dns.yaml
cat /usr/share/clash/dns.yaml /etc/clash/dns.yaml > $CONFIG_YAML
rm -rf /etc/clash/dns.yaml
else
sed -i "/dns:/i\#clash-openwrt" $CONFIG_YAML
sed -i "/#clash-openwrt/a\#=============" $CONFIG_YAML
sed -i '1,/#clash-openwrt/d' $CONFIG_YAML
fi
sed -i "1i\port: ${http_port}" $CONFIG_YAML
sed -i "2i\socks-port: ${socks_port}" $CONFIG_YAML
sed -i "3i\redir-port: ${redir_port}" $CONFIG_YAML
sed -i "4i\allow-lan: true" $CONFIG_YAML
sed -i "5i\mode: Rule" $CONFIG_YAML
sed -i "6i\log-level: ${log_level}" $CONFIG_YAML
sed -i "7i\external-controller: 0.0.0.0:${dash_port}" $CONFIG_YAML
sed -i "8i\secret: '${da_password}'" $CONFIG_YAML
sed -i "9i\external-ui: "/usr/share/clash/dashboard"" $CONFIG_YAML
sed -i "10i\ " $CONFIG_YAML
sed -i "11i\ " $CONFIG_YAML
sed -i '/#=============/ d' $CONFIG_YAML
fi
#===========================================================================================================================