OpenClash: update

This commit is contained in:
CN_SZTL 2019-10-12 09:32:11 +08:00
parent b024ce3640
commit 28c3e08e4a
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
44 changed files with 842 additions and 369 deletions

View File

@ -17,6 +17,11 @@ config openclash 'config'
option en_mode 'redir-host'
option enable_redirect_dns '1'
option dns_advanced_setting '0'
option servers_if_update '0'
option disable_masq_cache '0'
option servers_update '0'
option log_level 'silent'
option proxy_mode 'Rule'
config dns_servers
option group 'nameserver'

View File

@ -52,6 +52,9 @@ time4.google.com
#放行网易云音乐
.music.163.com
interface.music.163.com
interface3.music.163.com
apm.music.163.com
apm3.music.163.com
#win10本地连接检测
msftconnecttest.com
msftncsi.com

View File

@ -161,8 +161,8 @@ yml_dns_check()
[ -z "$(grep '^ \{0,\}nameserver:' $CONFIG_FILE)" ] && {
sed -i '/^Proxy:/i\ nameserver:' "$CONFIG_FILE" 2>/dev/null
sed -i "/nameserver:/a\ - tls://8.8.8.8:853" "$CONFIG_FILE" 2>/dev/null
sed -i "/nameserver:/a\ - 114.114.114.114" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - tls://8.8.8.8:853" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - 114.114.114.114" "$CONFIG_FILE" 2>/dev/null
}
dns_port=$(grep "^ \{0,\}listen:" $CONFIG_FILE |awk -F ':' '{print $3}' |awk -F '#' '{print $1}' |tr -cd "[0-9]" 2>/dev/null)
@ -379,6 +379,8 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
lan_ip=$(uci get network.lan.ipaddr 2>/dev/null)
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
log_level=$(uci get openclash.config.log_level 2>/dev/null)
proxy_mode=$(uci get openclash.config.proxy_mode 2>/dev/null)
echo "第二步: 配置文件检查..." >$START_LOG
yml_check "$en_mode" "$enable_custom_dns" "$CONFIG_FILE" "$BACKUP_FILE" "$START_BACKUP"
grep "^ \{0,\}Proxy:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Proxy Group:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Rule:" $CONFIG_FILE >/dev/null 2>&1
@ -396,7 +398,7 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
yml_auth_custom "$CONFIG_FILE"
yml_cut "$CHANGE_FILE" "$RULE_FILE" "$DNS_FILE" "$CONFIG_FILE" "$PROXY_FILE"
yml_dns_custom "$enable_custom_dns" "$DNS_FILE"
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" &
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" &
sh /usr/share/openclash/yml_rules_change.sh "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$RULE_FILE" &
wait
cat "$CHANGE_FILE" "$DNS_FILE" "$PROXY_FILE" "$RULE_FILE" >$CONFIG_FILE 2>/dev/null
@ -455,7 +457,7 @@ EOF
echo "第八步: 重启 Dnsmasq 程序..." >$START_LOG
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep dpt:53 |wc -l)" -gt 2 ]; then
echo "发现53端口被劫持请将OpenClash设置为劫持53端口程序的上游DNS服务器" >$START_LOG
echo "发现53端口被劫持如连接异常请将OpenClash设置为劫持53端口程序的上游DNS服务器" >$START_LOG
echo "${LOGTIME} Warring: OpenClash May Can Not Take Over DNS, Please Use OpenClash for Upstream DNS Resolve Server" >> $LOG_FILE
sleep 5
fi
@ -465,9 +467,15 @@ EOF
if pidof clash >/dev/null; then
echo "第九步: 添加 OpenClash 计划任务,启动进程守护程序..." >$START_LOG
add_cron
echo "OpenClash 启动成功,请等待服务器上线!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful" >> $LOG_FILE
sleep 5
if [ -z "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
echo "OpenClash 启动成功,请等待服务器上线!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful" >> $LOG_FILE
sleep 5
else
echo "OpenClash 启动成功检测到您启用了IPV6的DHCP服务可能会造成连接异常" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
sleep 10
fi
echo "" >$START_LOG
else
if [ "$rule_source" != 0 ] || [ "$enable_custom_clash_rules" != 0 ]; then
@ -482,9 +490,18 @@ EOF
sleep 3
if pidof clash >/dev/null; then
add_cron
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 5
if [ -z "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 10
else
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 10
echo "OpenClash 启动成功检测到您启用了IPV6的DHCP服务可能会造成连接异常" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
sleep 10
fi
echo "" >$START_LOG
else
echo "错误: OpenClash 启动失败,请到日志页面查看详细错误信息!" >$START_LOG

View File

@ -1,4 +1,5 @@
# Copyright (c) 2018 Dreamacro
# 接管:不支持在此页面直接修改,请到全局设置页面进行修改
# port of HTTP
port: 7890 # 此项将被接管
@ -18,11 +19,11 @@ allow-lan: true # 此项将被接管为true
bind-address: "*" # HTTP(S)\SOCKS5 监听地址此项将被接管为all
# Rule / Global/ Direct (default is Rule)
mode: Rule
mode: Rule # 此项将被接管
# set log level to stdout (default is info)
# info / warning / error / debug / silent
log-level: info
log-level: info # 此项将被接管
# A RESTful API for clash
external-controller: 0.0.0.0:9090 # 此项将被接管
@ -137,6 +138,16 @@ Proxy: # 此参数必须保留,不能删除
# with tls (https) and skip-cert-verify
- { name: "http", type: http, server: server, port: 443, tls: true, skip-cert-verify: true }
# snell
- name: "snell"
type: snell
server: server
port: 44046
psk: yourpsk
# obfs-opts:
# mode: http # or tls
# host: bing.com
# Openclash 不会对下方策略组设置进行任何更改,请确保设置正确
Proxy Group: # 此参数必须保留,不能删除

View File

@ -78,7 +78,7 @@ local function config_check()
end
local function cn_port()
return luci.sys.exec("uci get openclash.config.cn_port 2>/dev/null")
return luci.sys.exec("uci get openclash.config.cn_port 2>/dev/null |tr -d '\n'")
end
local function mode()
@ -121,7 +121,7 @@ local function ConnersHua_return()
end
local function daip()
return luci.sys.exec("uci get network.lan.ipaddr")
return luci.sys.exec("uci get network.lan.ipaddr 2>/dev/null |tr -d '\n'")
end
local function dase()

View File

@ -24,4 +24,27 @@ end
log.write = function(self, section, value)
end
return m
local t = {
{refresh, clean}
}
a = SimpleForm("apply")
a.reset = false
a.submit = false
s = a:section(Table, t)
o = s:option(Button, "refresh")
o.inputtitle = translate("Refresh Log")
o.inputstyle = "apply"
o.write = function()
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "log"))
end
o = s:option(Button, "clean")
o.inputtitle = translate("Clean Log")
o.inputstyle = "apply"
o.write = function()
SYS.call("echo '' >/tmp/openclash.log")
end
return m, a

View File

@ -51,6 +51,7 @@ s.addremove = false
o = s:option(ListValue, "type", translate("Server Node Type"))
o:value("ss", translate("Shadowsocks"))
o:value("vmess", translate("Vmess"))
o:value("snell", translate("Snell"))
o:value("socks5", translate("Socks5"))
o:value("http", translate("HTTP(S)"))
@ -72,6 +73,10 @@ o.password = true
o.rmempty = false
o:depends("type", "ss")
o = s:option(Value, "psk", translate("Psk"))
o.rmempty = true
o:depends("type", "snell")
o = s:option(ListValue, "cipher", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
o.rmempty = true
@ -98,6 +103,14 @@ o:value("http")
o:value("websocket", translate("websocket (ws)"))
o:depends("type", "ss")
o = s:option(ListValue, "obfs_snell", translate("obfs-mode"))
o.rmempty = true
o.default = "none"
o:value("none")
o:value("tls")
o:value("http")
o:depends("type", "snell")
o = s:option(ListValue, "obfs_vmess", translate("obfs-mode"))
o.rmempty = true
o.default = "none"
@ -111,6 +124,8 @@ o.rmempty = true
o:depends("obfs", "tls")
o:depends("obfs", "http")
o:depends("obfs", "websocket")
o:depends("obfs_snell", "tls")
o:depends("obfs_snell", "http")
o = s:option(Value, "custom", translate("ws-headers"))
o.rmempty = true

View File

@ -1,9 +1,12 @@
-- Licensed to the public under the GNU General Public License v3.
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
font_red = [[<font color="red">]]
font_off = [[</font>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map(openclash, translate("Servers manage and Config create"))
m.pageaction = false
@ -11,9 +14,11 @@ m.pageaction = false
s = m:section(TypedSection, "openclash")
s.anonymous = true
o = s:option(Flag, "create_config", translate("Create Config"))
o = s:option(ListValue, "create_config", translate("Create Config"))
o.description = translate("Create Config By One-Click Only Need Proxys")
o.default = 0
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:option(ListValue, "rule_sources", translate("Choose Template For Create Config"))
o.description = translate("Use Other Rules To Create Config")
@ -22,64 +27,20 @@ o:value("lhie1", translate("lhie1 Rules"))
o:value("ConnersHua", translate("ConnersHua Rules"))
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
local t = {
{Commit, Apply}
}
o = s:option(ListValue, "servers_update", translate("Keep Settings"))
o.description = font_red .. bold_on .. translate("Only Update Servers Below When Subscription").. bold_off .. font_off
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
a = m:section(Table, t)
o = a:option(Button, "Commit")
o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
end
o = a:option(Button, "Apply")
o.inputtitle = translate("Apply Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
luci.sys.call("/usr/share/openclash/yml_groups_set.sh >/dev/null 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
end
local tt = {
{Load_Config, Delete_Severs, Delete_Groups}
}
b = m:section(Table, tt)
o = b:option(Button,"Load_Config")
o.inputtitle = translate("Load Config")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
luci.sys.call("sh /usr/share/openclash/yml_groups_get.sh 2>/dev/null &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
end
o = b:option(Button,"Delete_Severs")
o.inputtitle = translate("Delete Severs")
o.inputstyle = "reset"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:delete_all("openclash", "servers", function(s) return true end)
m.uci:commit("openclash")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
o = b:option(Button,"Delete_Groups")
o.inputtitle = translate("Delete Groups")
o.inputstyle = "reset"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:delete_all("openclash", "groups", function(s) return true end)
m.uci:commit("openclash")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
o = s:option(DynamicList, "new_servers_group", translate("New Servers Group"))
o.description = translate("Set The New Subscribe Server's Default Proxy Groups")
o.rmempty = true
o:depends("servers_update", 1)
m.uci:foreach("openclash", "groups",
function(s)
o:value(s.name)
end)
-- [[ Groups Manage ]]--
s = m:section(TypedSection, "groups", translate("Proxy Groups(No Need Set when Config Create)"))
@ -121,6 +82,14 @@ function s.create(...)
end
end
---- enable flag
o = s:option(Flag, "enabled", translate("Enable"))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
o = s:option(DummyValue, "type", translate("Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
@ -141,4 +110,74 @@ function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
local tt = {
{Delete_Unused_Servers, Delete_Severs, Delete_Groups}
}
b = m:section(Table, tt)
o = b:option(Button,"Delete_Unused_Servers")
o.inputtitle = translate("Delete Unused Servers")
o.inputstyle = "reset"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
luci.sys.call("sh /usr/share/openclash/cfg_unused_servers_del.sh 2>/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
o = b:option(Button,"Delete_Severs")
o.inputtitle = translate("Delete Severs")
o.inputstyle = "reset"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:delete_all("openclash", "servers", function(s) return true end)
m.uci:commit("openclash")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
o = b:option(Button,"Delete_Groups")
o.inputtitle = translate("Delete Groups")
o.inputstyle = "reset"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:delete_all("openclash", "groups", function(s) return true end)
m.uci:commit("openclash")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
local t = {
{Load_Config, Commit, Apply}
}
a = m:section(Table, t)
o = a:option(Button,"Load_Config")
o.inputtitle = translate("Load Config")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
luci.sys.call("sh /usr/share/openclash/yml_groups_get.sh 2>/dev/null &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
end
o = a:option(Button, "Commit")
o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
end
o = a:option(Button, "Apply")
o.inputtitle = translate("Apply Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:commit("openclash")
luci.sys.call("/usr/share/openclash/yml_groups_set.sh >/dev/null 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
end
return m

View File

@ -6,6 +6,12 @@ local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local uci = require "luci.model.uci".cursor()
font_green = [[<font color="green">]]
font_red = [[<font color="red">]]
font_off = [[</font>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map("openclash", translate("Global Settings(Will Modify The Config File Or Subscribe According To The Settings On This Page)"))
m.pageaction = false
s = m:section(TypedSection, "openclash")
@ -23,7 +29,7 @@ s:tab("version_update", translate("Version Update"))
---- General Settings
local cpu_model=SYS.exec("opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null")
o = s:taboption("settings", ListValue, "core_version", translate("Chose to Download"))
o.description = translate("CPU Model")..': '..cpu_model..', '..translate("Select Based On Your CPU Model For Core Update, Wrong Version Will Not Work")
o.description = translate("CPU Model")..': '..font_green..bold_on..cpu_model..bold_off..font_off..', '..translate("Select Based On Your CPU Model For Core Update, Wrong Version Will Not Work")
o:value("linux-386")
o:value("linux-amd64", translate("linux-amd64(x86-64)"))
o:value("linux-armv5")
@ -45,6 +51,22 @@ o:value("redir-host", translate("redir-host"))
o:value("fake-ip", translate("fake-ip"))
o.default = "redir-host"
o = s:taboption("settings", ListValue, "proxy_mode", translate("Proxy Mode"))
o.description = translate("Select Proxy Mode")
o:value("Rule", translate("Rule Mode"))
o:value("Global", translate("Global Mode"))
o:value("Direct", translate("Direct Mode"))
o.default = "Rule"
o = s:taboption("settings", ListValue, "log_level", translate("Log Level"))
o.description = translate("Select Core's Log Level")
o:value("info")
o:value("warning")
o:value("error")
o:value("debug")
o:value("silent")
o.default = "silent"
o = s:taboption("settings", Value, "proxy_port")
o.title = translate("Redir Port")
o.default = 7892
@ -74,25 +96,25 @@ o:value("1", translate("Enable"))
o.default = 1
o = s:taboption("dns", ListValue, "enable_custom_dns", translate("Custom DNS Setting"))
o.description = translate("Set OpenClash Upstream DNS Resolve Server")
o.description = font_red..bold_on..translate("Set OpenClash Upstream DNS Resolve Server")..bold_off..font_off
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default = 0
o = s:taboption("dns", ListValue, "ipv6_enable", translate("Enable ipv6 Resolve"))
o.description = translate("Force Enable to Resolve ipv6 DNS Requests")
o.description = font_red..bold_on..translate("Force Enable to Resolve ipv6 DNS Requests")..bold_off..font_off
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("dns", ListValue, "disable_masq_cache", translate("Disable Dnsmasq's DNS Cache"))
o.description = translate("Recommended Enabled For Avoiding Some Connection Errors")
o.description = translate("Recommended Enabled For Avoiding Some Connection Errors")..font_red..bold_on..translate("(Maybe Incompatible For Your Firmware)")..bold_off..font_off
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("dns", ListValue, "dns_advanced_setting", translate("Advanced Setting"))
o.description = translate("DNS Advanced Settings")
o.description = translate("DNS Advanced Settings")..font_red..bold_on..translate("(Please Don't Modify it at Will)")..bold_off..font_off
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
@ -210,6 +232,10 @@ o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("config_update", DynamicList, "servers_update_keyword", translate("Keyword Matching Setting"))
o.description = font_red..bold_on..translate("Only Keep Servers which Matching Keywords, eg: hk or tw&bgp")..bold_off..font_off
o.rmempty = true
o = s:taboption("config_update", ListValue, "config_update_week_time", translate("Update Time (Every Week)"))
o:value("*", translate("Every Day"))
o:value("1", translate("Every Monday"))
@ -253,7 +279,7 @@ o.write = function()
end
o = s:taboption("rules_update", ListValue, "other_rule_auto_update", translate("Auto Update"))
o.description = translate("Auto Update Other Rules")
o.description = font_red..bold_on..translate("Auto Update Other Rules")..bold_off..font_off
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
@ -322,12 +348,13 @@ o.write = function()
end
---- Dashboard Settings
local lan_ip=SYS.exec("uci get network.lan.ipaddr 2>/dev/null |tr -d '\n'")
o = s:taboption("dashboard", Value, "cn_port")
o.title = translate("Dashboard Port")
o.default = 9090
o.datatype = "port"
o.rmempty = false
o.description = translate("Dashboard Address Example: 192.168.1.1/openclash、192.168.1.1:9090/ui")
o.description = translate("Dashboard Address Example: ")..font_green..bold_on..lan_ip.."/openclash、"..lan_ip..':9090/ui'..bold_off..font_off
o = s:taboption("dashboard", Value, "dashboard_password")
o.title = translate("Dashboard Secret")
@ -339,7 +366,7 @@ core_update = s:taboption("version_update", DummyValue, "", nil)
core_update.template = "openclash/update"
-- [[ Edit Server ]] --
s = m:section(TypedSection, "dns_servers", translate("Add Custom DNS Servers"))
s = m:section(TypedSection, "dns_servers", translate("Add Custom DNS Servers")..translate("(Take Effect After Choose Above)"))
s.anonymous = true
s.addremove = true
s.sortable = false
@ -347,7 +374,7 @@ s.template = "cbi/tblsection"
s.rmempty = false
---- enable flag
o = s:option(Flag, "enabled", translate("Enable"), translate("(Enable or Disable)"))
o = s:option(Flag, "enabled", translate("Enable"), font_red..bold_on..translate("(Enable or Disable)")..bold_off..font_off)
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
@ -356,7 +383,7 @@ end
---- group
o = s:option(ListValue, "group", translate("DNS Server Group"))
o.description = translate("(NameServer Group Must Be Set)")
o.description = font_red..bold_on..translate("(NameServer Group Must Be Set)")..bold_off..font_off
o:value("nameserver", translate("NameServer"))
o:value("fallback", translate("FallBack"))
o.default = "nameserver"
@ -364,20 +391,20 @@ o.rempty = false
---- IP address
o = s:option(Value, "ip", translate("DNS Server Address"))
o.description = translate("(Do Not Add Type Ahead)")
o.description = font_red..bold_on..translate("(Do Not Add Type Ahead)")..bold_off..font_off
o.placeholder = translate("Not Null")
o.datatype = "or(host, string)"
o.rmempty = true
---- port
o = s:option(Value, "port", translate("DNS Server Port"))
o.description = translate("(Require When Use Non-Standard Port)")
o.description = font_red..bold_on..translate("(Require When Use Non-Standard Port)")..bold_off..font_off
o.datatype = "port"
o.rempty = true
---- type
o = s:option(ListValue, "type", translate("DNS Server Type"))
o.description = translate("(Communication protocol)")
o.description = font_red..bold_on..translate("(Communication protocol)")..bold_off..font_off
o:value("udp", translate("UDP"))
o:value("tcp", translate("TCP"))
o:value("tls", translate("TLS"))
@ -411,7 +438,7 @@ o = s:option(Value, "password", translate("Password"))
o.placeholder = translate("Not Null")
o.rmempty = true
s = m:section(TypedSection, "openclash", translate("Set Custom Rules, Will Add When Flag Turn on"))
s = m:section(TypedSection, "openclash", translate("Set Custom Rules"))
s.anonymous = true
custom_rules = s:option(Value, "custom_rules")
@ -424,7 +451,6 @@ function custom_rules.cfgvalue(self, section)
return NXFS.readfile("/etc/config/openclash_custom_rules.list") or ""
end
function custom_rules.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/config/openclash_custom_rules.list", value)

View File

@ -2,7 +2,11 @@
<fieldset class="cbi-section">
<table>
<tr><td width="100%" colspan="4" align="center" id="update_tip"><b> 注意:如更新失败可手动下载并上传,内核路径为:/etc/openclash </b></td></tr>
<tr><td width="100%" colspan="4">
<p align="center" id="update_tip">
<b> 注意:如更新失败可手动下载并上传,内核路径为:/etc/openclash </b>
</p>
</td></tr>
<tr><td width="25%"> 已选择编译版本 </td><td width="25%" align="left" id="CORE_VERSION"><%:Collecting data...%></td><td width="25%"> 上次检查更新时间 </td><td width="25%" align="left" id="CHECKTIME"><%:Collecting data...%></td></tr>
<tr><td width="25%"> 处理器架构PROC </td><td width="25%" align="left" id="CPU_MODEL"><%:Collecting data...%></td><td width="25%"> 处理器架构OPKG </td><td width="25%" align="left" id="CPU_MODEL2"><%:Collecting data...%></td></tr>
<tr><td width="25%"> 当前内核版本 </td><td width="25%" align="left" id="CORE_CV"><%:Collecting data...%></td><td width="25%"> 当前客户端版本 </td><td width="25%" align="left" id="OP_CV"><%:Collecting data...%></td></tr>

View File

@ -0,0 +1,23 @@
#!/bin/sh
. /lib/functions.sh
cfg_unused_servers_del()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
if [ "$enabled" = "1" ]; then
return
fi
#删除未选中节点
uci delete openclash."$section" 2>/dev/null
}
status=$(ps|grep -c /usr/share/openclash/cfg_unused_servers_del.sh)
[ "$status" -gt "3" ] && exit 0
config_load "openclash"
config_foreach cfg_unused_servers_del "servers"
uci commit openclash

View File

@ -10,6 +10,8 @@ BACKPACK_FILE="/etc/openclash/config.bak"
URL_TYPE=$(uci get openclash.config.config_update_url_type 2>/dev/null)
subscribe_url=$(uci get openclash.config.subscribe_url 2>/dev/null)
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_update_keyword=$(uci get openclash.config.servers_update_keyword 2>/dev/null)
config_dawnload()
{
@ -27,6 +29,23 @@ else
fi
}
config_cus_up()
{
if [ "$servers_update" -eq "1" ] || [ ! -z "$servers_update_keyword" ]; then
echo "配置文件替换成功,开始挑选节点..." >$START_LOG
uci set openclash.config.servers_if_update=1
uci commit openclash
/usr/share/openclash/yml_groups_get.sh
uci set openclash.config.servers_if_update=1
uci commit openclash
/usr/share/openclash/yml_groups_set.sh
else
echo "配置文件替换成功,开始启动 OpenClash ..." >$START_LOG
echo "${LOGTIME} Config Update Successful" >>$LOG_FILE
/etc/init.d/openclash restart 2>/dev/null
fi
}
config_su_check()
{
echo "配置文件下载成功,检查是否有更新..." >$START_LOG
@ -34,11 +53,9 @@ config_su_check()
cmp -s "$BACKPACK_FILE" /tmp/config.yaml
if [ "$?" -ne "0" ]; then
echo "配置文件有更新,开始替换..." >$START_LOG
mv /tmp/config.yaml "$CONFIG_FILE" 2>/dev/null\
&& cp "$CONFIG_FILE" "$BACKPACK_FILE"\
&& echo "配置文件替换成功,开始启动 OpenClash ..." >$START_LOG\
&& echo "${LOGTIME} Config Update Successful" >>$LOG_FILE\
&& /etc/init.d/openclash restart 2>/dev/null
mv /tmp/config.yaml "$CONFIG_FILE" 2>/dev/null
cp "$CONFIG_FILE" "$BACKPACK_FILE"
config_cus_up
else
echo "配置文件没有任何更新,停止继续操作..." >$START_LOG
rm -rf /tmp/config.yaml
@ -48,11 +65,9 @@ config_su_check()
fi
else
echo "配置文件下载成功,本地没有配置文件,开始创建 ..." >$START_LOG
mv /tmp/config.yaml "$CONFIG_FILE" 2>/dev/null\
&& cp "$CONFIG_FILE" "$BACKPACK_FILE"\
&& echo "配置文件创建成功,开始启动 OpenClash ..." >$START_LOG\
&& echo "${LOGTIME} Config Update Successful" >>$LOG_FILE\
&& /etc/init.d/openclash restart 2>/dev/null
mv /tmp/config.yaml "$CONFIG_FILE" 2>/dev/null
cp "$CONFIG_FILE" "$BACKPACK_FILE"
config_cus_up
fi
}

View File

@ -1,5 +1,6 @@
#!/bin/sh
CLASH="/etc/openclash/clash"
LOG_FILE="/tmp/openclash.log"
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
@ -11,31 +12,30 @@ do
if [ "$enable" -eq 1 ]; then
if ! pidof clash >/dev/null; then
echo "${LOGTIME} Watchdog: OpenClash Problem, Restart " >>/tmp/openclash.log
nohup /etc/init.d/openclash restart &
exit 0
echo "${LOGTIME} Watchdog: OpenClash Problem, Restart " >>$LOG_FILE
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
fi
fi
## Log File Size Manage:
LOGSIZE=`ls -l /tmp/openclash.log |awk '{print int($5/1024)}'`
if [ "$LOGSIZE" -gt 90 ]; then
echo "$LOGTIME Watchdog: Size Limit, Clean Up All Log Records." > /tmp/openclash.log
echo "$LOGTIME Watchdog: Size Limit, Clean Up All Log Records." >$LOG_FILE
fi
## 端口转发重启
zone_line=`iptables -t nat -nL PREROUTING --line-number |grep "zone" 2>/dev/null |awk '{print $1}' 2>/dev/null |awk 'END {print}'`
op_line=`iptables -t nat -nL PREROUTING --line-number |grep "openclash" 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1`
if [ "$zone_line" -gt "$op_line" ]; then
nohup /etc/init.d/openclash restart &
echo "$LOGTIME Watchdog: Restart For Enable Firewall Redirect." >> /tmp/openclash.log
exit 0
last_line=$(iptables -t nat -nL PREROUTING --line-number |awk '{print $1}' 2>/dev/null |awk 'END {print}' |sed -n '$p')
op_line=$(iptables -t nat -nL PREROUTING --line-number |grep "openclash" 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1)
if [ "$last_line" -ne "$op_line" ]; then
iptables -t nat -D PREROUTING -p tcp -j openclash
iptables -t nat -A PREROUTING -p tcp -j openclash
echo "$LOGTIME Watchdog: Restart For Enable Firewall Redirect." >>$LOG_FILE
fi
## DNS转发劫持
if [ "$enable_redirect_dns" != "0" ]; then
if [ -z "$(uci get dhcp.@dnsmasq[0].server 2>/dev/null |grep "$dns_port")" ] || [ ! -z "$(uci get dhcp.@dnsmasq[0].server 2>/dev/null |awk -F ' ' '{print $2}')" ]; then
echo "$LOGTIME Watchdog: Force Reset DNS Hijack." >> /tmp/openclash.log
echo "$LOGTIME Watchdog: Force Reset DNS Hijack." >>$LOG_FILE
uci del dhcp.@dnsmasq[-1].server >/dev/null 2>&1
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
uci delete dhcp.@dnsmasq[0].resolvfile

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,28 @@
/**
* TraceKit - Cross brower stack traces
*
* This was originally forked from github.com/occ/TraceKit, but has since been
* largely modified and is now maintained as part of Sentry JS SDK.
*
* NOTE: Last merge with upstream repository
* Jul 11,2018 - #f03357c
*
* https://github.com/csnover/TraceKit
* @license MIT
* @namespace TraceKit
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,56 @@
/** @license React v0.15.0
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/** @license React v16.6.1
* react-cache.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*!
* Adapted from jQuery UI core
*
* http://jqueryui.com
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/ui-core/
*/
/** @license React v16.9.0
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

View File

@ -1,9 +1,11 @@
/*! modern-normalize | MIT License | https://github.com/sindresorhus/modern-normalize */html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}:root{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}hr{height:0}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{padding:0}progress{vertical-align:initial}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
._1EnK5MMInH{width:100%;height:100%;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}._39z9L5I2ao{--color1:#ddd;--size:40px;width:var(--size);height:var(--size);margin:10px;background-color:var(--color1);border-radius:100%;-webkit-animation:_1DSWK2a-pe 1s ease-in-out infinite;animation:_1DSWK2a-pe 1s ease-in-out infinite}@-webkit-keyframes _1DSWK2a-pe{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes _1DSWK2a-pe{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}
/*! modern-normalize | MIT License | https://github.com/sindresorhus/modern-normalize */html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}:root{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}hr{height:0}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{padding:0}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
._2MMSFnbhST{stroke-dasharray:890;stroke-dashoffset:890;-webkit-animation:apL4DUAKgd 3s ease-in-out infinite normal forwards;animation:apL4DUAKgd 3s ease-in-out infinite normal forwards}@-webkit-keyframes apL4DUAKgd{0%{stroke-dashoffset:890}to{stroke-dashoffset:0}}@keyframes apL4DUAKgd{0%{stroke-dashoffset:890}to{stroke-dashoffset:0}}
._3oi0NFbeOm{opacity:.5;width:100%;height:100%;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}
._1rJPiLWN4s{position:fixed;top:0;bottom:0;left:0;right:0;overflow:hidden;padding:20px;background:var(--color-background);color:var(--color-text);text-align:center}._3h_IywJG1l{color:#2a477a;opacity:.6;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;padding:40px}.aXXDDfyTjE,._3h_IywJG1l{-webkit-box-align:center;align-items:center}.aXXDDfyTjE{display:-webkit-inline-box;display:inline-flex;color:var(--color-text-secondary)}.aXXDDfyTjE:active,.aXXDDfyTjE:hover{color:#387cec}.aXXDDfyTjE svg{margin-right:5px}
._30oJwXNik9{background:var(--color-bg-sidebar);position:relative}._1SsCcpJvxN{display:block}._2r8EkOI78X{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;padding:25px 0 15px;color:#2a477a;-webkit-transition:color .3s ease-in-out;transition:color .3s ease-in-out}@media (max-width:768px){._2r8EkOI78X{display:none}}._2r8EkOI78X:hover{-webkit-animation:_2KRqAfqV8c .3s ease-in-out 0s infinite alternate;animation:_2KRqAfqV8c .3s ease-in-out 0s infinite alternate}._2r8EkOI78X img{width:80px;height:80px}@-webkit-keyframes _2KRqAfqV8c{0%{color:#2a477a}to{color:#1f52ac}}@keyframes _2KRqAfqV8c{0%{color:#2a477a}to{color:#1f52ac}}@media (max-width:768px){._2vUQ0Hs_C5{display:-webkit-box;display:flex;-webkit-box-pack:justify;justify-content:space-between;overflow:scroll}}._8mEn9Wlw1n{color:var(--color-text);text-decoration:none;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;padding:8px 20px}@media (max-width:768px){._8mEn9Wlw1n{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}._8mEn9Wlw1n svg{color:var(--color-icon)}._1WyHmd6t6y{background:var(--color-sb-active-row-bg)}@media (max-width:768px){._1WyHmd6t6y{background:none;border-bottom:2px solid #387cec}}._2eMIYGbP9O{padding-left:14px}@media (max-width:768px){._2eMIYGbP9O{padding-left:0;padding-top:5px}}.nURY8qkFLS{--sz:50px;position:absolute;bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:var(--sz);height:var(--sz);padding:20px 0;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}@media (max-width:768px){.nURY8qkFLS{display:none}}.nURY8qkFLS svg{display:block;color:var(--color-icon)}
.SNYKRrv_2I{height:76px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.VG1cD2OYvg{padding:0 40px;text-align:left;margin:0}
._37kQcxVR4T{color:var(--color-text);display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}._1U3kUwas7v,.-Hr5Z5iYfF{padding-top:10px;padding-bottom:10px;width:200px}._1U3kUwas7v div:first-child,.-Hr5Z5iYfF div:first-child{color:var(--color-text-secondary)}._1U3kUwas7v div:nth-child(2),.-Hr5Z5iYfF div:nth-child(2){padding:10px 0 0;font-size:2em}.-Hr5Z5iYfF{padding-right:20px}._1U3kUwas7v{padding-left:20px}
._1EnK5MMInH{width:100%;height:100%;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}._39z9L5I2ao{--color1:#ddd;--size:40px;width:var(--size);height:var(--size);margin:10px;background-color:var(--color1);border-radius:100%;-webkit-animation:_1DSWK2a-pe 1s ease-in-out infinite;animation:_1DSWK2a-pe 1s ease-in-out infinite}@-webkit-keyframes _1DSWK2a-pe{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes _1DSWK2a-pe{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1);opacity:0}}
._2rN7aLQPCl{padding:10px 40px}
._1u5AP7XMF9{padding:0 40px 5px}._2zeyKJDdFH{position:relative;height:40px}._3DQ7SXxKRA{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:0;width:100%}._1f-XUgRxH1{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 15px 0 35px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._3PLtWxZwrd{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:10px}
._2tpN_G7FeO{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;flex-wrap:wrap;font-size:.9em;padding:10px}._3wuPHKqO5W{color:#eee;flex-shrink:0;text-align:center;width:66px;background:green;border-radius:5px;padding:3px 5px;margin:0 8px}.IwiVCclCSC{flex-shrink:0;color:#999;font-size:14px}._3I1beKAMFt{flex-shrink:0;display:-webkit-box;display:flex;font-family:Roboto Mono,Menlo,monospace;-webkit-box-align:center;align-items:center;padding:8px 0;width:100%;white-space:pre;overflow:auto}._2MDNI6JESq{margin:0;padding:0;color:var(--color-text)}._2MDNI6JESq li,._2MDNI6JESq li.even{background:var(--color-background)}._3KX1sKJ1QD{padding:10px 40px}._19_8g6kTIV{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;color:#2d2d30}._19_8g6kTIV div:nth-child(2){color:var(--color-text-secondary);font-size:1.4em;opacity:.6}._3ljFcrWmBC{opacity:.3}
@ -14,8 +16,8 @@ input.nJQwngxVo8[type=checkbox]{--white:#fff;--grey:#d3d3d3;--color-theme:#047af
._2id19fefQX{display:-webkit-box;display:flex;flex-wrap:wrap}._2QQQyNTKoG{-webkit-box-flex:0;flex-grow:0;margin-right:10px;margin-bottom:10px;cursor:pointer;border:2px solid transparent}.XJkW0wZSAx{border-color:#387cec}
._2OZZRrEL0J{padding:10px 40px 40px}._2OZZRrEL0J>div{width:360px}.lF_ZoyIdZN{padding:10px 40px 40px}.VduFBb2hWX{padding:0 40px}.VduFBb2hWX>div{border-top:1px dashed #373737}._2NQoBOQcGA{padding:16px 0}
.ctrHyq7uir{position:fixed;top:0;right:0;left:0;bottom:0;background:#444;z-index:1024}._17mHpKiOUD{outline:none;position:absolute;color:#ddd;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background:#444;padding:20px;border-radius:10px}
._1r-KsYFNaj{position:relative;padding:10px 0}._1r-KsYFNaj input{-webkit-appearance:none;background-color:initial;background-image:none;border:none;border-radius:0;border-bottom:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 8px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._1r-KsYFNaj input:focus{border-color:var(--color-focus-blue)}._1r-KsYFNaj label{position:absolute;left:8px;bottom:22px;-webkit-transition:-webkit-transform .15s ease-in-out;transition:-webkit-transform .15s ease-in-out;transition:transform .15s ease-in-out;transition:transform .15s ease-in-out,-webkit-transform .15s ease-in-out;-webkit-transform-origin:0 0;transform-origin:0 0}._1r-KsYFNaj input:focus+label,._1r-KsYFNaj label.Hn6h5kxOg7{-webkit-transform:scale(.75) translateY(-25px);transform:scale(.75) translateY(-25px)}._1r-KsYFNaj input:focus+label{color:var(--color-focus-blue)}
._1r-KsYFNaj{position:relative;padding:10px 0}._1r-KsYFNaj input{-webkit-appearance:none;background-color:transparent;background-image:none;border:none;border-radius:0;border-bottom:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 8px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._1r-KsYFNaj input:focus{border-color:var(--color-focus-blue)}._1r-KsYFNaj label{position:absolute;left:8px;bottom:22px;-webkit-transition:-webkit-transform .15s ease-in-out;transition:-webkit-transform .15s ease-in-out;transition:transform .15s ease-in-out;transition:transform .15s ease-in-out,-webkit-transform .15s ease-in-out;-webkit-transform-origin:0 0;transform-origin:0 0}._1r-KsYFNaj label.Hn6h5kxOg7{-webkit-transform:scale(.75) translateY(-25px);transform:scale(.75) translateY(-25px)}._1r-KsYFNaj input:focus+label{color:var(--color-focus-blue);-webkit-transform:scale(.75) translateY(-25px);transform:scale(.75) translateY(-25px)}
._3hz7LVhvUv:focus{outline:none}._3HF-KB9mgO{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}._3HF-KB9mgO ._3HzgPICn91{color:#2d2d30;opacity:.4;-webkit-transition:opacity .4s;transition:opacity .4s}._3HF-KB9mgO ._3HzgPICn91:hover{opacity:.7}._1wpZuvoD5I{padding:30px 0 10px}.L7jTy-EFJ2{display:-webkit-box;display:flex}.L7jTy-EFJ2 div{-webkit-box-flex:1;flex:1 1 auto}.L7jTy-EFJ2 div:nth-child(2){-webkit-box-flex:0;flex-grow:0;flex-basis:120px;margin-left:10px}._2fehqRU9GV{padding:30px 0 10px;display:-webkit-box;display:flex;-webkit-box-pack:end;justify-content:flex-end;-webkit-box-align:center;align-items:center}
._3D3ZNp4oBz{background:none;position:fixed;top:0;bottom:0;left:0;right:0;-webkit-transform:none;transform:none;padding:0;border-radius:0}.tgH3yv-xGR{position:absolute;top:10%;left:50%;-webkit-transform:translate(-50%);transform:translate(-50%);max-width:376px;margin:0 auto}._3MMuzHtwZL{background:#222}
@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local("RobotoMono-Regular"),url(https://cdn.jsdelivr.net/npm/@hsjs/fonts@0.0.1/robotomono/v5/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}.border-bottom,.border-left,.border-top{position:relative}.border-top:before{top:0}.border-bottom:after,.border-top:before{position:absolute;content:"";height:1px;width:100%;-webkit-transform:scaleY(.5) translateZ(0);transform:scaleY(.5) translateZ(0);left:0;right:0;background:#555}.border-bottom:after{bottom:0}.border-left:before{position:absolute;content:"";height:100%;width:1px;-webkit-transform:scaleX(.5) translateZ(0);transform:scaleX(.5) translateZ(0);top:0;bottom:0;background:#555;left:0}*,:after,:before{box-sizing:border-box}:root{--font-mono:"Roboto Mono",Menlo,monospace;--color-focus-blue:#1a73e8}body{font-family:Merriweather Sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,PingFang SC,Microsoft YaHei,;margin:0;padding:0}body,body.dark{--color-background:#202020;--color-text:#ddd;--color-text-secondary:#ccc;--color-bg-sidebar:#2d2d30;--color-sb-active-row-bg:#494b4e;--color-input-bg:#2d2d30;--color-input-border:#3f3f3f;--color-toggle-bg:#353535;--color-toggle-selected:#181818;--color-icon:#c7c7c7;--color-btn-bg:#232323;--color-btn-fg:#bebebe;--color-bg-proxy-selected:#303030}body.light{--color-background:#fbfbfb;--color-text:#222;--color-text-secondary:#646464;--color-bg-sidebar:#e7e7e7;--color-sb-active-row-bg:#d0d0d0;--color-input-bg:#fff;--color-input-border:silver;--color-toggle-bg:#fff;--color-toggle-selected:#d7d7d7;--color-icon:#5b5b5b;--color-btn-bg:#f4f4f4;--color-btn-fg:#101010;--color-bg-proxy-selected:#cfcfcf}
@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local("RobotoMono-Regular"),url(https://cdn.jsdelivr.net/npm/@hsjs/fonts@0.0.1/robotomono/v5/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}.border-bottom,.border-left,.border-top{position:relative}.border-top:before{position:absolute;content:"";height:1px;width:100%;-webkit-transform:scaleY(.5) translateZ(0);transform:scaleY(.5) translateZ(0);left:0;right:0;background:#555}.border-top:before{top:0}.border-bottom:after{position:absolute;content:"";height:1px;width:100%;-webkit-transform:scaleY(.5) translateZ(0);transform:scaleY(.5) translateZ(0);left:0;right:0;background:#555}.border-bottom:after{bottom:0}.border-left:before{position:absolute;content:"";height:100%;width:1px;-webkit-transform:scaleX(.5) translateZ(0);transform:scaleX(.5) translateZ(0);top:0;bottom:0;background:#555}.border-left:before{left:0}*,:after,:before{box-sizing:border-box}:root{--font-mono:"Roboto Mono",Menlo,monospace;--color-focus-blue:#1a73e8}body{font-family:Merriweather Sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,PingFang SC,Microsoft YaHei,;margin:0;padding:0}body,body.dark{--color-background:#202020;--color-text:#ddd;--color-text-secondary:#ccc;--color-bg-sidebar:#2d2d30;--color-sb-active-row-bg:#494b4e;--color-input-bg:#2d2d30;--color-input-border:#3f3f3f;--color-toggle-bg:#353535;--color-toggle-selected:#181818;--color-icon:#c7c7c7;--color-btn-bg:#232323;--color-btn-fg:#bebebe;--color-bg-proxy-selected:#303030}body.light{--color-background:#fbfbfb;--color-text:#222;--color-text-secondary:#646464;--color-bg-sidebar:#e7e7e7;--color-sb-active-row-bg:#d0d0d0;--color-input-bg:#fff;--color-input-border:silver;--color-toggle-bg:#fff;--color-toggle-selected:#d7d7d7;--color-icon:#5b5b5b;--color-btn-bg:#f4f4f4;--color-btn-fg:#101010;--color-bg-proxy-selected:#cfcfcf}
._35EMVy62Je{display:-webkit-box;display:flex;background:var(--color-background);color:var(--color-text);min-height:300px;height:100vh}@media (max-width:768px){._35EMVy62Je{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}.AwL8oIubvP{-webkit-box-flex:1;flex-grow:1;overflow:auto}

File diff suppressed because one or more lines are too long

View File

@ -11,8 +11,9 @@
<meta name="description" content="Yet Another Clash Dashboard">
<meta name="theme-color" content="#202020">
<title>yacd - 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">
<link href="https://fonts.loli.net/css?family=Merriweather+Sans:400,700|Roboto+Mono&display=swap" rel="stylesheet">
<!-- <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">
<meta property="og:site_name" content="yacd">
<meta property="og:type" content="object">
@ -21,20 +22,20 @@
<meta property="og:description" content="Yet Another Clash Dashboard">
<link href="app.26d9ccafb71b5570736d.css" rel="stylesheet">
<link href="app.bf41a6a17ffe767d6d0d.css" rel="stylesheet">
<body>
<div id="app"></div>
<script src="runtime~app.271c0a96fd4712ee7d81.js" type="text/javascript"></script>
<script src="runtime~app.3344d20adc4badf5ec11.js" type="text/javascript"></script>
<script src="core-js~app.2bafdc22a68f45914da2.js" type="text/javascript"></script>
<script src="core-js~app.7659b79c030a23768789.js" type="text/javascript"></script>
<script src="react~app.69171d2b5aa5144a2a86.js" type="text/javascript"></script>
<script src="react~app.1602024e7a2b96f0ab5b.js" type="text/javascript"></script>
<script src="app.326175ee257418d645a5.js" type="text/javascript"></script>
<script src="app.32ad9fdf94660a7ebd0b.js" type="text/javascript"></script>
</body>

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{D46e:function(e,a,t){e.exports={header:"_3PCSxT0l14",list:"_1yYRIyvlRd",proxy:"_1OcDlvlM5R",proxySelectable:"_3oAxPKtZFv"}},FWZb:function(e,a,t){e.exports={proxy:"NpfXwxWAxo",now:"_2zD7drviYH",proxyType:"_1rVl-Kdmss",proxyName:"_3kdi5nima5",proxyLatencyWrap:"_12JM32OJa5"}},L5YO:function(e,a,t){e.exports={body:"pWc1mov26e",group:"_1myfcMimT9",fabgrp:"_1khaX45NQe"}},RbL9:function(e,a,t){e.exports={proxyLatency:"_2V-RqIAl7n"}},wyCT:function(e,a,t){"use strict";t.r(a);var n=t("o0o1"),r=t.n(n),c=t("HaE+"),o=t("q1tI"),l=t.n(o),s=t("u4Dv"),p=t("DKqX"),m=t("rePB"),i=t("17x9"),u=t.n(i),y=t("TSYQ"),b=t.n(y),x=t("RbL9"),d=t.n(x),f={good:"#67C23A",normal:"#E6A23C",bad:"#F56C6C",na:"#909399"};function v(e){var a=e.latency,t=a.number,n=a.error,r=Object(o.useMemo)((function(){return function(e,a){return""!==a?f.na:e<200?f.good:e<400?f.normal:f.bad}(t,n)}),[t,n]);return l.a.createElement("span",{className:d.a.proxyLatency,style:{color:r}},""!==n?l.a.createElement("span",null,n):l.a.createElement("span",null,t," ms"))}v.propTypes={latency:u.a.shape({number:u.a.number,error:u.a.string})};var E=t("FWZb"),O=t.n(E),w=t("EQlU"),N=function(e){return{proxies:Object(w.d)(e),delay:Object(w.c)(e)}};function j(e){var a=e.now,t=e.name,n=Object(s.c)(N),r=n.proxies,c=n.delay[t],o=r[t];return l.a.createElement("div",{className:b()(O.a.proxy,Object(m.a)({},O.a.now,a))},l.a.createElement("div",{className:O.a.proxyName},t),l.a.createElement("div",{className:O.a.proxyType,style:{opacity:a?.6:.2}},o.type),l.a.createElement("div",{className:O.a.proxyLatencyWrap},c?l.a.createElement(v,{latency:c}):null))}j.propTypes={now:u.a.bool,name:u.a.string};var g=j,h=t("D46e"),_=t.n(h),T=function(e){return{proxies:Object(w.d)(e)}};function k(e){var a=e.name,t=Object(s.c)(T).proxies,n=Object(s.b)({switchProxy:w.g}),r=t[a],c=r.all;return l.a.createElement("div",{className:_.a.group},l.a.createElement("div",{className:_.a.header},l.a.createElement("h2",null,l.a.createElement("span",null,a),l.a.createElement("span",null,r.type))),l.a.createElement("div",{className:_.a.list},c.map((function(e){var t="Selector"===r.type,c=b()(_.a.proxy,Object(m.a)({},_.a.proxySelectable,t));return l.a.createElement("div",{className:c,key:e,onClick:function(){t&&n.switchProxy(a,e)}},l.a.createElement(g,{isSelectable:t,name:e,now:e===r.now}))}))))}k.propTypes={name:u.a.string};var L=t("5Wrh"),C=t("L5YO"),D=t.n(C);t.d(a,"default",(function(){return W}));var P=function(e){return{proxies:Object(w.d)(e),groupNames:Object(w.e)(e)}},A={fetchProxies:w.b,requestDelayAll:w.f};function W(){var e=Object(s.b)(A),a=e.fetchProxies,t=e.requestDelayAll;Object(o.useEffect)((function(){Object(c.a)(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a();case 2:case"end":return e.stop()}}),e)})))()}),[a,t]);var n=Object(s.c)(P).groupNames;return l.a.createElement(l.a.Fragment,null,l.a.createElement(p.a,{title:"Proxies"}),l.a.createElement("div",{className:D.a.body},l.a.createElement("div",{className:D.a.fabgrp},l.a.createElement(L.a,{label:"Test Latency",onClick:t})),n.map((function(e){return l.a.createElement("div",{className:D.a.group,key:e},l.a.createElement(k,{name:e}))}))))}}}]);

View File

@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{D46e:function(e,a,t){e.exports={header:"_3PCSxT0l14",list:"_1yYRIyvlRd",proxy:"_1OcDlvlM5R",proxySelectable:"_3oAxPKtZFv"}},FWZb:function(e,a,t){e.exports={proxy:"NpfXwxWAxo",now:"_2zD7drviYH",proxyType:"_1rVl-Kdmss",proxyName:"_3kdi5nima5",proxyLatencyWrap:"_12JM32OJa5"}},L5YO:function(e,a,t){e.exports={body:"pWc1mov26e",group:"_1myfcMimT9",fabgrp:"_1khaX45NQe"}},RbL9:function(e,a,t){e.exports={proxyLatency:"_2V-RqIAl7n"}},wyCT:function(e,a,t){"use strict";t.r(a);var n=t("o0o1"),r=t.n(n),c=t("HaE+"),o=t("q1tI"),l=t.n(o),s=t("u4Dv"),p=t("DKqX"),m=t("rePB"),i=t("17x9"),u=t.n(i),y=t("TSYQ"),b=t.n(y),x=t("RbL9"),d=t.n(x),f={good:"#67C23A",normal:"#E6A23C",bad:"#F56C6C",na:"#909399"};function v(e){var a=e.latency,t=a.number,n=a.error,r=Object(o.useMemo)(function(){return function(e,a){return""!==a?f.na:e<200?f.good:e<400?f.normal:f.bad}(t,n)},[t,n]);return l.a.createElement("span",{className:d.a.proxyLatency,style:{color:r}},""!==n?l.a.createElement("span",null,n):l.a.createElement("span",null,t," ms"))}v.propTypes={latency:u.a.shape({number:u.a.number,error:u.a.string})};var E=t("FWZb"),O=t.n(E),w=t("EQlU"),N=function(e){return{proxies:Object(w.d)(e),delay:Object(w.c)(e)}};function j(e){var a=e.now,t=e.name,n=Object(s.c)(N),r=n.proxies,c=n.delay[t],o=r[t];return l.a.createElement("div",{className:b()(O.a.proxy,Object(m.a)({},O.a.now,a))},l.a.createElement("div",{className:O.a.proxyName},t),l.a.createElement("div",{className:O.a.proxyType,style:{opacity:a?.6:.2}},o.type),l.a.createElement("div",{className:O.a.proxyLatencyWrap},c?l.a.createElement(v,{latency:c}):null))}j.propTypes={now:u.a.bool,name:u.a.string};var g=j,h=t("D46e"),_=t.n(h),T=function(e){return{proxies:Object(w.d)(e)}};function k(e){var a=e.name,t=Object(s.c)(T).proxies,n=Object(s.b)({switchProxy:w.g}),r=t[a],c=r.all;return l.a.createElement("div",{className:_.a.group},l.a.createElement("div",{className:_.a.header},l.a.createElement("h2",null,l.a.createElement("span",null,a),l.a.createElement("span",null,r.type))),l.a.createElement("div",{className:_.a.list},c.map(function(e){var t="Selector"===r.type,c=b()(_.a.proxy,Object(m.a)({},_.a.proxySelectable,t));return l.a.createElement("div",{className:c,key:e,onClick:function(){t&&n.switchProxy(a,e)}},l.a.createElement(g,{isSelectable:t,name:e,now:e===r.now}))})))}k.propTypes={name:u.a.string};var L=t("5Wrh"),C=t("L5YO"),D=t.n(C);t.d(a,"default",function(){return W});var P=function(e){return{proxies:Object(w.d)(e),groupNames:Object(w.e)(e)}},A={fetchProxies:w.b,requestDelayAll:w.f};function W(){var e=Object(s.b)(A),a=e.fetchProxies,t=e.requestDelayAll;Object(o.useEffect)(function(){Object(c.a)(r.a.mark(function e(){return r.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a();case 2:case"end":return e.stop()}},e)}))()},[a,t]);var n=Object(s.c)(P).groupNames;return l.a.createElement(l.a.Fragment,null,l.a.createElement(p.a,{title:"Proxies"}),l.a.createElement("div",{className:D.a.body},l.a.createElement("div",{className:D.a.fabgrp},l.a.createElement(L.a,{label:"Test Latency",onClick:t})),n.map(function(e){return l.a.createElement("div",{className:D.a.group,key:e},l.a.createElement(k,{name:e}))})))}}}]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
/** @license React v16.9.0
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.10.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{BVyM:function(e,t,a){"use strict";a.r(t);var n=a("ODXe"),r=a("q1tI"),c=a.n(r),l=a("u4Dv"),i=a("5Wrh"),u=a("iR1w"),s=a("DKqX"),o=a("17x9"),m=a.n(o),f=a("xrux"),d=a.n(f),p={_default:"#59caf9",DIRECT:"#f5bc41",REJECT:"#cb3166"};function v(e){var t=e.type,a=e.payload,n=e.proxy,r=e.id,l=function(e){var t=e.proxy,a=p._default;return p[t]&&(a=p[t]),{color:a}}({proxy:n});return c.a.createElement("div",{className:d.a.rule},c.a.createElement("div",{className:d.a.left},r),c.a.createElement("div",null,c.a.createElement("div",{className:d.a.b},a),c.a.createElement("div",{className:d.a.a},c.a.createElement("div",{className:d.a.type},t),c.a.createElement("div",{style:l},n))))}v.propTypes={id:m.a.number,type:m.a.string,payload:m.a.string,proxy:m.a.string};var b=v,E=a("II4a"),h=a("Tvb5"),y={updateSearchText:h.f},x=Object(E.a)({mapStateToProps:function(e){return{searchText:Object(h.e)(e)}},actions:y}),O=a("Kv4h"),j=a("mlDh"),w=a.n(j);a.d(t,"default",function(){return _});var N=30,R=function(e){return{rules:Object(h.d)(e)}},g={fetchRules:h.b,fetchRulesOnce:h.c};function T(e,t){return t[e].id}var D=Object(r.memo)(function(e){var t=e.index,a=e.style,n=e.data[t];return c.a.createElement("div",{style:a},c.a.createElement(b,n))},u.b);function _(){var e=Object(l.b)(g),t=e.fetchRulesOnce,a=e.fetchRules,o=Object(l.c)(R).rules;Object(r.useEffect)(function(){t()},[t]);var m=Object(O.a)(),f=Object(n.a)(m,2),d=f[0],p=f[1];return c.a.createElement("div",null,c.a.createElement(s.a,{title:"Rules"}),c.a.createElement(x,null),c.a.createElement("div",{ref:d,style:{paddingBottom:N}},c.a.createElement(u.a,{height:p-N,width:"100%",itemCount:o.length,itemSize:80,itemData:o,itemKey:T},D)),c.a.createElement("div",{className:w.a.fabgrp},c.a.createElement(i.a,{label:"Refresh",onClick:a})))}},mlDh:function(e,t,a){e.exports={fabgrp:"_2Tux7NhweE"}},xrux:function(e,t,a){e.exports={rule:"_3eSLieOhVX",left:"_2n1pW09UvV",a:"t1XJIwvW7A",b:"_1fNf8kj0HA",type:"_3yJmN0tON0"}}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{BVyM:function(e,t,a){"use strict";a.r(t);var n=a("ODXe"),r=a("q1tI"),c=a.n(r),l=a("u4Dv"),i=a("5Wrh"),u=a("iR1w"),s=a("DKqX"),o=a("17x9"),m=a.n(o),f=a("xrux"),d=a.n(f),p={_default:"#59caf9",DIRECT:"#f5bc41",REJECT:"#cb3166"};function v(e){var t=e.type,a=e.payload,n=e.proxy,r=e.id,l=function(e){var t=e.proxy,a=p._default;return p[t]&&(a=p[t]),{color:a}}({proxy:n});return c.a.createElement("div",{className:d.a.rule},c.a.createElement("div",{className:d.a.left},r),c.a.createElement("div",null,c.a.createElement("div",{className:d.a.b},a),c.a.createElement("div",{className:d.a.a},c.a.createElement("div",{className:d.a.type},t),c.a.createElement("div",{style:l},n))))}v.propTypes={id:m.a.number,type:m.a.string,payload:m.a.string,proxy:m.a.string};var b=v,E=a("II4a"),h=a("Tvb5"),y={updateSearchText:h.f},x=Object(E.a)({mapStateToProps:function(e){return{searchText:Object(h.e)(e)}},actions:y}),O=a("Kv4h"),j=a("mlDh"),w=a.n(j);a.d(t,"default",(function(){return _}));var N=30,R=function(e){return{rules:Object(h.d)(e)}},g={fetchRules:h.b,fetchRulesOnce:h.c};function T(e,t){return t[e].id}var D=Object(r.memo)((function(e){var t=e.index,a=e.style,n=e.data[t];return c.a.createElement("div",{style:a},c.a.createElement(b,n))}),u.b);function _(){var e=Object(l.b)(g),t=e.fetchRulesOnce,a=e.fetchRules,o=Object(l.c)(R).rules;Object(r.useEffect)((function(){t()}),[t]);var m=Object(O.a)(),f=Object(n.a)(m,2),d=f[0],p=f[1];return c.a.createElement("div",null,c.a.createElement(s.a,{title:"Rules"}),c.a.createElement(x,null),c.a.createElement("div",{ref:d,style:{paddingBottom:N}},c.a.createElement(u.a,{height:p-N,width:"100%",itemCount:o.length,itemSize:80,itemData:o,itemKey:T},D)),c.a.createElement("div",{className:w.a.fabgrp},c.a.createElement(i.a,{label:"Refresh",onClick:a})))}},mlDh:function(e,t,a){e.exports={fabgrp:"_2Tux7NhweE"}},xrux:function(e,t,a){e.exports={rule:"_3eSLieOhVX",left:"_2n1pW09UvV",a:"t1XJIwvW7A",b:"_1fNf8kj0HA",type:"_3yJmN0tON0"}}}]);

View File

@ -1 +0,0 @@
!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

@ -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:"b045bfc35199c9dc9ad0",4:"89e389750a9ffc56d742",6:"750d5adb127502ee8388",7:"df18b58178431267446e"}[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:"908ac041647c8aad5e7e",4:"c43c01e181bf87a9d773",6:"c8309e7a80c138b00882",7:"2fd16a36543931e2757e"}[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()}([]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/*!
* Chart.js v2.8.0
* https://www.chartjs.org
* (c) 2019 Chart.js Contributors
* Released under the MIT License
*/

View File

@ -60,19 +60,19 @@
fi
fi
if [ -z "$(grep '^mode:' "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}mode:" "$7")" ]; then
sed -i "s/^ \{0,\}mode:/mode:/" "$7"
if [ -z "$(grep '^mode: $13' "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}^mode:" "$7")" ]; then
sed -i "/^ \{0,\}^mode:/c\^mode: ${13}" "$7"
else
sed -i "/^dns:/i\mode: Rule" "$7"
sed -i "/^dns:/i\^mode: ${13}" "$7"
fi
fi
if [ -z "$(grep '^log-level:' "$7")" ]; then
if [ -z "$(grep '^log-level: $12' "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}log-level:" "$7")" ]; then
sed -i "s/^ \{0,\}log-level:/log-level:/" "$7"
sed -i "/^ \{0,\}log-level:/c\log-level: ${12}" "$7"
else
sed -i "/^dns:/i\log-level: silent" "$7"
sed -i "/^dns:/i\log-level: ${12}" "$7"
fi
fi

View File

@ -4,6 +4,9 @@ status=$(ps|grep -c /usr/share/openclash/yml_groups_get.sh)
START_LOG="/tmp/openclash_start.log"
CFG_FILE="/etc/config/openclash"
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
rulesource=$(uci get openclash.config.rule_source 2>/dev/null)
if [ ! -f "/etc/openclash/config.yml" ] && [ ! -f "/etc/openclash/config.yaml" ]; then
exit 0
@ -15,19 +18,25 @@ echo "开始更新策略组配置..." >$START_LOG
/usr/share/openclash/yml_groups_name_get.sh
[ ! -z "$(grep "读取错误" /tmp/Proxy_Group)"] && {
echo "读取错误,配置文件异常!" >$START_LOG
uci commit openclash
sleep 5
echo "" >$START_LOG
exit 0
}
awk '/Proxy Group:/,/Rule:/{print}' /etc/openclash/config.yaml 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_group.yaml 2>&1
#删除旧配置
while ( [ ! -z "$(grep "config groups" "$CFG_FILE")" ] || [ ! -z "$(grep "config servers" "$CFG_FILE")" ] )
echo "正在删除旧节点..." >$START_LOG
if [ "$servers_update" -ne "1" ] || [ "$servers_if_update" != "1" ] || [ -z "$(grep "config groups" "$CFG_FILE")" ]; then
while ( [ ! -z "$(grep "config groups" "$CFG_FILE")" ] || [ ! -z "$(grep "config servers" "$CFG_FILE")" ] )
do
uci delete openclash.@groups[0] 2>/dev/null
uci delete openclash.@servers[0] 2>/dev/null
uci commit openclash
done
done
else
/usr/share/openclash/yml_proxys_get.sh
exit 0
fi
count=1
file_count=1

View File

@ -12,13 +12,21 @@ yml_servers_add()
{
local section="$1"
config_get "name" "$section" "name" ""
config_list_foreach "$section" "groups" set_groups "$name" "$2"
config_get_bool "enabled" "$section" "enabled" "1"
if [ "$enabled" = "0" ]; then
return
else
config_get "name" "$section" "name" ""
config_list_foreach "$section" "groups" set_groups "$name" "$2"
fi
}
set_groups()
{
if [ -z "$1" ]; then
return
fi
if [ "$1" = "$3" ]; then
echo " - \"${2}\"" >>$GROUP_FILE
@ -28,7 +36,10 @@ set_groups()
set_other_groups()
{
if [ -z "$1" ]; then
return
fi
echo " - ${1}" >>$GROUP_FILE
}
@ -66,7 +77,7 @@ yml_groups_set()
#名字变化时处理规则部分
if [ "$name" != "$old_name" ]; then
sed -i "s/,${old_name}/,${name}#d/g" $CONFIG_FILE 2>/dev/null
sed -i "s/:${old_name}$/:${name}#d/g" $CONFIG_FILE 2>/dev/null #修改自定义规则分组对应标签
sed -i "s/:${old_name}$/:${name}#d/g" $CONFIG_FILE 2>/dev/null #修改第三方规则分组对应标签
sed -i "s/\'${old_name}\'/\'${name}\'/g" $CFG_FILE 2>/dev/null
config_load "openclash"
fi
@ -83,20 +94,22 @@ yml_groups_set()
}
create_config=$(uci get openclash.config.create_config 2>/dev/null)
if [ "$create_config" = "0" ]; then
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ]; then
/usr/share/openclash/yml_groups_name_get.sh
if [ -z "$(grep "^ \{0,\}Proxy:" /etc/openclash/config.yaml)" ] || [ -z "$(grep "^ \{0,\}Rule:" /etc/openclash/config.yaml)" ]; then
echo "配置文件信息读取失败,无法进行修改,请选择一键创建配置文件..." >$START_LOG
uci commit openclash
sleep 5
echo "" >$START_LOG
exit 0
else
echo "开始更新配置文件策略组信息..." >$START_LOG
echo "开始写入配置文件策略组信息..." >$START_LOG
config_load "openclash"
config_foreach yml_groups_set "groups"
sed -i "s/#d//g" $CONFIG_FILE 2>/dev/null
echo "Rule:" >>$GROUP_FILE
echo "配置文件策略组更新完成!" >$START_LOG
echo "配置文件策略组写入完成!" >$START_LOG
fi
fi
/usr/share/openclash/yml_proxys_set.sh >/dev/null 2>&1

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash /etc/rc.common
status=$(ps|grep -c /usr/share/openclash/yml_proxys_get.sh)
[ "$status" -gt "3" ] && exit 0
@ -11,21 +11,85 @@ elif [ ! -f "/etc/openclash/config.yaml" ] && [ "$(ls -l /etc/openclash/config.y
fi
echo "开始更新服务器节点配置..." >$START_LOG
awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{print}' /etc/openclash/config.yaml 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_proxy.yaml 2>&1
CONFIG_FILE="/etc/openclash/config.yaml"
CFG_FILE="/etc/config/openclash"
server_file="/tmp/yaml_proxy.yaml"
single_server="/tmp/servers.yaml"
match_servers="/tmp/match_servers.list"
group_num=$(grep -c "name:" /tmp/yaml_group.yaml)
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_update_keyword=$(uci get openclash.config.servers_update_keyword 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
new_servers_group=$(uci get openclash.config.new_servers_group 2>/dev/null)
count=1
line=$(sed -n '/^ \{0,\}-/=' $server_file)
num=$(grep -c "^ \{0,\}-" $server_file)
cfg_get()
{
echo "$(grep "$1" $single_server 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null)"
echo "$(grep "$1" "$2" 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null)"
}
yml_servers_name_get()
{
local section="$1"
config_get "name" "$section" "name" ""
echo "$server_num"."$name" >>"$match_servers"
server_num=$(( $server_num + 1 ))
}
server_key_match()
{
if [ "$match" = "true" ] || [ ! -z "$(echo "$1" |grep "^ \{0,\}$")" ] || [ ! -z "$(echo "$1" |grep "^\t\{0,\}$")" ]; then
return
fi
if [ ! -z "$(echo "$1" |grep "&")" ]; then
key_word=$(echo "$1" |sed 's/&/ /g')
match=0
matchs=0
for k in $key_word
do
if [ -z "$k" ]; then
continue
fi
if [ ! -z "$(echo "$2" |grep -i "$k")" ]; then
match=$(( $match + 1 ))
fi
matchs=$(( $matchs + 1 ))
done
if [ "$match" = "$matchs" ]; then
match="true"
else
match="false"
fi
else
if [ ! -z "$(echo "$2" |grep -i "$1")" ]; then
match="true"
fi
fi
}
cfg_new_servers_groups_get()
{
if [ -z "$1" ]; then
return
fi
${uci_add}groups="${1}"
}
if [ "$servers_update" -eq "1" ] && [ "$servers_if_update" = "1" ]; then
echo "" >"$match_servers"
server_num=0
config_load "openclash"
config_foreach yml_servers_name_get "servers"
fi
for n in $line
do
@ -39,118 +103,225 @@ do
else
endLine=$(expr $(echo "$line" | sed -n "${count}p") - 1)
fi
sed -n "${startLine},${endLine}p" $server_file >$single_server
startLine=$(expr "$endLine" + 1)
#type
server_type="$(cfg_get "type:")"
#name
server_name="$(cfg_get "name:")"
server_name="$(cfg_get "name:" "$single_server")"
#节点存在时获取节点编号
if [ "$servers_if_update" = "1" ]; then
server_num=$(grep "$server_name$" "$match_servers" |awk -F '.' '{print $1}')
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
sed -i "/${server_name}$/c\#match#" "$match_servers" 2>/dev/null
elif [ ! -z "$servers_update_keyword" ]; then #匹配关键字订阅节点
match="false"
config_load "openclash"
config_list_foreach "config" "servers_update_keyword" server_key_match "$server_name"
if [ "$match" = "false" ]; then
echo "跳过【$server_name】服务器节点..." >$START_LOG
continue
fi
elif [ "$servers_update" -eq "1" ]; then
echo "跳过【$server_name】服务器节点..." >$START_LOG
continue
fi
fi
#type
server_type="$(cfg_get "type:" "$single_server")"
#server
server="$(cfg_get "server:")"
server="$(cfg_get "server:" "$single_server")"
#port
port="$(cfg_get "port:")"
port="$(cfg_get "port:" "$single_server")"
#cipher
cipher="$(cfg_get "cipher:")"
cipher="$(cfg_get "cipher:" "$single_server")"
#password
password="$(cfg_get "password:")"
password="$(cfg_get "password:" "$single_server")"
#udp
udp="$(cfg_get "udp:")"
udp="$(cfg_get "udp:" "$single_server")"
#plugin:
plugin="$(cfg_get "plugin:")"
plugin="$(cfg_get "plugin:" "$single_server")"
#plugin-opts:
plugin_opts="$(cfg_get "plugin-opts:")"
plugin_opts="$(cfg_get "plugin-opts:" "$single_server")"
#obfs:
obfs="$(cfg_get "obfs:")"
obfs="$(cfg_get "obfs:" "$single_server")"
#psk:
obfs="$(cfg_get "psk:" "$single_server")"
#obfs-host:
obfs_host="$(cfg_get "obfs-host:")"
obfs_host="$(cfg_get "obfs-host:" "$single_server")"
#mode:
mode="$(cfg_get "mode:")"
mode="$(cfg_get "mode:" "$single_server")"
#tls:
tls="$(cfg_get "tls:")"
tls="$(cfg_get "tls:" "$single_server")"
#skip-cert-verify:
verify="$(cfg_get "skip-cert-verify:")"
verify="$(cfg_get "skip-cert-verify:" "$single_server")"
#mux:
mux="$(cfg_get "mux:")"
mux="$(cfg_get "mux:" "$single_server")"
#host:
host="$(cfg_get "host:")"
host="$(cfg_get "host:" "$single_server")"
#Host:
Host="$(cfg_get "Host:")"
Host="$(cfg_get "Host:" "$single_server")"
#path:
path="$(cfg_get "path:")"
path="$(cfg_get "path:" "$single_server")"
#ws-path:
ws_path="$(cfg_get "ws-path:")"
ws_path="$(cfg_get "ws-path:" "$single_server")"
#headers_custom:
headers="$(cfg_get "custom:")"
headers="$(cfg_get "custom:" "$single_server")"
#uuid:
uuid="$(cfg_get "uuid:")"
uuid="$(cfg_get "uuid:" "$single_server")"
#alterId:
alterId="$(cfg_get "alterId:")"
alterId="$(cfg_get "alterId:" "$single_server")"
#network
network="$(cfg_get "network:")"
network="$(cfg_get "network:" "$single_server")"
#username
username="$(cfg_get "username:")"
username="$(cfg_get "username:" "$single_server")"
echo "正在读取【$server_type】-【$server_name】服务器节点配置..." >$START_LOG
name=openclash
uci_name_tmp=$(uci add $name servers)
uci_set="uci -q set $name.$uci_name_tmp."
uci_add="uci -q add_list $name.$uci_name_tmp."
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
#更新已有节点
uci_set="uci -q set openclash.@servers["$server_num"]."
${uci_set}manual="0"
${uci_set}type="$server_type" 2>/dev/null
${uci_set}server="$server"
${uci_set}port="$port"
if [ "$server_type" = "vmess" ]; then
${uci_set}securitys="$cipher"
else
${uci_set}cipher="$cipher"
fi
${uci_set}udp="$udp"
${uci_set}obfs="$obfs"
${uci_set}host="$obfs_host"
${uci_set}obfs_snell="$mode"
[ -z "$obfs" ] && [ "$server_type" != "snell" ] && ${uci_set}obfs="$mode"
[ -z "$mode" ] && [ "$server_type" != "snell" ] && ${uci_set}obfs="none"
[ -z "$mode" ] && ${uci_set}obfs_snell="none"
[ -z "$mode" ] && [ ! -z "$network" ] && ${uci_set}obfs_vmess="websocket"
[ -z "$mode" ] && [ -z "$network" ] && ${uci_set}obfs_vmess="none"
[ -z "$obfs_host" ] && ${uci_set}host="$host"
${uci_set}psk="$psk"
${uci_set}tls="$tls"
${uci_set}skip_cert_verify="$verify"
${uci_set}path="$path"
[ -z "$path" ] && ${uci_set}path="$ws_path"
${uci_set}mux="$mux"
${uci_set}custom="$headers"
[ -z "$headers" ] && ${uci_set}custom="$Host"
${uci_set}name="$server_name"
${uci_set}type="$server_type"
${uci_set}server="$server"
${uci_set}port="$port"
if [ "$server_type" = "vmess" ]; then
${uci_set}securitys="$cipher"
if [ "$server_type" = "vmess" ]; then
#v2ray
${uci_set}alterId="$alterId"
${uci_set}uuid="$uuid"
fi
if [ "$server_type" = "socks5" ] || [ "$server_type" = "http" ]; then
${uci_set}auth_name="$username"
${uci_set}auth_pass="$password"
else
${uci_set}password="$password"
fi
else
${uci_set}cipher="$cipher"
fi
${uci_set}udp="$udp"
${uci_set}obfs="$obfs"
${uci_set}host="$obfs_host"
[ -z "$obfs" ] && ${uci_set}obfs="$mode"
[ -z "$mode" ] && [ ! -z "$network" ] && ${uci_set}obfs_vmess="websocket"
[ -z "$mode" ] && [ -z "$network" ] && ${uci_set}obfs_vmess="none"
[ -z "$obfs_host" ] && ${uci_set}host="$host"
${uci_set}tls="$tls"
${uci_set}skip_cert_verify="$verify"
${uci_set}path="$path"
[ -z "$path" ] && ${uci_set}path="$ws_path"
${uci_set}mux="$mux"
${uci_set}custom="$headers"
[ -z "$headers" ] && ${uci_set}custom="$Host"
#添加新节点
name=openclash
uci_name_tmp=$(uci add $name servers)
uci_set="uci -q set $name.$uci_name_tmp."
uci_add="uci -q add_list $name.$uci_name_tmp."
if [ -z "$new_servers_group" ] && [ "$servers_if_update" = "1" ]; then
${uci_set}enabled="0"
else
${uci_set}enabled="1"
fi
if [ "$servers_if_update" = "1" ]; then
${uci_set}manual="0"
else
${uci_set}manual="1"
fi
${uci_set}name="$server_name"
${uci_set}type="$server_type"
${uci_set}server="$server"
${uci_set}port="$port"
if [ "$server_type" = "vmess" ]; then
${uci_set}securitys="$cipher"
else
${uci_set}cipher="$cipher"
fi
${uci_set}udp="$udp"
${uci_set}obfs="$obfs"
${uci_set}host="$obfs_host"
[ -z "$obfs" ] && ${uci_set}obfs="$mode"
[ -z "$mode" ] && ${uci_set}obfs="none"
[ -z "$mode" ] && [ ! -z "$network" ] && ${uci_set}obfs_vmess="websocket"
[ -z "$mode" ] && [ -z "$network" ] && ${uci_set}obfs_vmess="none"
[ -z "$obfs_host" ] && ${uci_set}host="$host"
${uci_set}tls="$tls"
${uci_set}skip_cert_verify="$verify"
${uci_set}path="$path"
[ -z "$path" ] && ${uci_set}path="$ws_path"
${uci_set}mux="$mux"
${uci_set}custom="$headers"
[ -z "$headers" ] && ${uci_set}custom="$Host"
if [ "$server_type" = "vmess" ]; then
#v2ray
${uci_set}alterId="$alterId"
${uci_set}uuid="$uuid"
fi
if [ "$server_type" = "vmess" ]; then
#v2ray
${uci_set}alterId="$alterId"
${uci_set}uuid="$uuid"
fi
if [ "$server_type" = "socks5" ] || [ "$server_type" = "http" ]; then
${uci_set}auth_name="$username"
${uci_set}auth_pass="$password"
else
${uci_set}password="$password"
fi
for ((i=1;i<=$group_num;i++)) #循环加入策略组
do
single_group="/tmp/group_$i.yaml"
if [ ! -z "$(grep -F "$server_name" "$single_group")" ]; then
group_name=$(grep "name:" $single_group 2>/dev/null |awk -F 'name:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)
${uci_add}groups="$group_name"
if [ "$server_type" = "socks5" ] || [ "$server_type" = "http" ]; then
${uci_set}auth_name="$username"
${uci_set}auth_pass="$password"
else
${uci_set}password="$password"
fi
#加入策略组
if [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq "1" ] && [ ! -z "$new_servers_group" ] && [ ! -z "$(grep "config groups" "$CFG_FILE")" ]; then
#新节点且设置默认策略组时加入指定策略组
config_load "openclash"
config_list_foreach "config" "new_servers_group" cfg_new_servers_groups_get
else
for ((i=1;i<=$group_num;i++))
do
single_group="/tmp/group_$i.yaml"
if [ ! -z "$(grep -F "$server_name" "$single_group")" ]; then
group_name=$(grep "name:" $single_group 2>/dev/null |awk -F 'name:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)
${uci_add}groups="$group_name"
fi
done
fi
done
fi
uci commit openclash
done
#删除订阅中已不存在的节点
if [ "$servers_update" -eq "1" ] && [ "$servers_if_update" = "1" ]; then
echo "删除订阅中已不存在的节点..." >$START_LOG
sed -i '/#match#/d' "$match_servers" 2>/dev/null
cat $match_servers |sort -r |while read line
do
if [ -z "$(echo "$line")" ]; then
continue
fi
server_num=$(echo "$line" |awk -F '.' '{print $1}')
if [ "$(uci get openclash.@servers["$server_num"].manual)" = "0" ]; then
uci delete openclash.@servers["$server_num"] 2>/dev/null
fi
done
fi
echo "配置文件读取完成!" >$START_LOG
sleep 3
echo "" >$START_LOG
uci set openclash.config.servers_if_update=0
uci commit openclash
rm -rf /tmp/servers.yaml 2>/dev/null
rm -rf /tmp/yaml_proxy.yaml 2>/dev/null
rm -rf /tmp/group_*.yaml 2>/dev/null
rm -rf /tmp/yaml_group.yaml 2>/dev/null
rm -rf /tmp/yaml_group.yaml 2>/dev/null
rm -rf /tmp/match_servers.list 2>/dev/null

View File

@ -4,12 +4,15 @@ status=$(ps|grep -c /usr/share/openclash/yml_proxys_set.sh)
START_LOG="/tmp/openclash_start.log"
SERVER_FILE="/tmp/yaml_servers.yaml"
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
config_auto_update=$(uci get openclash.config.auto_update 2>/dev/null)
#写入服务器节点到配置文件
yml_servers_set()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
config_get "type" "$section" "type" ""
config_get "name" "$section" "name" ""
config_get "server" "$section" "server" ""
@ -30,7 +33,12 @@ yml_servers_set()
config_get "uuid" "$section" "uuid" ""
config_get "auth_name" "$section" "auth_name" ""
config_get "auth_pass" "$section" "auth_pass" ""
config_get "psk" "$section" "psk" ""
config_get "obfs_snell" "$section" "obfs_snell" ""
if [ "$enabled" = "0" ]; then
return
fi
if [ -z "$type" ]; then
return
@ -66,6 +74,10 @@ yml_servers_set()
udp=", udp: $udp"
fi
if [ "$obfs_snell" = "none" ]; then
obfs_snell=""
fi
if [ "$obfs_vmess" != "none" ]; then
obfs_vmess=", network: ws"
else
@ -159,12 +171,29 @@ EOF
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
if [ "$type" = "snell" ]; then
cat >> "$SERVER_FILE" <<-EOF
- name: "$name"
type: $type
server: $server
port: $port
psk: $psk
EOF
if [ ! -z "$obfs_snell" ] && [ ! -z "$host" ]; then
cat >> "$SERVER_FILE" <<-EOF
obfs-opts:
mode: $obfs_snell
$host
EOF
fi
fi
}
#创建配置文件
echo "开始更新配置文件服务器节点信息..." >$START_LOG
echo "开始写入配置文件服务器节点信息..." >$START_LOG
echo "Proxy:" >$SERVER_FILE
config_load "openclash"
config_foreach yml_servers_set "servers"
@ -175,7 +204,7 @@ egrep '^ {0,}-' $SERVER_FILE |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Server 2>/dev/null #添加参数
if [ "$rule_sources" = "ConnersHua" ]; then
if [ "$rule_sources" = "ConnersHua" ] && [ "$servers_if_update" != "1" ]; then
echo "使用ConnersHua规则创建中..." >$START_LOG
cat >> "$SERVER_FILE" <<-EOF
- name: Auto - UrlTest
@ -239,7 +268,14 @@ uci set openclash.config.Apple="Apple"
uci set openclash.config.AdBlock="AdBlock"
uci set openclash.config.Domestic="Domestic"
uci set openclash.config.Others="Others"
elif [ "$rule_sources" = "lhie1" ]; then
[ "$config_auto_update" -eq 1 ] && {
uci set openclash.config.servers_update="1"
uci add_list openclash.config.new_servers_group="Auto - UrlTest"
uci add_list openclash.config.new_servers_group="Proxy"
uci add_list openclash.config.new_servers_group="AsianTV"
uci add_list openclash.config.new_servers_group="GlobalTV"
}
elif [ "$rule_sources" = "lhie1" ] && [ "$servers_if_update" != "1" ]; then
echo "使用lhie1规则创建中..." >$START_LOG
cat >> "$SERVER_FILE" <<-EOF
- name: Auto - UrlTest
@ -290,7 +326,14 @@ uci set openclash.config.AsianTV="AsianTV"
uci set openclash.config.Proxy="Proxy"
uci set openclash.config.Domestic="Domestic"
uci set openclash.config.Others="Others"
elif [ "$rule_sources" = "ConnersHua_return" ]; then
[ "$config_auto_update" -eq 1 ] && {
uci set openclash.config.servers_update="1"
uci add_list openclash.config.new_servers_group="Auto - UrlTest"
uci add_list openclash.config.new_servers_group="Proxy"
uci add_list openclash.config.new_servers_group="AsianTV"
uci add_list openclash.config.new_servers_group="GlobalTV"
}
elif [ "$rule_sources" = "ConnersHua_return" ] && [ "$servers_if_update" != "1" ]; then
echo "使用ConnersHua回国规则创建中..." >$START_LOG
cat >> "$SERVER_FILE" <<-EOF
- name: Auto - UrlTest
@ -318,8 +361,13 @@ EOF
uci set openclash.config.rule_source="ConnersHua_return"
uci set openclash.config.Proxy="Proxy"
uci set openclash.config.Others="Others"
[ "$config_auto_update" -eq 1 ] && {
uci set openclash.config.servers_update="1"
uci add_list openclash.config.new_servers_group="Auto - UrlTest"
uci add_list openclash.config.new_servers_group="Proxy"
}
fi
if [ "$create_config" != "0" ]; then
if [ "$create_config" != "0" ] && [ "$servers_if_update" != "1" ]; then
echo "Rule:" >>$SERVER_FILE
echo "配置文件创建完成,正在更新服务器、策略组信息..." >$START_LOG
cat "$SERVER_FILE" > "/etc/openclash/config.yaml" 2>/dev/null
@ -332,9 +380,11 @@ else
sed -i '/Proxy Group:/r/tmp/yaml_groups.yaml' "/etc/openclash/config.yaml" 2>/dev/null
sed -i '/#change server#/d' "/etc/openclash/config.yaml" 2>/dev/null
fi
echo "配置文件更新完成!" >$START_LOG
echo "配置文件写入完成!" >$START_LOG
rm -rf $SERVER_FILE 2>/dev/null
rm -rf /tmp/Proxy_Server 2>/dev/null
rm -rf /tmp/yaml_groups.yaml 2>/dev/null
uci set openclash.config.enable=1 2>/dev/null
uci set openclash.config.servers_if_update=0
uci commit openclash
/etc/init.d/openclash restart >/dev/null 2>&1

View File

@ -87,7 +87,7 @@ msgid "Download Configurations"
msgstr "下载配置"
msgid "Select Mode"
msgstr "OpenClash 运行模式"
msgstr "运行模式"
msgid "redir-host"
msgstr "Redir-Host兼容模式"
@ -98,6 +98,27 @@ msgstr "Fake-IP增强模式"
msgid "Select Mode For OpenClash Work, Network Error Try Flush DNS Cache"
msgstr "选择运行模式在兼容模式下无法代理路由器自身流量如客户端的网络无法连接请尝试清除DNS缓存"
msgid "Proxy Mode"
msgstr "代理模式"
msgid "Select Proxy Mode"
msgstr "选择默认代理模式"
msgid "Rule Mode"
msgstr "Rule【策略代理】"
msgid "Global Mode"
msgstr "Global【全局代理需前往控制面板手动指定节点】"
msgid "Direct Mode"
msgstr "Direct【全局直连】"
msgid "Log Level"
msgstr "日志等级"
msgid "Select Core's Log Level"
msgstr "选择内核日志的默认输出模式"
msgid "Redirect Local DNS Setting"
msgstr "本地DNS劫持"
@ -108,7 +129,10 @@ msgid "Disable Dnsmasq's DNS Cache"
msgstr "禁止Dnsmasq缓存DNS"
msgid "Recommended Enabled For Avoiding Some Connection Errors"
msgstr "推荐启用,防止因缓存造成连接错误(部分固件可能不兼容)"
msgstr "推荐启用,防止因缓存造成连接错误"
msgid "(Maybe Incompatible For Your Firmware)"
msgstr "(部分固件可能不兼容)"
msgid "Custom DNS Setting"
msgstr "自定义上游DNS服务器"
@ -117,13 +141,19 @@ msgid "Use Custom Rules"
msgstr "启用后将把自定义规则增加到配置文件并优先匹配,规则请到下方文本框编辑"
msgid "Add Custom DNS Servers"
msgstr "设置自定义上游DNS服务器在上方DNS设置中启用本功能后生效"
msgstr "设置自定义上游DNS服务器"
msgid "(Take Effect After Choose Above)"
msgstr "在上方DNS设置中启用本功能后生效"
msgid "Advanced Setting"
msgstr "高级设置"
msgid "DNS Advanced Settings"
msgstr "DNS高级设置如您不知道选项有何用请不要随意修改"
msgstr "DNS高级设置"
msgid "(Please Don't Modify it at Will)"
msgstr "(如您不知道选项有何用,请不要随意修改)"
msgid "Specify DNS Server"
msgstr "Fake-IP模式黑名单DNS服务器"
@ -196,6 +226,12 @@ msgid ""
"Rename your config file to config.yaml before upload what would be save to /etc/openclash"
msgstr "注意:上传之前请将配置文件重命名为 config.yaml ,文件将被保存到 /etc/openclash"
msgid "Keyword Matching Setting"
msgstr "筛选节点"
msgid "Only Keep Servers which Matching Keywords, eg: hk or tw&bgp"
msgstr "仅订阅名字与以上任意关键字匹配的节点,不区分大小写。格式示例:香港、台湾&bgp"
msgid "Please Make Sure Ports Available"
msgstr "请确保端口可用"
@ -256,8 +292,8 @@ msgstr "管理页面登录密钥"
msgid "Set Dashboard Secret"
msgstr "设置您的管理页面登录密钥"
msgid "Dashboard Address Example: 192.168.1.1/openclash、192.168.1.1:9090/ui"
msgstr "管理页面地址示例: 192.168.1.1/openclash、192.168.1.1:9090/ui"
msgid "Dashboard Address Example: "
msgstr "管理页面地址示例: "
msgid "Dashboard Port"
msgstr "管理页面端口"
@ -358,8 +394,8 @@ msgstr "设置自定义规则详细信息请前往Github( https://github.com/
msgid "Custom Hosts Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md"
msgstr "设置自定义Hosts详细信息请前往Github( https://github.com/Dreamacro/clash/blob/master/README.md )查询"
msgid "Set Custom Rules, Will Add When Flag Turn on"
msgstr "设置自定义规则,在上方规则设置中启用本功能后生效"
msgid "Set Custom Rules"
msgstr "设置自定义规则(在上方规则设置中启用本功能后生效)"
msgid "Set Custom Hosts, Only Work with Redir-Host Mode"
msgstr "设置自定义Hosts仅在Redir-Host模式下生效不会覆盖配置文件设置"
@ -415,7 +451,10 @@ msgid "Severs&Groups"
msgstr "服务器&策略组"
msgid "Load Config"
msgstr "读取配置文件"
msgstr "读取配置"
msgid "Delete Unused Servers"
msgstr "删除未选中节点"
msgid "Delete Severs"
msgstr "清空服务器配置"
@ -429,6 +468,18 @@ msgstr "返回概览"
msgid "Servers manage and Config create"
msgstr "服务器&策略组管理(支持配置文件一键生成)"
msgid "Keep Settings"
msgstr "保留配置"
msgid "Only Update Servers Below When Subscription"
msgstr "订阅时仅更新节点,保留下方策略组设置,不修改顺序"
msgid "New Servers Group"
msgstr "新节点默认策略组"
msgid "Set The New Subscribe Server's Default Proxy Groups"
msgstr "选择符合订阅要求的新节点的默认策略组"
msgid "Choose Template For Create Config"
msgstr "选择配置文件模板"
@ -537,7 +588,11 @@ msgstr "添加到策略组(请勿重复添加)"
msgid "No Need Set when Config Create, The added Proxy Groups Must Exist"
msgstr "注意:使用一键生成配置文件功能时无需设置此项,修改配置文件前添加的策略组必须已创建"
msgid "Clean Log"
msgstr "清理日志"
msgid "Refresh Log"
msgstr "刷新日志"