🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+146
View File
@@ -0,0 +1,146 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.47.055
PKG_RELEASE:=1
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI support for clash
PKGARCH:=all
DEPENDS:=+luci-compat +dnsmasq-full +bash +curl +ca-bundle +ip-full +ruby \
+ruby-yaml +kmod-inet-diag +kmod-nft-tproxy +kmod-tun +unzip
MAINTAINER:=vernesong
endef
define Package/$(PKG_NAME)/description
A LuCI support for clash
endef
define Build/Prepare
$(CP) $(CURDIR)/root $(PKG_BUILD_DIR)
$(CP) $(CURDIR)/luasrc $(PKG_BUILD_DIR)
$(foreach po,$(wildcard ${CURDIR}/po/zh-cn/*.po), \
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
chmod 0755 $(PKG_BUILD_DIR)/root/etc/init.d/openclash
chmod -R 0755 $(PKG_BUILD_DIR)/root/usr/share/openclash/
mkdir -p $(PKG_BUILD_DIR)/root/etc/openclash/config
mkdir -p $(PKG_BUILD_DIR)/root/etc/openclash/rule_provider
mkdir -p $(PKG_BUILD_DIR)/root/etc/openclash/proxy_provider
mkdir -p $(PKG_BUILD_DIR)/root/etc/openclash/backup
mkdir -p $(PKG_BUILD_DIR)/root/etc/openclash/core
mkdir -p $(PKG_BUILD_DIR)/root/usr/share/openclash/backup/overwrite
cp -f "$(PKG_BUILD_DIR)/root/etc/config/openclash" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_rules.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_rules.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_rules_2.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_rules_2.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_hosts.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_hosts.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_fake_filter.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_fake_filter.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_domain_dns.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_domain_dns.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_domain_dns_policy.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_domain_dns_policy.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_proxy_server_dns_policy.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_proxy_server_dns_policy.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_fallback_filter.yaml" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_fallback_filter.yaml" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_sniffer.yaml" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_sniffer.yaml" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_localnetwork_ipv4.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_localnetwork_ipv4.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_localnetwork_ipv6.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_localnetwork_ipv6.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_chnroute_pass.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_chnroute_pass.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_chnroute6_pass.list" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_chnroute6_pass.list" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_firewall_rules.sh" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_firewall_rules.sh" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/custom/openclash_custom_overwrite.sh" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/openclash_custom_overwrite.sh" >/dev/null 2>&1
cp -f "$(PKG_BUILD_DIR)/root/etc/openclash/overwrite/default" "$(PKG_BUILD_DIR)/root/usr/share/openclash/backup/overwrite/default" >/dev/null 2>&1
exit 0
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/conffiles
endef
define Package/$(PKG_NAME)/preinst
#!/bin/sh
if [ -f "/etc/config/openclash" ] && [ ! -f "/tmp/openclash.bak" ]; then
cp -f "/etc/config/openclash" "/tmp/openclash.bak" >/dev/null 2>&1
cp -rf "/etc/openclash" "/tmp/openclash" >/dev/null 2>&1
cp -rf "/usr/share/openclash/ui" "/tmp/openclash_ui" >/dev/null 2>&1
cp -rf "/www/luci-static/resources/openclash/pac" "/tmp/pac" >/dev/null 2>&1
fi
exit 0
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
exit 0
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
uci -q set openclash.config.enable=0
uci -q commit openclash
[ -n "$(pidof clash)" ] && /etc/init.d/openclash stop 2>/dev/null
if [ -f "/etc/config/openclash" ] && [ ! -f "/tmp/openclash.bak" ]; then
cp -f "/etc/config/openclash" "/tmp/openclash.bak" >/dev/null 2>&1
cp -rf "/etc/openclash" "/tmp/openclash" >/dev/null 2>&1
cp -rf "/usr/share/openclash/ui" "/tmp/openclash_ui" >/dev/null 2>&1
cp -rf "/www/luci-static/resources/openclash/pac" "/tmp/pac" >/dev/null 2>&1
fi
exit 0
endef
define Package/$(PKG_NAME)/postrm
#!/bin/sh
DEFAULT_DNSMASQ_CFGID="$$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}' 2>/dev/null)"
if [ -f "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" ]; then
DNSMASQ_CONF_DIR="$$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" 2>/dev/null)"
else
DNSMASQ_CONF_DIR="/tmp/dnsmasq.d"
fi
DNSMASQ_CONF_DIR=$${DNSMASQ_CONF_DIR%*/}
rm -rf /etc/openclash >/dev/null 2>&1
rm -rf /etc/config/openclash >/dev/null 2>&1
rm -rf /tmp/openclash.log >/dev/null 2>&1
rm -rf /tmp/openclash_start.log >/dev/null 2>&1
rm -rf /tmp/openclash_last_version >/dev/null 2>&1
rm -rf /tmp/openclash.change >/dev/null 2>&1
rm -rf /tmp/Proxy_Group >/dev/null 2>&1
rm -rf /tmp/rules_name >/dev/null 2>&1
rm -rf /tmp/rule_providers_name >/dev/null 2>&1
rm -rf /tmp/clash_last_version >/dev/null 2>&1
rm -rf /usr/share/openclash >/dev/null 2>&1
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
rm -rf /tmp/dler* >/dev/null 2>&1
rm -rf /tmp/etc/openclash >/dev/null 2>&1
rm -rf /tmp/openclash_edit_file_name >/dev/null 2>&1
rm -rf /tmp/openclash_announcement >/dev/null 2>&1
rm -rf /www/luci-static/resources/openclash >/dev/null 2>&1
sed -i '/OpenClash Append/,/OpenClash Append End/d' "/usr/lib/lua/luci/model/network.lua" >/dev/null 2>&1
sed -i '/.*kB maximum content size*/c\HTTP_MAX_CONTENT = 1024*100 -- 100 kB maximum content size' /usr/lib/lua/luci/http.lua >/dev/null 2>&1
sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*100; // 100 kB maximum content size' /usr/share/ucode/luci/http.uc >/dev/null 2>&1
uci -q delete firewall.openclash
uci -q commit firewall
[ -f "/etc/config/ucitrack" ] && {
uci -q delete ucitrack.@openclash[-1]
uci -q commit ucitrack
}
rm -rf /tmp/luci-*
exit 0
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.*.lmo $(1)/usr/lib/lua/luci/i18n/
$(CP) $(PKG_BUILD_DIR)/root/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luasrc/* $(1)/usr/lib/lua/luci/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,27 @@
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require("luci.model.uci").cursor()
m = SimpleForm("openclash",translate("OpenClash"))
m.description = translate("A Clash Client For OpenWrt")
m.reset = false
m.submit = false
m:section(SimpleSection).template = "openclash/status"
if fs.uci_get_config("config", "dler_token") then
m:append(Template("openclash/dlercloud"))
end
m:append(Template("openclash/myip"))
m:append(Template("openclash/developer"))
m:append(Template("openclash/select_git_cdn"))
m:append(Template("openclash/config_edit"))
m:append(Template("openclash/config_upload"))
return m
@@ -0,0 +1,681 @@
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
local json = require "luci.jsonc"
local datatype = require "luci.cbi.datatypes"
-- 优化 CBI UI(新版 LuCI 专用)
local function optimize_cbi_ui()
luci.http.write([[
<script type="text/javascript">
// 修正上移、下移按钮名称
document.querySelectorAll("input.btn.cbi-button.cbi-button-up").forEach(function(btn) {
btn.value = "]] .. translate("Move up") .. [[";
});
document.querySelectorAll("input.btn.cbi-button.cbi-button-down").forEach(function(btn) {
btn.value = "]] .. translate("Move down") .. [[";
});
// 删除控件和说明之间的多余换行
document.querySelectorAll("div.cbi-value-description").forEach(function(descDiv) {
var prev = descDiv.previousSibling;
while (prev && prev.nodeType === Node.TEXT_NODE && prev.textContent.trim() === "") {
prev = prev.previousSibling;
}
if (prev && prev.nodeType === Node.ELEMENT_NODE && prev.tagName === "BR") {
prev.remove();
}
});
</script>
]])
end
font_green = [[<b style=color:green>]]
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
if not op_mode then op_mode = "redir-host" end
local lan_ip = fs.lanip()
m = Map("openclash", translate("Overwrite Settings"))
m.pageaction = false
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"..
"<br/>"..font_green..translate("For More Useful Meta Core Functions Go Wiki")..": "..font_off.."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/\")'>"..translate("https://wiki.metacubex.one/").."</a>"
s = m:section(TypedSection, "openclash")
s.anonymous = true
s:tab("settings", translate("General Settings"))
s:tab("dns", "DNS "..translate("Settings"))
s:tab("meta", translate("Meta Settings"))
s:tab("smart", translate("Smart Settings"))
s:tab("rules", translate("Rules Setting"))
s:tab("developer", translate("Developer Settings"))
----- General Settings
o = s:taboption("settings", ListValue, "interface_name", translate("Bind Network Interface"))
local de_int = SYS.exec("ip route |grep 'default' |awk '{print $5}' 2>/dev/null") or SYS.exec("/usr/share/openclash/openclash_get_network.lua 'dhcp'")
o.description = translate("Default Interface Name:").." "..font_green..bold_on..de_int..bold_off..font_off..translate(",Try Enable If Network Loopback")
local interfaces = SYS.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
for interface in string.gmatch(interfaces, "%S+") do
o:value(interface)
end
o:value("0", translate("Disable"))
o.default = "0"
o = s:taboption("settings", Value, "tolerance", translate("URL-Test Group Tolerance").."(ms)")
o.description = translate("Switch To The New Proxy When The Delay Difference Between Old and The Fastest Currently is Greater Than This Value")
o:value("0", translate("Disable"))
o:value("100")
o:value("150")
o.datatype = "uinteger"
o.default = "0"
o = s:taboption("settings", Value, "urltest_interval_mod", translate("URL-Test Interval Modify").."(s)")
o.description = translate("Modify The URL-Test Interval In The Config")
o:value("0", translate("Disable"))
o:value("180")
o:value("300")
o.datatype = "uinteger"
o.default = "0"
o = s:taboption("settings", Value, "urltest_address_mod", translate("URL-Test Address Modify"))
o.description = translate("Modify The URL-Test Address In The Config")
o:value("0", translate("Disable"))
o:value("http://www.gstatic.com/generate_204")
o:value("http://cp.cloudflare.com/generate_204")
o:value("https://cp.cloudflare.com/generate_204")
o:value("http://captive.apple.com/generate_204")
o.default = "0"
o = s:taboption("settings", Value, "github_address_mod", translate("Github Address Modify"))
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghfast.top/\")'>https://ghfast.top/</a>"
o:value("0", translate("Disable"))
o:value("https://fastly.jsdelivr.net/")
o:value("https://testingcf.jsdelivr.net/")
o:value("https://cdn.jsdelivr.net/")
o.default = "0"
o = s:taboption("settings", ListValue, "log_level", translate("Log Level"))
o.description = translate("Select Core's Log Level")
o:value("0", translate("Disable"))
o:value("info", translate("Info Mode"))
o:value("warning", translate("Warning Mode"))
o:value("error", translate("Error Mode"))
o:value("debug", translate("Debug Mode"))
o:value("silent", translate("Silent Mode"))
o.default = "0"
o = s:taboption("settings", Value, "dns_port")
o.title = translate("DNS Port")
o.default = "7874"
o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
o = s:taboption("settings", Value, "proxy_port")
o.title = translate("Redir Port")
o.default = "7892"
o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
o = s:taboption("settings", Value, "tproxy_port")
o.title = translate("TProxy Port")
o.default = "7895"
o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
o = s:taboption("settings", Value, "http_port")
o.title = translate("HTTP(S) Port")
o.default = "7890"
o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
o = s:taboption("settings", Value, "socks_port")
o.title = translate("SOCKS5 Port")
o.default = "7891"
o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
o = s:taboption("settings", Value, "mixed_port")
o.title = translate("Mixed Port")
o.default = "7893"
o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
---- DNS Settings
o = s:taboption("dns", Flag, "enable_custom_dns", font_red..bold_on..translate("Custom DNS Setting")..bold_off..font_off)
o.description = font_red..bold_on..translate("Set OpenClash Upstream DNS Resolve Server")..bold_off..font_off
o.default = 0
o = s:taboption("dns", Flag, "enable_respect_rules", font_red..bold_on..translate("Respect Rules").."(respect-rules)"..bold_off..font_off)
o.description = font_red..bold_on..translate("Whether or not The Connection to the DNS Server Follow the Rules in Config")..bold_off..font_off
o.default = 0
o = s:taboption("dns", Flag, "append_wan_dns", translate("Append Upstream DNS"))
o.description = translate("Append The Upstream Assigned DNS And Gateway IP To The Nameserver")
o.default = 1
o = s:taboption("dns", Flag, "append_default_dns", translate("Append Default DNS"))
o.description = translate("Automatically Append Compliant DNS to default-nameserver")
o.default = 1
if op_mode == "fake-ip" then
o = s:taboption("dns", Value, "fakeip_range", translate("Fake-IP Range").." (IPv4 Cidr)")
o.description = translate("Set Fake-IP Range").." (IPv4 Cidr)"
o:value("0", translate("Disable"))
o:value("198.18.0.1/16")
o.default = "0"
o.placeholder = "198.18.0.1/16"
function o.validate(self, value)
if value == "0" then
return "0"
end
if datatype.cidr4(value) then
return value
end
return "198.18.0.1/16"
end
o = s:taboption("dns", Flag, "store_fakeip", translate("Persistence Fake-IP"))
o.description = font_red..bold_on..translate("Cache Fake-IP DNS Resolution Records To File, Improve The Response Speed After Startup")..bold_off..font_off
o.default = 1
end
o = s:taboption("dns", Flag, "custom_fallback_filter", translate("Fallback-Filter"))
o.description = translate("Take Effect If Fallback DNS Setted, Prevent DNS Pollution")
o.default = 0
custom_fallback_filter = s:taboption("dns", Value, "custom_fallback_fil")
custom_fallback_filter.template = "cbi/tvalue"
custom_fallback_filter.rows = 20
custom_fallback_filter.wrap = "off"
custom_fallback_filter:depends("custom_fallback_filter", "1")
function custom_fallback_filter.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_fallback_filter.yaml") or ""
end
function custom_fallback_filter.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_fallback_filter.yaml")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_fallback_filter.yaml", value)
end
end
end
if op_mode == "fake-ip" then
o = s:taboption("dns", Flag, "custom_fakeip_filter", translate("Fake-IP-Filter"))
o.default = 0
o = s:taboption("dns", ListValue, "custom_fakeip_filter_mode", translate("Fake-IP-Filter-Mode"))
o.description = translate("Fake-IP is not returned if the matching succeeds when blacklist mode or Fake-IP is returned if the matching succeeds when whitelist mode")
o.default = "blacklist"
o:value("blacklist", translate("Blacklist Mode"))
o:value("whitelist", translate("Whitelist Mode"))
o:value("rule", translate("Rule Mode"))
o:depends("custom_fakeip_filter", "1")
custom_fake_black = s:taboption("dns", Value, "custom_fake_filter")
custom_fake_black.template = "cbi/tvalue"
custom_fake_black.description = translate("Domain Names In The List Do Not Return Fake-IP, One rule per line")
custom_fake_black.rows = 20
custom_fake_black.wrap = "off"
custom_fake_black:depends("custom_fakeip_filter", "1")
function custom_fake_black.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_fake_filter.list") or ""
end
function custom_fake_black.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_fake_filter.list")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_fake_filter.list", value)
end
end
end
end
o = s:taboption("dns", Flag, "custom_name_policy", translate("Nameserver-Policy"))
o.default = 0
custom_domain_dns_policy = s:taboption("dns", Value, "custom_domain_dns_core")
custom_domain_dns_policy.template = "cbi/tvalue"
custom_domain_dns_policy.description = translate("Domain Names In The List Use The Custom DNS Server, But Still Return Fake-IP Results, One rule per line")
custom_domain_dns_policy.rows = 20
custom_domain_dns_policy.wrap = "off"
custom_domain_dns_policy:depends("custom_name_policy", "1")
function custom_domain_dns_policy.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_domain_dns_policy.list") or ""
end
function custom_domain_dns_policy.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_domain_dns_policy.list")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_domain_dns_policy.list", value)
end
end
end
o = s:taboption("dns", Flag, "custom_proxy_server_policy", translate("Proxy-Server-Nameserver-Policy"))
o.default = 0
custom_proxy_server_dns_policy = s:taboption("dns", Value, "custom_proxy_server_dns_policy")
custom_proxy_server_dns_policy.template = "cbi/tvalue"
custom_proxy_server_dns_policy.description = translate("Domain Names In The List Use The Custom DNS Server, But Still Return Fake-IP Results, One rule per line")
custom_proxy_server_dns_policy.rows = 20
custom_proxy_server_dns_policy.wrap = "off"
custom_proxy_server_dns_policy:depends("custom_proxy_server_policy", "1")
function custom_proxy_server_dns_policy.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_proxy_server_dns_policy.list") or ""
end
function custom_proxy_server_dns_policy.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_proxy_server_dns_policy.list")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_proxy_server_dns_policy.list", value)
end
end
end
o = s:taboption("dns", Flag, "custom_host", translate("Hosts"))
o.default = 0
custom_hosts = s:taboption("dns", Value, "custom_hosts")
custom_hosts.template = "cbi/tvalue"
custom_hosts.description = translate("Custom Hosts Here, You May Need to Turn off The Rebinding Protection Option of Dnsmasq When Hosts Has Set a Reserved Address, For More Go:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://lancellc.gitbook.io/clash/clash-config-file/dns/host\")'>https://lancellc.gitbook.io/clash/clash-config-file/dns/host</a>"
custom_hosts.rows = 20
custom_hosts.wrap = "off"
custom_hosts:depends("custom_host", "1")
function custom_hosts.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_hosts.list") or ""
end
function custom_hosts.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_hosts.list")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_hosts.list", value)
end
end
end
-- Meta
o = s:taboption("meta", Flag, "enable_tcp_concurrent", font_red..bold_on..translate("Enable Tcp Concurrent")..bold_off..font_off)
o.description = font_red..bold_on..translate("TCP Concurrent Request IPs, Choose The Lowest Latency One To Connection")..bold_off..font_off
o.default = "0"
o = s:taboption("meta", Flag, "enable_unified_delay", font_red..bold_on..translate("Enable Unified Delay")..bold_off..font_off)
o.description = font_red..bold_on..translate("Change The Delay Calculation Method To Remove Extra Delays Such as Handshaking")..bold_off..font_off
o.default = "0"
o = s:taboption("meta", ListValue, "find_process_mode", translate("Enable Process Rule"))
o.description = translate("Whether to Enable Process Rules, Only Works on Routerself, If You Are Not Sure, Please Choose off Which Useful in Router Environment, Depend on kmod-inet-diag")
o:value("0", translate("Disable"))
o:value("off", translate("OFF "))
o:value("always", translate("Always "))
o:value("strict", translate("strict "))
o.default = "0"
o = s:taboption("meta", ListValue, "geodata_loader", translate("Geodata Loader Mode"))
o:value("0", translate("Disable"))
o:value("memconservative", translate("Memconservative"))
o:value("standard", translate("Standard"))
o.default = "0"
o = s:taboption("meta", Flag, "enable_geoip_dat", translate("Enable GeoIP Dat"))
o.description = translate("Replace GEOIP MMDB With GEOIP Dat, Large Size File")..", "..font_red..bold_on..translate("Need Download First")..bold_off..font_off
o.default = 0
o = s:taboption("meta", Flag, "enable_meta_sniffer", font_red..bold_on..translate("Enable Sniffer")..bold_off..font_off)
o.description = font_red..bold_on..translate("Sniffer Will Prevent Domain Name Proxy and DNS Hijack Failure")..bold_off..font_off
o.default = 1
o = s:taboption("meta", Flag, "enable_meta_sniffer_pure_ip", translate("Forced Sniff Pure IP"))
o.description = translate("Forced Sniff Pure IP Connections")
o.default = 1
o:depends("enable_meta_sniffer", "1")
o = s:taboption("meta", Flag, "enable_meta_sniffer_custom", translate("Custom Sniffer Settings"))
o.description = translate("Custom The Force and Skip Sniffing Doamin Lists")
o.default = 0
o:depends("enable_meta_sniffer", "1")
sniffer_custom = s:taboption("meta", Value, "sniffer_custom")
sniffer_custom:depends("enable_meta_sniffer_custom", "1")
sniffer_custom.template = "cbi/tvalue"
sniffer_custom.rows = 20
sniffer_custom.wrap = "off"
function sniffer_custom.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_sniffer.yaml") or ""
end
function sniffer_custom.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_sniffer.yaml")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_sniffer.yaml", value)
end
end
end
-- Smart Settings
o = s:taboption("smart", Flag, "auto_smart_switch", font_red..bold_on..translate("Smart Auto Switch")..bold_off..font_off)
o.description = font_red..bold_on..translate("Auto Switch Url-test and Load-balance Group to Smart Group")..bold_off..font_off
o.default = 0
o = s:taboption("smart", Value, "smart_policy_priority", translate("Policy Priority"))
o.default = ""
o.placeholder = "Premium:0.9;SG:1.3"
o.description = translate("Nodes Weight Priority, <1 Means Lower Priority, >1 Means Higher Priority, The Default is 1, Pattern Support Regex and String")
o = s:taboption("smart", Flag, "smart_prefer_asn", font_red..bold_on..translate("Prefer-ASN")..bold_off..font_off)
o.description = translate("Select Nodes Force Lookup and Use Target ASN Info First For More Stable Experience")
o.default = 0
o = s:taboption("smart", Flag, "smart_enable_lgbm", font_red..bold_on..translate("Enable LightGBM Model")..bold_off..font_off)
o.description = font_red..bold_on..translate("Use LightGBM Model To Predict Weight")..bold_off..font_off
o.default = 0
o = s:taboption("smart", Flag, "smart_collect", translate("Colletct Training Data"))
o.default = 0
o = s:taboption("smart", Value, "smart_collect_size", translate("Data Colletct File Size (MB)"))
o.default = 100
o:depends("smart_collect", "1")
o.description = translate("Limit The File Size of Collected Data, The Default is 100MB")
o = s:taboption("smart", Value, "smart_collect_rate", translate("Data Colletct Rate"))
o.default = 1
o:depends("smart_collect", "1")
o.description = translate("Data Acquisition Rate, Desirable Values are 0-1, The Default is 1")
o = s:taboption("smart", Flag, "lgbm_auto_update", translate("Auto Update LightGBM Model"))
o.default = 0
o = s:taboption("smart", Value, "lgbm_update_interval", translate("Update Interval(hour)"))
o.default = "72"
o:depends("lgbm_auto_update", "1")
o = s:taboption("smart", Value, "lgbm_custom_url")
o.title = translate("Custom Model URL")
o.rmempty = true
o.description = translate("Custom LightGBM Model URL, Click Button Below To Refresh After Edit")
o:value("https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model.bin", translate("Light Version").." "..translate("(Default)"))
o:value("https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model-middle.bin", translate("Middle Version"))
o:value("https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model-large.bin", translate("Large Version"))
o.default = "https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model.bin"
o:depends("lgbm_auto_update", "1")
o = s:taboption("smart", Button, translate("Model Update"))
o.description = translate("Current Version:").." "..font_green..bold_on..translate(fs.get_resourse_mtime("/etc/openclash/Model.bin"))..bold_off..font_off
o.title = translate("Update Model")
o.inputtitle = translate("Check And Update")
o.inputstyle = "reload"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
SYS.call("/usr/share/openclash/openclash_lgbm.sh >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
o = s:taboption("smart", DummyValue, "flush_smart_cache", translate("Flush Smart Cache"))
o.template = "openclash/flush_smart_cache"
---- Rules Settings
o = s:taboption("rules", Flag, "rule_source", translate("Enable Other Rules"))
o.description = translate("Use Other Rules")
o.default = 0
o = s:taboption("rules", Flag, "enable_rule_proxy", translate("Rule Match Proxy Mode"))
o.description = translate("Append Some Rules to Config, Allow Only Traffic Proxies that Match the Rule, Prevent BT/P2P Passing")
o.default = 0
o = s:taboption("rules", Flag, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules")..bold_off..font_off)
o.description = translate("Use Custom Rules")
o.default = 0
custom_rules = s:taboption("rules", Value, "custom_rules")
custom_rules:depends("enable_custom_clash_rules", 1)
custom_rules.template = "cbi/tvalue"
custom_rules.description = font_green..bold_on..translate("(Priority)")..bold_off..font_off.." "..translate("Custom Rules Here, For More Go:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/config/rules/\")'>https://wiki.metacubex.one/config/rules/</a>".." ,"..translate("IP To CIDR:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"http://ip2cidr.com\")'>http://ip2cidr.com</a>"
custom_rules.rows = 20
custom_rules.wrap = "off"
function custom_rules.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list") or ""
end
function custom_rules.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules.list", value)
end
end
end
custom_rules_2 = s:taboption("rules", Value, "custom_rules_2")
custom_rules_2:depends("enable_custom_clash_rules", 1)
custom_rules_2.template = "cbi/tvalue"
custom_rules_2.description = font_green..bold_on..translate("(Extended)")..bold_off..font_off.." "..translate("Custom Rules Here, For More Go:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/config/rules/\")'>https://wiki.metacubex.one/config/rules/</a>".." ,"..translate("IP To CIDR:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"http://ip2cidr.com\")'>http://ip2cidr.com</a>"
custom_rules_2.rows = 20
custom_rules_2.wrap = "off"
function custom_rules_2.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules_2.list") or ""
end
function custom_rules_2.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_rules_2.list")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules_2.list", value)
end
end
end
---- developer
o = s:taboption("developer", Value, "ymchange_custom")
o.template = "cbi/tvalue"
o.description = translate("Custom Config Overwrite Scripts Which Will Run After Plugin Own Completely, Please Be Careful, The Wrong Changes May Lead to Exceptions")
o.rows = 30
o.wrap = "off"
function o.cfgvalue(self, section)
return NXFS.readfile("/etc/openclash/custom/openclash_custom_overwrite.sh") or ""
end
function o.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile("/etc/openclash/custom/openclash_custom_overwrite.sh")
if value ~= old_value then
NXFS.writefile("/etc/openclash/custom/openclash_custom_overwrite.sh", value)
end
end
end
-- [[ Edit Custom DNS ]] --
ds = m:section(TypedSection, "dns_servers", translate("Add Custom DNS Servers")..translate("(Take Effect After Choose Above)"))
ds.anonymous = true
ds.addremove = true
ds.sortable = true
ds.template = "openclash/tblsection_dns"
ds.extedit = luci.dispatcher.build_url("admin/services/openclash/custom-dns-edit/%s")
function ds.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(ds.extedit % sid)
return
end
end
---- enable flag
o = ds:option(Flag, "enabled", translate("Enable"))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
---- group
o = ds:option(ListValue, "group", translate("DNS Server Group"))
o:value("nameserver", translate("NameServer "))
o:value("fallback", translate("FallBack "))
o:value("default", translate("Default-NameServer"))
o.default = "nameserver"
o.rempty = false
---- IP address
o = ds:option(Value, "ip", translate("DNS Server Address"))
o.placeholder = translate("Not Null")
o.datatype = "or(host, string)"
o.rmempty = true
---- port
o = ds:option(Value, "port", translate("DNS Server Port"))
o.datatype = "port"
o.rempty = true
---- type
o = ds:option(ListValue, "type", translate("DNS Server Type"))
o:value("udp", translate("UDP"))
o:value("tcp", translate("TCP"))
o:value("tls", translate("TLS"))
o:value("https", translate("HTTPS"))
o:value("quic", translate("QUIC"))
o.default = "udp"
o.rempty = false
---- Disable-IPv6
o = ds:option(Flag, "disable_ipv6", translate("Disable-IPv6"))
o.rmempty = false
o.default = o.disbled
-- [[ Other Rules Manage ]]--
ss = m:section(TypedSection, "other_rules", translate("Other Rules Edit")..translate("(Take Effect After Choose Above)"))
ss.anonymous = true
ss.addremove = true
ss.sortable = true
ss.template = "cbi/tblsection"
ss.extedit = luci.dispatcher.build_url("admin/services/openclash/other-rules-edit/%s")
function ss.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(ss.extedit % sid)
return
end
end
ss.render = function(self, ...)
Map.render(self, ...)
if type(optimize_cbi_ui) == "function" then
optimize_cbi_ui()
end
end
o = ss:option(Flag, "enabled", translate("Enable"))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
o = ss:option(DummyValue, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = ss:option(DummyValue, "rule_name", translate("Other Rules Name"))
function o.cfgvalue(...)
if Value.cfgvalue(...) == "lhie1" then
return translate("lhie1 Rules")
else
return translate("None")
end
end
o = ss:option(DummyValue, "Note", translate("Note"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
-- [[ Edit Authentication ]] --
s = m:section(TypedSection, "authentication", translate("Set Authentication of SOCKS5/HTTP(S)"))
s.anonymous = true
s.addremove = true
s.sortable = false
s.template = "cbi/tblsection"
s.rmempty = false
s.render = function(self, ...)
Map.render(self, ...)
if type(optimize_cbi_ui) == "function" then
optimize_cbi_ui()
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
---- username
o = s:option(Value, "username", translate("Username"))
o.placeholder = translate("Not Null")
o.rempty = true
---- password
o = s:option(Value, "password", translate("Password"))
o.placeholder = translate("Not Null")
o.rmempty = true
local t = {
{Commit, Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit("openclash")
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Apply Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
m:append(Template("openclash/config_editor"))
m:append(Template("openclash/toolbar_show"))
return m
@@ -0,0 +1,226 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "luci.openclash"
local sys = require "luci.sys"
local json = require "luci.jsonc"
local sid = arg[1]
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map(openclash, translate("Config Subscribe Edit"))
m.pageaction = false
m.description=translate("Convert Subscribe function of Online is Supported By subconverter Written By tindy X") ..
"<br/>"..
"<br/>"..translate("API By tindy X & lhie1")..
"<br/>"..
"<br/>"..translate("Subconverter external configuration (subscription conversion template) Description: https://github.com/tindy2013/subconverter#external-configuration-file")..
"<br/>"..
"<br/>"..translate("If you need to customize the external configuration file (subscription conversion template), please write it according to the instructions, upload it to the accessible location of the external network, and fill in the address correctly when using it")..
"<br/>"..
"<br/>"..translate("If you have a recommended external configuration file (subscription conversion template), you can modify by following The file format of /usr/share/openclash/res/sub_ini.list and pr")
m.redirect = luci.dispatcher.build_url("admin/services/openclash/config-subscribe")
if m.uci:get(openclash, sid) ~= "config_subscribe" then
luci.http.redirect(m.redirect)
return
end
-- [[ Config Subscribe Setting ]]--
s = m:section(NamedSection, sid, "config_subscribe")
s.anonymous = true
s.addremove = false
---- name
o = s:option(Value, "name", translate("Config Alias"))
o.description = font_red..bold_on..translate("Name For Distinguishing")..bold_off..font_off
o.placeholder = translate("config")
o.rmempty = true
---- address
o = s:option(Value, "address", translate("Subscribe Address"))
o.template = "cbi/tvalue"
o.rows = 10
o.wrap = "off"
o.description = font_red..bold_on..translate("SS/SSR/Vmess or Other Link And Subscription Address is Supported When Online Subscription Conversion is Enabled, Multiple Links Should be One Per Line or Separated By |")..bold_off..font_off
o.placeholder = translate("Not Null")
o.rmempty = false
function o.validate(self, value)
if value then
value = value:gsub("\r\n?", "\n")
value = value:gsub("%c*$", "")
end
return value
end
local sub_path = "/tmp/dler_sub"
local info, token, get_sub, sub_info
local token = fs.uci_get_config("config", "dler_token")
if token then
get_sub = string.format("curl -sL -H 'Content-Type: application/json' --connect-timeout 2 -d '{\"access_token\":\"%s\"}' -X POST https://dler.cloud/api/v1/managed/clash -o %s", token, sub_path)
if not nixio.fs.access(sub_path) then
luci.sys.exec(get_sub)
else
if fs.readfile(sub_path) == "" or not fs.readfile(sub_path) then
luci.sys.exec(get_sub)
end
end
sub_info = fs.readfile(sub_path)
if sub_info then
sub_info = json.parse(sub_info)
end
if sub_info and sub_info.ret == 200 then
o:value(sub_info.smart)
o:value(sub_info.ss)
o:value(sub_info.vmess)
o:value(sub_info.trojan)
else
fs.unlink(sub_path)
end
end
---- UA
o = s:option(Value, "sub_ua", "User-Agent")
o.description = font_red..bold_on..translate("Used for Downloading Subscriptions, Defaults to Clash")..bold_off..font_off
o:value("clash.meta")
o:value("clash-verge/v1.5.1")
o:value("Clash")
o.default = "clash.meta"
o.rmempty = true
---- subconverter
o = s:option(Flag, "sub_convert", translate("Subscribe Convert Online"))
o.description = translate("Convert Subscribe Online With Template")
o.default = 0
---- Convert Address
o = s:option(Value, "convert_address", translate("Convert Address"))
o.rmempty = true
o.description = font_red..bold_on..translate("Note: There is A Risk of Privacy Leakage in Online Convert")..bold_off..font_off
o:depends("sub_convert", "1")
o:value("https://api.dler.io/sub", translate("api.dler.io")..translate("(Default)"))
o:value("https://api.wcc.best/sub", translate("api.wcc.best"))
o:value("https://api.asailor.org/sub", translate("api.asailor.org"))
o.default = "https://api.dler.io/sub"
o.placeholder = "https://api.dler.io/sub"
---- Template
o = s:option(ListValue, "template", translate("Template Name"))
o.rmempty = true
o:depends("sub_convert", "1")
file = io.open("/usr/share/openclash/res/sub_ini.list", "r");
for l in file:lines() do
if l ~= "" and l ~= nil then
o:value(string.sub(luci.sys.exec(string.format("echo '%s' |awk -F ',' '{print $1}' 2>/dev/null",l)),1,-2))
end
end
file:close()
o:value("0", translate("Custom Template"))
---- Custom Template
o = s:option(Value, "custom_template_url", translate("Custom Template URL"))
o.rmempty = true
o.placeholder = translate("Not Null")
o.datatype = "or(host, string)"
o:depends("template", "0")
---- emoji
o = s:option(ListValue, "emoji", translate("Emoji"))
o.rmempty = false
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o:depends("sub_convert", "1")
---- udp
o = s:option(ListValue, "udp", translate("UDP Enable"))
o.rmempty = false
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o:depends("sub_convert", "1")
---- skip-cert-verify
o = s:option(ListValue, "skip_cert_verify", translate("skip-cert-verify"))
o.rmempty = false
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o:depends("sub_convert", "1")
---- sort
o = s:option(ListValue, "sort", translate("Sort"))
o.rmempty = false
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o:depends("sub_convert", "1")
---- node type
o = s:option(ListValue, "node_type", translate("Append Node Type"))
o.rmempty = false
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o:depends("sub_convert", "1")
---- rule provider
o = s:option(ListValue, "rule_provider", translate("Use Rule Provider"))
o.description = font_red..bold_on..translate("Note: Please Make Sure Backend Service Supports This Feature")..bold_off..font_off
o.rmempty = false
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o:depends("sub_convert", "1")
---- custom params
o = s:option(DynamicList, "custom_params", translate("Custom Params"))
o.description = font_red..bold_on..translate("eg: \"rename=match@replace\" , \"rename=\\s+([2-9])[xX]@ (HIGH:$1)\"")..bold_off..font_off
o.rmempty = false
o:depends("sub_convert", "1")
---- key
o = s:option(DynamicList, "keyword", font_red..bold_on..translate("Keyword Match")..bold_off..font_off)
o.description = font_red..bold_on..translate("eg: hk or tw&bgp")..bold_off..font_off
o.rmempty = true
---- exkey
o = s:option(DynamicList, "ex_keyword", font_red..bold_on..translate("Exclude Keyword Match")..bold_off..font_off)
o.description = font_red..bold_on..translate("eg: hk or tw&bgp")..bold_off..font_off
o.rmempty = true
---- de_exkey
o = s:option(MultiValue, "de_ex_keyword", font_red..bold_on..translate("Exclude Keyword Match Default")..bold_off..font_off)
o.rmempty = true
o:value("过期时间")
o:value("剩余流量")
o:value("TG群")
o:value("官网")
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash, sid)
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/toolbar_show"))
return m
@@ -0,0 +1,178 @@
local m, s, o
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
-- 优化 CBI UI(新版 LuCI 专用)
local function optimize_cbi_ui()
luci.http.write([[
<script type="text/javascript">
// 修正上移、下移按钮名称
document.querySelectorAll("input.btn.cbi-button.cbi-button-up").forEach(function(btn) {
btn.value = "]] .. translate("Move up") .. [[";
});
document.querySelectorAll("input.btn.cbi-button.cbi-button-down").forEach(function(btn) {
btn.value = "]] .. translate("Move down") .. [[";
});
// 删除控件和说明之间的多余换行
document.querySelectorAll("div.cbi-value-description").forEach(function(descDiv) {
var prev = descDiv.previousSibling;
while (prev && prev.nodeType === Node.TEXT_NODE && prev.textContent.trim() === "") {
prev = prev.previousSibling;
}
if (prev && prev.nodeType === Node.ELEMENT_NODE && prev.tagName === "BR") {
prev.remove();
}
});
</script>
]])
end
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map("openclash", translate("Config Subscribe"))
m.pageaction = false
s = m:section(TypedSection, "openclash")
s.anonymous = true
---- update Settings
o = s:option(Flag, "auto_update", translate("Auto Update"))
o.description = translate("Auto Update Server subscription")
o.default = 0
o = s:option(ListValue, "config_auto_update_mode", translate("Update Mode"))
o:depends("auto_update", "1")
o:value("0", translate("Appointment Mode"))
o:value("1", translate("Loop Mode"))
o.default = "0"
o.rmempty = true
o = s:option(ListValue, "config_update_week_time", translate("Update Time (Every Week)"))
o:depends("config_auto_update_mode", "0")
o:value("*", translate("Every Day"))
o:value("1", translate("Every Monday"))
o:value("2", translate("Every Tuesday"))
o:value("3", translate("Every Wednesday"))
o:value("4", translate("Every Thursday"))
o:value("5", translate("Every Friday"))
o:value("6", translate("Every Saturday"))
o:value("0", translate("Every Sunday"))
o.default = "1"
o.rmempty = true
o = s:option(ListValue, "auto_update_time", translate("Update time (every day)"))
o:depends("config_auto_update_mode", "0")
for t = 0,23 do
o:value(t, t..":00")
end
o.default = "0"
o.rmempty = true
o = s:option(Value, "config_update_interval", translate("Update Interval(min)"))
o.default = "60"
o.datatype = "integer"
o:depends("config_auto_update_mode", "1")
o.rmempty = true
-- [[ Edit Server ]] --
s = m:section(TypedSection, "config_subscribe", translate("Config Subscribe Edit"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "cbi/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/openclash/config-subscribe-edit/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
end
end
s.render = function(self, ...)
Map.render(self, ...)
if type(optimize_cbi_ui) == "function" then
optimize_cbi_ui()
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
---- name
o = s:option(DummyValue, "name", translate("Config Alias"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("config")
end
---- address
o = s:option(TextValue, "address", translate("Subscribe Address"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
---- template
o = s:option(DummyValue, "template", translate("Template Name"))
function o.cfgvalue(...)
if Value.cfgvalue(...) ~= "0" then
return Value.cfgvalue(...) or translate("None")
else
return translate("Custom Template")
end
end
---- update
o = s:option(DummyValue, "name", translate("Update"))
o.template = "openclash/update_config"
local t = {
{Commit, Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
fs.unlink("/tmp/Proxy_Group")
m.uci:commit("openclash")
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Update Config")
o.inputstyle = "apply"
o.write = function()
fs.unlink("/tmp/Proxy_Group")
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
uci:foreach("openclash", "config_subscribe",
function(s)
if s.name ~= "" and s.name ~= nil and s.enabled == "1" then
local back_cfg_path_yaml="/etc/openclash/backup/" .. s.name .. ".yaml"
local back_cfg_path_yml="/etc/openclash/backup/" .. s.name .. ".yml"
fs.unlink(back_cfg_path_yaml)
fs.unlink(back_cfg_path_yml)
end
end)
SYS.call("/usr/share/openclash/openclash.sh >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
m:append(Template("openclash/toolbar_show"))
return m
@@ -0,0 +1,454 @@
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require("luci.model.uci").cursor()
local CHIF = "0"
font_green = [[<b style=color:green>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
align_mid = [[<p align="center">]]
align_mid_off = [[</p>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
function default_config_set(f)
local cf = fs.uci_get_config("config", "config_path")
if cf == "/etc/openclash/config/"..f or not cf or cf == "" or not fs.isfile(cf) then
if CHIF == "1" and cf == "/etc/openclash/config/"..f then
return
end
local fis = fs.glob("/etc/openclash/config/*")[1]
if fis ~= nil then
fcf = fs.basename(fis)
if fcf then
uci:set("openclash", "config", "config_path", "/etc/openclash/config/"..fcf)
uci:commit("openclash")
end
else
uci:set("openclash", "config", "config_path", "/etc/openclash/config/config.yaml")
uci:commit("openclash")
end
end
end
ful = SimpleForm("upload", translate("Config Manage"), nil)
ful.reset = false
ful.submit = false
sul =ful:section(SimpleSection, "")
o = sul:option(FileUpload, "")
o.template = "openclash/upload"
um = sul:option(DummyValue, "", nil)
um.template = "openclash/dvalue"
local dir, fd, clash
clash = "/etc/openclash/clash"
dir = "/etc/openclash/config/"
bakck_dir="/etc/openclash/backup"
proxy_pro_dir="/etc/openclash/proxy_provider/"
rule_pro_dir="/etc/openclash/rule_provider/"
core_dir="/etc/openclash/core/core/"
backup_dir="/tmp/"
create_bakck_dir=fs.mkdir(bakck_dir)
create_proxy_pro_dir=fs.mkdir(proxy_pro_dir)
create_rule_pro_dir=fs.mkdir(rule_pro_dir)
HTTP.setfilehandler(
function(meta, chunk, eof)
local fp = HTTP.formvalue("file_type")
if not fd then
if not meta then return end
if fp == "config" then
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
elseif fp == "proxy-provider" then
if meta and chunk then fd = nixio.open(proxy_pro_dir .. meta.file, "w") end
elseif fp == "rule-provider" then
if meta and chunk then fd = nixio.open(rule_pro_dir .. meta.file, "w") end
elseif fp == "clash_meta" then
create_core_dir=fs.mkdir(core_dir)
if meta and chunk then fd = nixio.open(core_dir .. meta.file, "w") end
elseif fp == "backup-file" then
if meta and chunk then fd = nixio.open(backup_dir .. meta.file, "w") end
end
if not fd then
um.value = translate("upload file error.")
return
end
end
if chunk and fd then
fd:write(chunk)
end
if eof and fd then
fd:close()
fd = nil
if fp == "config" then
CHIF = "1"
if IsYamlFile(meta.file) then
local yamlbackup="/etc/openclash/backup/" .. meta.file
local c=fs.copy(dir .. meta.file,yamlbackup)
default_config_set(meta.file)
end
if IsYmlFile(meta.file) then
local ymlname=string.lower(string.sub(meta.file,0,-5))
local ymlbackup="/etc/openclash/backup/".. ymlname .. ".yaml"
local c=fs.rename(dir .. meta.file,"/etc/openclash/config/".. ymlname .. ".yaml")
local c=fs.copy("/etc/openclash/config/".. ymlname .. ".yaml",ymlbackup)
local yamlname=ymlname .. ".yaml"
default_config_set(yamlname)
end
um.value = translate("File saved to") .. ' "/etc/openclash/config/"'
elseif fp == "proxy-provider" then
um.value = translate("File saved to") .. ' "/etc/openclash/proxy_provider/"'
elseif fp == "rule-provider" then
um.value = translate("File saved to") .. ' "/etc/openclash/rule_provider/"'
elseif fp == "clash_meta" then
local archive_path = core_dir .. meta.file
if string.lower(string.sub(meta.file, -7, -1)) == ".tar.gz" then
-- tar.gz
os.execute(string.format("tar -C '/etc/openclash/core/core' -xzf '%s' >/dev/null 2>&1", archive_path))
os.execute(string.format("rm -f '%s' >/dev/null 2>&1", archive_path))
local first_file_cmd = "find /etc/openclash/core/core -type f ! -name '*.tar.gz' ! -name '*.tar' ! -name '*.gz' 2>/dev/null | head -1"
local first_file = io.popen(first_file_cmd):read("*line")
if first_file and first_file ~= "" then
os.execute(string.format("mv '%s' '/etc/openclash/core/%s' >/dev/null 2>&1", first_file, fp))
end
elseif string.lower(string.sub(meta.file, -4, -1)) == ".tar" then
-- tar
os.execute(string.format("tar -C '/etc/openclash/core/core' -xf '%s' >/dev/null 2>&1", archive_path))
os.execute(string.format("rm -f '%s' >/dev/null 2>&1", archive_path))
local first_file_cmd = "find /etc/openclash/core/core -type f ! -name '*.tar' ! -name '*.gz' 2>/dev/null | head -1"
local first_file = io.popen(first_file_cmd):read("*line")
if first_file and first_file ~= "" then
os.execute(string.format("mv '%s' '/etc/openclash/core/%s' >/dev/null 2>&1", first_file, fp))
end
elseif string.lower(string.sub(meta.file, -3, -1)) == ".gz" then
-- gz
os.execute(string.format("gzip -fd '%s' >/dev/null 2>&1", archive_path))
os.execute(string.format("rm -f '%s' >/dev/null 2>&1", archive_path))
local first_file_cmd = "find /etc/openclash/core/core -type f ! -name '*.gz' 2>/dev/null | head -1"
local first_file = io.popen(first_file_cmd):read("*line")
if first_file and first_file ~= "" then
os.execute(string.format("mv '%s' '/etc/openclash/core/%s' >/dev/null 2>&1", first_file, fp))
end
else
os.execute(string.format("mv '%s' '/etc/openclash/core/%s' >/dev/null 2>&1", (core_dir .. meta.file), fp))
end
os.execute(string.format("chmod 4755 '/etc/openclash/core/%s' >/dev/null 2>&1", fp))
os.execute(string.format("rm -rf %s >/dev/null 2>&1", core_dir))
um.value = translate("File saved to") .. ' "/etc/openclash/core/"'
elseif fp == "backup-file" then
os.execute("tar -C '/etc/openclash/' -xzf %s >/dev/null 2>&1" % (backup_dir .. meta.file))
os.execute("mv /etc/openclash/openclash /etc/config/openclash >/dev/null 2>&1")
fs.unlink(backup_dir .. meta.file)
um.value = translate("Backup File Restore Successful!")
end
fs.unlink("/tmp/Proxy_Group")
end
end
)
if HTTP.formvalue("upload") then
if not um.value then
um.value = translate("No Specify Upload File")
end
end
local e,a={}
for t,o in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(o)
if a then
e[t]={}
e[t].name=fs.basename(o)
BACKUP_FILE="/etc/openclash/backup/".. e[t].name
if fs.mtime(BACKUP_FILE) then
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(BACKUP_FILE))
else
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",a.mtime)
end
if fs.uci_get_config("config", "config_path") and string.sub(fs.uci_get_config("config", "config_path"), 23, -1) == e[t].name then
e[t].state=translate("Enabled")
else
e[t].state=translate("Disabled")
end
e[t].size=fs.filesize(a.size)
e[t].remove=0
end
end
form=SimpleForm("config_file_list",translate("Config File List"))
form.reset=false
form.submit=false
tb=form:section(Table,e)
st=tb:option(DummyValue,"state",translate("State"))
nm=tb:option(DummyValue,"name",translate("Config Alias"))
sb=tb:option(DummyValue,"name",translate("Subscription Info"))
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
sz=tb:option(DummyValue,"size",translate("Size"))
st.template="openclash/cfg_check"
sb.template="openclash/sub_info_show"
btnis=tb:option(Button,"switch",translate("SwiTch"))
btnis.template="openclash/other_button"
btnis.render=function(o,t,a)
if not e[t] then return false end
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
a.display=""
else
a.display="none"
end
o.inputstyle="apply"
Button.render(o,t,a)
end
btnis.write=function(a,t)
fs.unlink("/tmp/Proxy_Group")
uci:set("openclash", "config", "config_path", "/etc/openclash/config/"..e[t].name)
uci:commit("openclash")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config"))
end
btnrn=tb:option(DummyValue,"/etc/openclash/config/",translate("Rename"))
btnrn.template="openclash/input_rename"
btnrn.rawhtml = true
btnrn.render=function(c,t,a)
if not e[t] then return end
c.value = e[t].name
DummyValue.render(c,t,a)
end
local actions = tb:option(ListValue, "actions", translate("Other"))
actions.render = function(self, t, a)
if not e[t] then return end
self.keylist = {}
self.vallist = {}
-- Edit
table.insert(self.keylist, "edit")
table.insert(self.vallist, translate("Edit"))
-- Copy
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
table.insert(self.keylist, "copy")
table.insert(self.vallist, translate("Copy Config"))
end
-- Download
table.insert(self.keylist, "download")
table.insert(self.vallist, translate("Download Config"))
-- Download Running
if NXFS.access("/etc/openclash/"..e[t].name) then
table.insert(self.keylist, "download_run")
table.insert(self.vallist, translate("Download Running Config"))
end
-- Remove
table.insert(self.keylist, "remove")
table.insert(self.vallist, translate("Remove"))
ListValue.render(self, t, a)
end
local btnapply = tb:option(Button, "apply", translate("Apply"))
btnapply.inputstyle = "apply"
btnapply.write = function(self, t)
if not e[t] then return end
local action = self.map:formvalue("cbid." .. self.map.config .. "." .. t .. ".actions")
if action == "edit" then
local file_path = "etc/openclash/config/" .. fs.basename(e[t].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "config", "%s") % file_path)
elseif action == "copy" then
local num = 1
while true do
num = num + 1
if not fs.isfile("/etc/openclash/config/"..fs.filename(e[t].name).."("..num..")"..".yaml") then
fs.copy("/etc/openclash/config/"..e[t].name, "/etc/openclash/config/"..fs.filename(e[t].name).."("..num..")"..".yaml")
break
end
end
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config"))
elseif action == "download" then
local sPath, sFile, fd, block
sPath = "/etc/openclash/config/"..e[t].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then return end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block == 0) then break end
HTTP.write(block)
end
fd:close()
HTTP.close()
elseif action == "download_run" then
local sPath, sFile, fd, block
sPath = "/etc/openclash/"..e[t].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then return end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block == 0) then break end
HTTP.write(block)
end
fd:close()
HTTP.close()
elseif action == "remove" then
fs.unlink("/tmp/Proxy_Group")
fs.unlink("/etc/openclash/backup/"..fs.basename(e[t].name))
fs.unlink("/etc/openclash/history/"..fs.filename(e[t].name)..".db")
fs.unlink("/etc/openclash/"..fs.basename(e[t].name))
local a=fs.unlink("/etc/openclash/config/"..fs.basename(e[t].name))
default_config_set(fs.basename(e[t].name))
if a then table.remove(e,t) end
HTTP.redirect(DISP.build_url("admin", "services", "openclash","config"))
end
end
p = SimpleForm("provider_file_manage",translate("Provider File Manage"))
p.reset = false
p.submit = false
local provider_manage = {
{proxy_mg, rule_mg, game_mg}
}
promg = p:section(Table, provider_manage)
o = promg:option(Button, "proxy_mg", " ")
o.inputtitle = translate("Proxy Provider File List")
o.inputstyle = "reload"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "proxy-provider-file-manage"))
end
o = promg:option(Button, "rule_mg", " ")
o.inputtitle = translate("Rule Providers File List")
o.inputstyle = "reload"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-file-manage"))
end
o = promg:option(Button, "game_mg", " ")
o.inputtitle = translate("Game Rules File List")
o.inputstyle = "reload"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-file-manage"))
end
m = SimpleForm("openclash",translate("Config File Edit"))
m.reset = false
m.submit = false
local tab = {
{user, default}
}
s = m:section(Table, tab)
s.description = align_mid..translate("Support syntax check, press").." "..font_green..bold_on.."F10"..bold_off..font_off.." "..translate("to control diff option, press").." "..font_green..bold_on.."F11"..bold_off..font_off.." "..translate("to enter full screen editing mode")..align_mid_off
s.anonymous = true
s.addremove = false
local conf = fs.uci_get_config("config", "config_path")
local dconf = "/usr/share/openclash/res/default.yaml"
if not conf then conf = "/etc/openclash/config/config.yaml" end
local conf_name = fs.basename(conf)
if not conf_name then conf_name = "config.yaml" end
local sconf = "/etc/openclash/"..conf_name
sev = s:option(TextValue, "user")
---sev.description = align_mid..translate("Modify Your Config file:").." "..font_green..bold_on..conf_name..bold_off..font_off.." "..translate("Here, Except The Settings That Were Taken Over")..align_mid_off
sev.rows = 40
sev.wrap = "off"
sev.cfgvalue = function(self, section)
return NXFS.readfile(conf) or NXFS.readfile(dconf) or ""
end
sev.write = function(self, section, value)
if (CHIF == "0") then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile(conf)
if value ~= old_value then
NXFS.writefile(conf, value)
end
end
end
def = s:option(TextValue, "default")
if fs.isfile(sconf) then
---def.description = align_mid..translate("Config File Edited By OpenClash For Running")..align_mid_off
else
---def.description = align_mid..translate("Default Config File With Correct Template")..align_mid_off
end
def.rows = 40
def.wrap = "off"
def.readonly = true
def.cfgvalue = function(self, section)
return NXFS.readfile(sconf) or NXFS.readfile(dconf) or ""
end
def.write = function(self, section, value)
end
local t = {
{Commit, Create, Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
fs.unlink("/tmp/Proxy_Group")
uci:commit("openclash")
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/config/"
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Apply Settings")
o.inputstyle = "apply"
o.write = function()
fs.unlink("/tmp/Proxy_Group")
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
m:append(Template("openclash/config_editor"))
return ful , form , p , m
@@ -0,0 +1,176 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "luci.openclash"
local SYS = require "luci.sys"
local sid = arg[1]
font_red = [[<b style=color:red>]]
font_green = [[<b style=color:green>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map(openclash, translate("Add Custom DNS Servers"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/config-overwrite")
if m.uci:get(openclash, sid) ~= "dns_servers" then
luci.http.redirect(m.redirect)
return
end
-- [[ Edit Custom DNS ]] --
s = m:section(NamedSection, sid, "dns_servers")
s.anonymous = true
s.addremove = false
---- group
o = s:option(ListValue, "group", translate("DNS Server Group"))
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:value("default", translate("Default-NameServer"))
o.default = "nameserver"
o.rempty = false
---- IP address
o = s:option(Value, "ip", translate("DNS Server Address"))
o.description = translate("Do Not Add Type Ahead")
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.datatype = "port"
o.rempty = true
---- type
o = s:option(ListValue, "type", translate("DNS Server Type"))
o.description = translate("Communication protocol")
o:value("udp", translate("UDP"))
o:value("tcp", translate("TCP"))
o:value("tls", translate("TLS"))
o:value("https", translate("HTTPS"))
o:value("quic", translate("QUIC"))
o.default = "udp"
o.rempty = false
---- interface
o = s:option(Value, "interface", translate("Specific Interface"))
o.description = translate("DNS Lookup Only Through The Specific Interface")
local interfaces = SYS.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
for interface in string.gmatch(interfaces, "%S+") do
o:value(interface)
end
o:value("Disable", translate("Disable"))
o.default = "Disable"
o.rempty = false
---- direct-nameserver
o = s:option(Flag, "direct_nameserver", translate("Direct Nameserver"), translate("Use For Domain Need Direct"))
o.rmempty = false
o.default = o.disbled
---- Node Domain Resolve
o = s:option(Flag, "node_resolve", translate("Node Domain Resolve"), translate("Use For Node Domain Resolve"))
o.rmempty = false
o.default = o.disbled
---- Force HTTP/3
o = s:option(Flag, "http3", translate("Force HTTP/3"), translate("Force HTTP/3 to connect"))
o:depends("type", "https")
o.rmempty = false
o.default = o.disbled
---- Skip-cert-verify
o = s:option(Flag, "skip_cert_verify", translate("skip-cert-verify"), translate("skip-cert-verify"))
o:depends("type", "https")
o:depends("type", "quic")
o.rmempty = false
o.default = o.disbled
---- ECS Subnet
o = s:option(Value, "ecs_subnet", translate("ECS Subnet"),translate("Specify the ECS Subnet Address"))
o:depends("type", "https")
o.rmempty = true
o.datatype = "ipaddr"
o:value("1.1.1.1/24")
---- ECS Override
o = s:option(Flag, "ecs_override", translate("ECS Override"),translate("Override the ECS Subnet Address"))
o:depends("type", "https")
o.rmempty = false
o.default = o.disbled
---- disable-ipv4
o = s:option(Flag, "disable_ipv4", translate("Disable-IPv4"),translate("Drop The Type of DNS Responsed"))
o.rmempty = false
o.default = o.disbled
---- disable-ipv6
o = s:option(Flag, "disable_ipv6", translate("Disable-IPv6"),translate("Drop The Type of DNS Responsed"))
o.rmempty = false
o.default = o.disbled
---- disable-qtype
o = s:option(DynamicList, "disable_qtype", translate("Disable-Qtype"),translate("Drop The Type of DNS Responsed"))
o.rmempty = true
o.datatype = "uinteger"
o.default = o.disbled
---- Proxy group
o = s:option(Value, "specific_group", translate("Specific Group (Support Regex)"))
o.description = translate("Group Use For Proxy The DNS")
o:depends("group", "nameserver")
o:depends("group", "fallback")
local groupnames,filename
filename = m.uci:get(openclash, "config", "config_path")
if filename then
groupnames = SYS.exec(string.format('ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "YAML.load_file(\'%s\')[\'proxy-groups\'].each do |i| puts i[\'name\']+\'##\' end" 2>/dev/null',filename))
if groupnames then
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
o:value(groupname)
end
end
end
end
m.uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil then
o:value(s.name)
end
end)
o:value("DIRECT")
o:value("GLOBAL")
o:value("Disable", translate("Disable"))
o.default = "Disable"
o.rempty = false
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash, sid)
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/toolbar_show"))
return m
@@ -0,0 +1,123 @@
local rule_form
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
local g,h={}
for n,m in ipairs(fs.glob("/etc/openclash/game_rules/*"))do
h=fs.stat(m)
if h then
g[n]={}
g[n].num=string.format(n)
g[n].name=fs.basename(m)
g[n].mtime=os.date("%Y-%m-%d %H:%M:%S",h.mtime)
g[n].size=fs.filesize(h.size)
g[n].remove=0
g[n].enable=false
end
end
rule_form=SimpleForm("game_rules_file_list",translate("Game Rules File List"))
rule_form.reset=false
rule_form.submit=false
tb2=rule_form:section(Table,g)
nu2=tb2:option(DummyValue,"num",translate("Serial Number"))
nm2=tb2:option(DummyValue,"name",translate("File Name"))
mt2=tb2:option(DummyValue,"mtime",translate("Update Time"))
sz2=tb2:option(DummyValue,"size",translate("Size"))
btned1=tb2:option(Button,"edit",translate("Edit"))
btned1.render=function(g,n,h)
g.inputstyle="apply"
Button.render(g,n,h)
end
btned1.write=function(h,n)
local file_path = "etc/openclash/game_rules/" .. fs.basename(g[n].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "game-rules-file-manage", "%s") %file_path)
end
btndl2 = tb2:option(Button,"download2",translate("Download Config"))
btndl2.template="openclash/other_button"
btndl2.render=function(m,n,h)
m.inputstyle="remove"
Button.render(m,n,h)
end
btndl2.write = function (h,n)
local sPath, sFile, fd, block
sPath = "/etc/openclash/game_rules/"..g[n].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then
return
end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block ==0) then
break
else
HTTP.write(block)
end
end
fd:close()
HTTP.close()
end
btnrm2=tb2:option(Button,"remove2",translate("Remove"))
btnrm2.render=function(g,n,h)
g.inputstyle="reset"
Button.render(g,n,h)
end
btnrm2.write=function(h,n)
local h=fs.unlink("/etc/openclash/game_rules/"..luci.openclash.basename(g[n].name))
if h then table.remove(g,n)end
return h
end
local t = {
{Refresh, Create, Delete_all, Apply}
}
a = rule_form:section(Table, t)
o = a:option(Button, "Refresh", " ")
o.inputtitle = translate("Refresh Page")
o.inputstyle = "apply"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-file-manage"))
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/game_rules/"
o = a:option(Button, "Delete_all", " ")
o.inputtitle = translate("Delete All File")
o.inputstyle = "remove"
o.write = function()
luci.sys.call("rm -rf /etc/openclash/game_rules/* >/dev/null 2>&1")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-file-manage"))
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "config"))
end
rule_form:append(Template("openclash/toolbar_show"))
return rule_form
@@ -0,0 +1,100 @@
local form, m
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
m = SimpleForm("openclash", translate("Game Rules List"))
m.description=translate("Rule Project:").." SSTap-Rule ( https://github.com/FQrabbit/SSTap-Rule )"
m.reset = false
m.submit = false
local t = {
{Refresh, Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Refresh", " ")
o.inputtitle = translate("Refresh Page")
o.inputstyle = "apply"
o.write = function()
SYS.call("rm -rf /tmp/rules_name 2>/dev/null")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-manage"))
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-settings"))
end
if not NXFS.access("/tmp/rules_name") then
SYS.call("awk -F ',' '{print $1}' /usr/share/openclash/res/game_rules.list > /tmp/rules_name 2>/dev/null")
end
file = io.open("/tmp/rules_name", "r");
---- Rules List
local e={},o,t
if NXFS.access("/tmp/rules_name") then
for o in file:lines() do
table.insert(e,o)
end
for t,o in ipairs(e) do
e[t]={}
e[t].num=string.format(t)
e[t].name=o
e[t].filename=string.sub(luci.sys.exec(string.format("grep -F '%s,' /usr/share/openclash/res/game_rules.list |awk -F ',' '{print $3}' 2>/dev/null",e[t].name)),1,-2)
if e[t].filename == "" then
e[t].filename=string.sub(luci.sys.exec(string.format("grep -F '%s,' /usr/share/openclash/res/game_rules.list |awk -F ',' '{print $2}' 2>/dev/null",e[t].name)),1,-2)
end
RULE_FILE="/etc/openclash/game_rules/".. e[t].filename
if fs.mtime(RULE_FILE) then
e[t].size=fs.filesize(fs.stat(RULE_FILE).size)
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(RULE_FILE))
else
e[t].size="/"
e[t].mtime="/"
end
if fs.isfile(RULE_FILE) then
e[t].exist=translate("Exist")
else
e[t].exist=translate("Not Exist")
end
e[t].remove=0
end
end
file:close()
form=SimpleForm("filelist")
form.reset=false
form.submit=false
tb=form:section(Table,e)
nu=tb:option(DummyValue,"num",translate("Serial Number"))
st=tb:option(DummyValue,"exist",translate("State"))
st.template="openclash/cfg_check"
nm=tb:option(DummyValue,"name",translate("Rule Name"))
fm=tb:option(DummyValue,"filename",translate("File Name"))
sz=tb:option(DummyValue,"size",translate("Size"))
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
btnis=tb:option(DummyValue,"filename",translate("Download Rule"))
btnis.template="openclash/download_rule"
btnrm=tb:option(Button,"remove",translate("Remove"))
btnrm.render=function(e,t,a)
e.inputstyle="reset"
Button.render(e,t,a)
end
btnrm.write=function(a,t)
fs.unlink("/etc/openclash/game_rules/"..e[t].filename)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-manage"))
end
return m, form
@@ -0,0 +1,221 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "luci.openclash"
local sys = require "luci.sys"
local sid = arg[1]
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
m = Map(openclash, translate("Edit Group"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/servers")
if m.uci:get(openclash, sid) ~= "groups" then
luci.http.redirect(m.redirect)
return
end
-- [[ Groups Setting ]]--
s = m:section(NamedSection, sid, "groups")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
o = s:option(ListValue, "type", translate("Group Type"))
o.rmempty = false
o.description = translate("Choose The Operation Mode")
o:value("select", translate("Manual-Select"))
o:value("smart", translate("Smart-Select"))
o:value("url-test", translate("URL-Test"))
o:value("fallback", translate("Fallback"))
o:value("load-balance", translate("Load-Balance"))
o = s:option(Value, "name", translate("Group Name"))
o.rmempty = false
o.default = "Group - "..sid
o = s:option(ListValue, "disable_udp", translate("Disable UDP"))
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o.rmempty = true
o = s:option(Value, "test_url", translate("Test URL"))
o:value("http://cp.cloudflare.com/generate_204")
o:value("http://www.gstatic.com/generate_204")
o:value("https://cp.cloudflare.com/generate_204")
o.rmempty = true
o:depends("type", "url-test")
o:depends("type", "fallback")
o:depends("type", "load-balance")
o:depends("type", "smart")
o = s:option(Value, "test_interval", translate("Test Interval(s)"))
o.default = "300"
o.rmempty = true
o:depends("type", "url-test")
o:depends("type", "fallback")
o:depends("type", "load-balance")
o:depends("type", "smart")
o = s:option(ListValue, "strategy", translate("Strategy Type"))
o.rmempty = true
o.description = translate("Choose The Load-Balance's Strategy Type")
o:value("round-robin", translate("Round-robin"))
o:value("consistent-hashing", translate("Consistent-hashing"))
o:value("sticky-sessions", translate("Sticky-sessions"))
o:depends("type", "load-balance")
o = s:option(ListValue, "uselightgbm", translate("Uselightgbm"))
o.description = translate("Use LightGBM Model For Smart Group Weight Prediction")
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o.rmempty = true
o:depends("type", "smart")
o = s:option(ListValue, "collectdata", translate("Collectdata"))
o.description = translate("Collect Datas For Smart Group Model Training")
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = "false"
o.rmempty = true
o:depends("type", "smart")
o = s:option(Value, "policy_priority", translate("Policy Priority"))
o.description = translate("The Priority Of The Nodes, The Higher Than 1, The More Likely It Is To Be Selected, The Default Is 1, Support Regex")
o.rmempty = true
o.placeholder = "Premium:0.9;SG:1.3"
o.rmempty = true
o:depends("type", "smart")
o = s:option(Value, "tolerance", translate("Tolerance(ms)"))
o.default = "150"
o.rmempty = true
o:depends("type", "url-test")
o = s:option(Value, "policy_filter", translate("Provider Filter"))
o.rmempty = true
o.placeholder = "bgp|sg"
o = s:option(Value, "icon", translate("Icon"))
o.rmempty = true
-- [[ other-setting ]]--
o = s:option(Value, "other_parameters", translate("Other Parameters"))
o.template = "cbi/tvalue"
o.rows = 20
o.wrap = "off"
o.description = font_red..bold_on..translate("Edit Your Other Parameters Here")..bold_off..font_off
o.rmempty = true
function o.cfgvalue(self, section)
if self.map:get(section, "other_parameters") == nil then
return "# Example:\n"..
"# Only support YAML, four spaces need to be reserved at the beginning of each line to maintain formatting alignment\n"..
"# 示例:\n"..
"# 仅支持 YAML, 每行行首需要多保留四个空格以使脚本处理后能够与上方配置保持格式对齐\n"..
"# type: select\n"..
"# proxies:\n"..
"# - DIRECT\n"..
"# - ss\n"..
"# use:\n"..
"# - provider1\n"..
"# - provider1\n"..
"# url: 'https://www.gstatic.com/generate_204'\n"..
"# interval: 300\n"..
"# lazy: true\n"..
"# timeout: 5000\n"..
"# max-failed-times: 5\n"..
"# disable-udp: true\n"..
"# interface-name: en0\n"..
"# routing-mark: 11451\n"..
"# include-all: false\n"..
"# include-all-proxies: false\n"..
"# include-all-providers: false\n"..
"# filter: \"(?i)港|hk|hongkong|hong kong\"\n"..
"# exclude-filter: \"美|日\"\n"..
"# exclude-type: \"Shadowsocks|Http\"\n"..
"# expected-status: 204\n"..
"# hidden: true\n"..
"# icon: xxx"
else
return Value.cfgvalue(self, section)
end
end
function o.validate(self, value)
if value then
value = value:gsub("\r\n?", "\n")
value = value:gsub("%c*$", "")
end
return value
end
o = s:option(DynamicList, "other_group", translate("Other Group (Support Regex)"))
o.description = font_red..bold_on..translate("The Added Proxy Groups Must Exist Except 'DIRECT' & 'REJECT' & 'REJECT-DROP' & 'PASS' & 'GLOBAL'")..bold_off..font_off
o:value("all", translate("All Groups"))
uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil and s.name ~= m.uci:get(openclash, sid, "name") then
o:value(s.name)
end
end)
o:value("DIRECT")
o:value("REJECT")
o:value("REJECT-DROP")
o:value("PASS")
o:value("GLOBAL")
o.rmempty = true
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
sys.call("/usr/share/openclash/yml_groups_name_ch.sh")
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash, sid)
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/toolbar_show"))
m:append(Template("openclash/config_editor"))
return m
@@ -0,0 +1,22 @@
--
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
m = Map("openclash", translate("Server Logs"))
s = m:section(TypedSection, "openclash")
m.pageaction = false
s.anonymous = true
s.addremove=false
log = s:option(TextValue, "clog")
log.readonly=true
log.pollcheck=true
log.template="openclash/log"
log.description = translate("")
log.rows = 29
m:append(Template("openclash/toolbar_show"))
m:append(Template("openclash/config_editor"))
return m
@@ -0,0 +1,73 @@
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local fs = require "luci.openclash"
local file_path = ""
local edit_file_name = "/tmp/openclash_edit_file_name"
for i = 2, #(arg) do
file_path = file_path .. "/" .. luci.http.urlencode(arg[i])
end
if not fs.isfile(file_path) and file_path ~= "" then
file_path = luci.http.urldecode(file_path)
end
--re-get file path to save
if NXFS.readfile(edit_file_name) ~= file_path and fs.isfile(file_path) then
NXFS.writefile(edit_file_name, file_path)
else
if not fs.isfile(file_path) and fs.isfile(edit_file_name) then
file_path = NXFS.readfile(edit_file_name)
fs.unlink(edit_file_name)
end
end
m = Map("openclash", translate("File Edit"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/"..arg[1])
s = m:section(TypedSection, "openclash")
s.anonymous = true
s.addremove=false
o = s:option(TextValue, "edit_file")
o.rows = 50
o.wrap = "off"
function o.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
local old_value = NXFS.readfile(file_path)
if value ~= old_value then
NXFS.writefile(file_path, value)
end
end
end
function o.cfgvalue(self, section)
return NXFS.readfile(file_path) or ""
end
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button, "Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/config_editor"))
m:append(Template("openclash/toolbar_show"))
return m
@@ -0,0 +1,347 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "luci.openclash"
local sys = require "luci.sys"
local sid = arg[1]
font_red = [[<b style=color:red>]]
font_green = [[<b style=color:green>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
m = Map(openclash, translate("Other Rules Edit"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/config-overwrite")
if m.uci:get(openclash, sid) ~= "other_rules" then
luci.http.redirect(m.redirect)
return
end
-- [[ Other Rules Setting ]]--
s = m:section(NamedSection, sid, "other_rules")
s.anonymous = true
s.addremove = false
o = s:option(Value, "Note", translate("Note"))
o.default = "default"
o.rmempty = false
o = s:option(ListValue, "config", translate("Config File"))
local e,a={}
local groupnames,filename
local group_list = {}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
if e[t].name == m.uci:get(openclash, sid, "config") then
filename = e[t].name
groupnames = sys.exec(string.format('ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "YAML.load_file(\'%s\')[\'proxy-groups\'].each do |i| puts i[\'name\']+\'##\' end" 2>/dev/null',f))
if groupnames then
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
table.insert(group_list, groupname)
end
end
end
end
end
end
m.uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil then
table.insert(group_list, s.name)
end
end)
table.sort(group_list)
table.insert(group_list, "DIRECT")
table.insert(group_list, "REJECT")
table.insert(group_list, "REJECT-DROP")
table.insert(group_list, "PASS")
table.insert(group_list, "GLOBAL")
o = s:option(Button, translate("Get Group Names"))
o.title = translate("Get Group Names")
o.inputtitle = translate("Get Group Names")
o.description = translate("Get Group Names After Select Config File")
o.inputstyle = "reload"
o.write = function()
m.uci:commit("openclash")
luci.http.redirect(luci.dispatcher.build_url("admin/services/openclash/other-rules-edit/%s") % sid)
end
if group_list ~= nil and filename ~= nil then
o = s:option(ListValue, "rule_name", translate("Other Rules Name"))
o.rmempty = true
o:value("lhie1", translate("lhie1 Rules"))
o = s:option(ListValue, "GlobalTV", translate("GlobalTV"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "AsianTV", translate("AsianTV"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "MainlandTV", translate("CN Mainland TV"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Proxy", translate("Proxy"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Youtube", translate("Youtube"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Bilibili", translate("Bilibili"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Bahamut", translate("Bahamut"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "HBOMax", translate("HBO Max"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Pornhub", translate("Pornhub"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Apple", translate("Apple"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "AppleTV", translate("Apple TV"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "GoogleFCM", translate("Google FCM"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Scholar", translate("Scholar"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Microsoft", translate("Microsoft"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "AI_Suite", translate("AI Suite"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Netflix", translate("Netflix"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Disney", translate("Disney Plus"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Discovery", translate("Discovery Plus"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "DAZN", translate("DAZN"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Spotify", translate("Spotify"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Steam", translate("Steam"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "TikTok", translate("TikTok"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "miHoYo", translate("miHoYo"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Speedtest", translate("Speedtest"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Telegram", translate("Telegram"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Crypto", translate("Crypto"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Discord", translate("Discord"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "PayPal", translate("PayPal"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "AdBlock", translate("AdBlock"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "HTTPDNS", translate("HTTPDNS"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Domestic", translate("Domestic"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "Others", translate("Others"))
o:depends("rule_name", "lhie1")
o.rmempty = true
o.description = translate("Choose Proxy Groups, Base On Your Config File").." ( "..font_green..bold_on..filename..bold_off..font_off.." )"
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
end
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
--luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash, sid)
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/toolbar_show"))
return m
@@ -0,0 +1,194 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local sys = require "luci.sys"
local sid = arg[1]
local fs = require "luci.openclash"
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
m = Map(openclash, translate("Edit Proxy-Provider"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/servers")
if m.uci:get(openclash, sid) ~= "proxy-provider" then
luci.http.redirect(m.redirect)
return
end
-- [[ Provider Setting ]]--
s = m:section(NamedSection, sid, "proxy-provider")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
o = s:option(Flag, "manual", translate("Custom Tag"))
o.rmempty = false
o.default = "0"
o.description = translate("Mark as Custom Node to Prevent Retention config from being Deleted When Enabled")
o = s:option(ListValue, "type", translate("Provider Type"))
o.rmempty = true
o.description = translate("Choose The Provider Type")
o:value("http")
o:value("file")
o:value("inline")
o = s:option(Value, "name", translate("Provider Name"))
o.rmempty = false
o.default = "Proxy-provider - "..sid
o = s:option(ListValue, "path", translate("Provider Path"))
o.description = translate("Update Your Proxy Provider File From Config Luci Page")
local p,h={}
for t,f in ipairs(fs.glob("/etc/openclash/proxy_provider/*"))do
h=fs.stat(f)
if h then
p[t]={}
p[t].name=fs.basename(f)
if IsYamlFile(p[t].name) or IsYmlFile(p[t].name) then
o:value("./proxy_provider/"..p[t].name)
end
end
end
o.rmempty = false
o:depends("type", "file")
o = s:option(Value, "provider_url", translate("Provider URL"))
o.rmempty = false
o:depends("type", "http")
o = s:option(Value, "provider_filter", translate("Provider Filter"))
o.rmempty = true
o.placeholder = "bgp|sg"
o = s:option(Value, "provider_interval", translate("Provider Interval(s)"))
o.default = "3600"
o.rmempty = false
o:depends("type", "http")
o = s:option(ListValue, "health_check", translate("Provider Health Check"))
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default = true
o = s:option(Value, "health_check_url", translate("Health Check URL"))
o:value("http://cp.cloudflare.com/generate_204")
o:value("http://www.gstatic.com/generate_204")
o:value("https://cp.cloudflare.com/generate_204")
o.rmempty = false
o = s:option(Value, "health_check_interval", translate("Health Check Interval(s)"))
o.default = "300"
o.rmempty = false
-- [[ other-setting ]]--
o = s:option(Value, "other_parameters", translate("Other Parameters"))
o.template = "cbi/tvalue"
o.rows = 20
o.wrap = "off"
o.description = font_red..bold_on..translate("Edit Your Other Parameters Here")..bold_off..font_off
o.rmempty = true
function o.cfgvalue(self, section)
if self.map:get(section, "other_parameters") == nil then
return "# Example:\n"..
"# Only support YAML, four spaces need to be reserved at the beginning of each line to maintain formatting alignment\n"..
"# 示例:\n"..
"# 仅支持 YAML, 每行行首需要多保留四个空格以使脚本处理后能够与上方配置保持格式对齐\n"..
"# header:\n"..
"# User-Agent:\n"..
"# - \"Clash/v1.18.0\"\n"..
"# - \"mihomo/1.18.3\"\n"..
"# Authorization:\n"..
"# - \"token 1231231\"\n"..
"# override:\n"..
"# skip-cert-verify: true\n"..
"# additional-prefix: \"provider1 prefix |\"\n"..
"# additional-suffix: \"| provider1 suffix\"\n"..
"# proxy-name:\n"..
"# - pattern: \"IPLC-(.*?)倍\"\n"..
"# target: \"iplc x $1\"\n"..
"# exclude-type: \"ss|http\"\n"..
"\n"..
"# inline Example:\n"..
"# payload:\n"..
"# - name: \"ss1\"\n"..
"# type: ss\n"..
"# server: server\n"..
"# port: 443\n"..
"# cipher: chacha20-ietf-poly1305\n"..
"# password: \"password\""
else
return Value.cfgvalue(self, section)
end
end
function o.validate(self, value)
if value then
value = value:gsub("\r\n?", "\n")
value = value:gsub("%c*$", "")
end
return value
end
o = s:option(DynamicList, "groups", translate("Proxy Group (Support Regex)"))
o.description = font_red..bold_on..translate("No Need Set when Config Create, The added Proxy Groups Must Exist")..bold_off..font_off
o.rmempty = true
o:value("all", translate("All Groups"))
m.uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil then
o:value(s.name)
end
end)
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash, sid)
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/toolbar_show"))
m:append(Template("openclash/config_editor"))
return m
@@ -0,0 +1,123 @@
local proxy_form
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
local p,r={}
for x,y in ipairs(fs.glob("/etc/openclash/proxy_provider/*"))do
r=fs.stat(y)
if r then
p[x]={}
p[x].num=string.format(x)
p[x].name=fs.basename(y)
p[x].mtime=os.date("%Y-%m-%d %H:%M:%S",r.mtime)
p[x].size=fs.filesize(r.size)
p[x].remove=0
p[x].enable=false
end
end
proxy_form=SimpleForm("proxy_provider_file_list",translate("Proxy Provider File List"))
proxy_form.reset=false
proxy_form.submit=false
tb1=proxy_form:section(Table,p)
nu1=tb1:option(DummyValue,"num",translate("Serial Number"))
nm1=tb1:option(DummyValue,"name",translate("File Name"))
mt1=tb1:option(DummyValue,"mtime",translate("Update Time"))
sz1=tb1:option(DummyValue,"size",translate("Size"))
btned1=tb1:option(Button,"edit",translate("Edit"))
btned1.render=function(p,x,r)
p.inputstyle="apply"
Button.render(p,x,r)
end
btned1.write=function(r,x)
local file_path = "etc/openclash/proxy_provider/" .. fs.basename(p[x].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "proxy-provider-file-manage", "%s") %file_path)
end
btndl1 = tb1:option(Button,"download1",translate("Download Config"))
btndl1.template="openclash/other_button"
btndl1.render=function(y,x,r)
y.inputstyle="remove"
Button.render(y,x,r)
end
btndl1.write = function (r,x)
local sPath, sFile, fd, block
sPath = "/etc/openclash/proxy_provider/"..p[x].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then
return
end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block ==0) then
break
else
HTTP.write(block)
end
end
fd:close()
HTTP.close()
end
btnrm1=tb1:option(Button,"remove1",translate("Remove"))
btnrm1.render=function(p,x,r)
p.inputstyle="reset"
Button.render(p,x,r)
end
btnrm1.write=function(r,x)
local r=fs.unlink("/etc/openclash/proxy_provider/"..luci.openclash.basename(p[x].name))
if r then table.remove(p,x)end
return r
end
local t = {
{Refresh, Create, Delete_all, Apply}
}
a = proxy_form:section(Table, t)
o = a:option(Button, "Refresh", " ")
o.inputtitle = translate("Refresh Page")
o.inputstyle = "apply"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "proxy-provider-file-manage"))
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/proxy_provider/"
o = a:option(Button, "Delete_all", " ")
o.inputtitle = translate("Delete All File")
o.inputstyle = "remove"
o.write = function()
luci.sys.call("rm -rf /etc/openclash/proxy_provider/* >/dev/null 2>&1")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "proxy-provider-file-manage"))
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "config"))
end
proxy_form:append(Template("openclash/toolbar_show"))
return proxy_form
@@ -0,0 +1,208 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "luci.openclash"
local sys = require "luci.sys"
local sid = arg[1]
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
m = Map(openclash, translate("Edit Rule Providers"))
m.pageaction = false
m.description=translate("规则集使用介绍:https://wiki.metacubex.one/config/rule-providers/content/")
m.redirect = luci.dispatcher.build_url("admin/services/openclash/rule-providers-settings")
if m.uci:get(openclash, sid) ~= "rule_providers" then
luci.http.redirect(m.redirect)
return
end
-- [[ Rule Providers Setting ]]--
s = m:section(NamedSection, sid, "rule_providers")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
o = s:option(Value, "name", translate("Rule Providers Name"))
o.rmempty = false
o.default = "Rule-provider - "..sid
o = s:option(ListValue, "type", translate("Rule Providers Type"))
o.rmempty = true
o.description = translate("Choose The Rule Providers Type")
o:value("http")
o:value("file")
o:value("inline")
o = s:option(ListValue, "format", translate("Rule Format"))
o.rmempty = true
o.description = translate("Choose The Rule File Format, For More Info:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/config/rule-providers/content/\")'>https://wiki.metacubex.one/config/rule-providers/content/</a>"
o:value("yaml")
o:value("text")
o:value("mrs")
o:depends("type", "file")
o:depends("type", "http")
o = s:option(ListValue, "behavior", translate("Rule Behavior"))
o.rmempty = true
o.description = translate("Choose The Rule Behavior")
o:value("domain")
o:value("ipcidr")
o:value("classical", translate("classical").." "..translate("(Not Support mrs Format)"))
o = s:option(ListValue, "path", translate("Rule Providers Path"))
o.description = translate("Update Your Rule Providers File From Config Luci Page")
local p,h={}
for t,f in ipairs(fs.glob("/etc/openclash/rule_provider/*"))do
h=fs.stat(f)
if h then
p[t]={}
p[t].name=fs.basename(f)
o:value("./rule_provider/"..p[t].name)
end
end
for t,f in ipairs(fs.glob("/etc/openclash/game_rules/*"))do
h=fs.stat(f)
if h then
p[t]={}
p[t].name=fs.basename(f)
o:value("./game_rules/"..p[t].name)
end
end
o.rmempty = false
o:depends("type", "file")
o = s:option(Value, "url", translate("Rule Providers URL"))
o.rmempty = false
o:depends("type", "http")
o = s:option(Value, "interval", translate("Rule Providers Interval(s)"))
o.default = "86400"
o.rmempty = false
o:depends("type", "http")
o = s:option(ListValue, "position", translate("Append Position"))
o.rmempty = false
o:value("0", translate("Priority Match"))
o:value("1", translate("Extended Match"))
o = s:option(ListValue, "group", translate("Set Proxy Group"))
o.description = font_red..bold_on..translate("The Added Proxy Groups Must Exist Except 'DIRECT' & 'REJECT' & 'REJECT-DROP' & 'PASS' & 'GLOBAL'")..bold_off..font_off
o.rmempty = true
local groupnames, filename
local group_list = {}
filename = m.uci:get(openclash, "config", "config_path")
if filename then
groupnames = sys.exec(string.format('ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "YAML.load_file(\'%s\')[\'proxy-groups\'].each do |i| puts i[\'name\']+\'##\' end" 2>/dev/null',filename))
if groupnames then
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
table.insert(group_list, groupname)
end
end
end
end
m.uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil then
table.insert(group_list, s.name)
end
end)
table.sort(group_list)
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o:value("DIRECT")
o:value("REJECT")
o:value("REJECT-DROP")
o:value("PASS")
o:value("GLOBAL")
-- [[ other-setting ]]--
o = s:option(Value, "other_parameters", translate("Other Parameters"))
o.template = "cbi/tvalue"
o.rows = 20
o.wrap = "off"
o.description = font_red..bold_on..translate("Edit Your Other Parameters Here")..bold_off..font_off
o.rmempty = true
function o.cfgvalue(self, section)
if self.map:get(section, "other_parameters") == nil then
return "# Example:\n"..
"# Only support YAML, four spaces need to be reserved at the beginning of each line to maintain formatting alignment\n"..
"# 示例:\n"..
"# 仅支持 YAML, 每行行首需要多保留四个空格以使脚本处理后能够与上方配置保持格式对齐\n"..
"# inline Example:\n"..
"# payload:\n"..
"# - '.blogger.com'\n"..
"# - '*.*.microsoft.com'\n"..
"# - 'books.itunes.apple.com'\n"
else
return Value.cfgvalue(self, section)
end
end
function o.validate(self, value)
if value then
value = value:gsub("\r\n?", "\n")
value = value:gsub("%c*$", "")
end
return value
end
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
sys.call("/usr/share/openclash/yml_groups_name_ch.sh")
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash, sid)
luci.http.redirect(m.redirect)
end
m:append(Template("openclash/toolbar_show"))
m:append(Template("openclash/config_editor"))
return m
@@ -0,0 +1,123 @@
local rule_form
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
local g,h={}
for n,m in ipairs(fs.glob("/etc/openclash/rule_provider/*"))do
h=fs.stat(m)
if h then
g[n]={}
g[n].num=string.format(n)
g[n].name=fs.basename(m)
g[n].mtime=os.date("%Y-%m-%d %H:%M:%S",h.mtime)
g[n].size=fs.filesize(h.size)
g[n].remove=0
g[n].enable=false
end
end
rule_form=SimpleForm("rule_provider_file_list",translate("Rule Providers File List"))
rule_form.reset=false
rule_form.submit=false
tb2=rule_form:section(Table,g)
nu2=tb2:option(DummyValue,"num",translate("Serial Number"))
nm2=tb2:option(DummyValue,"name",translate("File Name"))
mt2=tb2:option(DummyValue,"mtime",translate("Update Time"))
sz2=tb2:option(DummyValue,"size",translate("Size"))
btned1=tb2:option(Button,"edit",translate("Edit"))
btned1.render=function(g,n,h)
g.inputstyle="apply"
Button.render(g,n,h)
end
btned1.write=function(h,n)
local file_path = "etc/openclash/rule_provider/" .. fs.basename(g[n].name)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "other-file-edit", "rule-providers-file-manage", "%s") %file_path)
end
btndl2 = tb2:option(Button,"download2",translate("Download Config"))
btndl2.template="openclash/other_button"
btndl2.render=function(m,n,h)
m.inputstyle="remove"
Button.render(m,n,h)
end
btndl2.write = function (h,n)
local sPath, sFile, fd, block
sPath = "/etc/openclash/rule_provider/"..g[n].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then
return
end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block ==0) then
break
else
HTTP.write(block)
end
end
fd:close()
HTTP.close()
end
btnrm2=tb2:option(Button,"remove2",translate("Remove"))
btnrm2.render=function(g,n,h)
g.inputstyle="reset"
Button.render(g,n,h)
end
btnrm2.write=function(h,n)
local h=fs.unlink("/etc/openclash/rule_provider/"..luci.openclash.basename(g[n].name))
if h then table.remove(g,n)end
return h
end
local t = {
{Refresh, Create, Delete_all, Apply}
}
a = rule_form:section(Table, t)
o = a:option(Button, "Refresh", " ")
o.inputtitle = translate("Refresh Page")
o.inputstyle = "apply"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-file-manage"))
end
o = a:option(DummyValue, "Create", " ")
o.rawhtml = true
o.template = "openclash/input_file_name"
o.value = "/etc/openclash/rule_provider/"
o = a:option(Button, "Delete_all", " ")
o.inputtitle = translate("Delete All File")
o.inputstyle = "remove"
o.write = function()
luci.sys.call("rm -rf /etc/openclash/rule_provider/* >/dev/null 2>&1")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-file-manage"))
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "config"))
end
rule_form:append(Template("openclash/toolbar_show"))
return rule_form
@@ -0,0 +1,106 @@
local form, m
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
m = SimpleForm("openclash", translate("Other Rule Providers List"))
m.description=translate("Rule Project:").." lhie1 ( https://github.com/dler-io/Rules )<br/>"..
translate("Rule Project:").." ACL4SSR ( https://github.com/ACL4SSR/ACL4SSR/tree/master )"
m.reset = false
m.submit = false
local t = {
{Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Refresh", " ")
o.inputtitle = translate("Refresh Page")
o.inputstyle = "apply"
o.write = function()
SYS.call("rm -rf /tmp/rule_providers_name 2>/dev/null")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-manage"))
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Back Settings")
o.inputstyle = "reset"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-settings"))
end
if not NXFS.access("/tmp/rule_providers_name") then
SYS.call("awk -v d=',' -F ',' '{print $4d$5}' /usr/share/openclash/res/rule_providers.list > /tmp/rule_providers_name 2>/dev/null")
end
file = io.open("/tmp/rule_providers_name", "r");
---- Rules List
local e={},o,t
if NXFS.access("/tmp/rule_providers_name") then
for o in file:lines() do
table.insert(e,o)
end
for t,o in ipairs(e) do
e[t]={}
e[t].num=string.format(t)
e[t].name=string.sub(luci.sys.exec(string.format("grep -F '%s' /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $1}' 2>/dev/null",o)),1,-2)
e[t].lfilename=string.sub(luci.sys.exec(string.format("grep -F '%s' /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $6}' 2>/dev/null",o)),1,-2)
if e[t].lfilename == "" then
e[t].lfilename=string.sub(luci.sys.exec(string.format("grep -F '%s' /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $5}' 2>/dev/null",o)),1,-2)
end
e[t].filename=o
e[t].author=string.sub(luci.sys.exec(string.format("grep -F '%s' /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $2}' 2>/dev/null",o)),1,-2)
e[t].rule_type=string.sub(luci.sys.exec(string.format("grep -F '%s' /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $3}' 2>/dev/null",o)),1,-2)
RULE_FILE="/etc/openclash/rule_provider/".. e[t].lfilename
if fs.mtime(RULE_FILE) then
e[t].size=fs.filesize(fs.stat(RULE_FILE).size)
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(RULE_FILE))
else
e[t].size="/"
e[t].mtime="/"
end
if fs.isfile(RULE_FILE) then
e[t].exist=translate("Exist")
else
e[t].exist=translate("Not Exist")
end
e[t].remove=0
end
end
file:close()
form=SimpleForm("filelist")
form.reset=false
form.submit=false
tb=form:section(Table,e)
nu=tb:option(DummyValue,"num",translate("Serial Number"))
st=tb:option(DummyValue,"exist",translate("State"))
st.template="openclash/cfg_check"
tp=tb:option(DummyValue,"rule_type",translate("Rule Type"))
nm=tb:option(DummyValue,"name",translate("Rule Name"))
au=tb:option(DummyValue,"author",translate("Rule Author"))
fm=tb:option(DummyValue,"lfilename",translate("File Name"))
sz=tb:option(DummyValue,"size",translate("Size"))
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
btnis=tb:option(DummyValue,"filename",translate("Download Rule"))
btnis.template="openclash/download_rule"
btnrm=tb:option(Button,"remove",translate("Remove"))
btnrm.render=function(e,t,a)
e.inputstyle="reset"
Button.render(e,t,a)
end
btnrm.write=function(a,t)
fs.unlink("/etc/openclash/rule_provider/"..e[t].lfilename)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-manage"))
end
return m, form
@@ -0,0 +1,286 @@
local m, s, o
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
m = Map(openclash, translate("Rule Providers Append"))
m.pageaction = false
m.description=translate("Attention:")..
"<br/>"..translate("The game proxy is a test function and does not guarantee the availability of rules")..
"<br/>"..translate("Preparation steps:")..
"<br/>"..translate("1. Check the policy group and node you are going to use, Policy group type suggestion: fallback, game nodes must be support UDP and not a Vmess")..
"<br/>"..translate("2. Click the <manage third party game rules> or <manage third party rule set> button to enter the rule list and download the rules you want to use")..
"<br/>"..translate("3. On this page, set the corresponding configuration file and policy group of the rule you have downloaded, and save the settings")..
"<br/>"..
"<br/>"..translate("When setting this page, if the groups is empty, please go to the <Onekey Create> page to add")..
"<br/>"..
"<br/>"..translate("Introduction to rule set usage:").." <a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/config/rule-providers/content/\")'>"..translate("https://wiki.metacubex.one/config/rule-providers/content/").."</a>"
function IsRuleFile(e)
e=e or""
local e=string.lower(string.sub(e,-6,-1))
return e==".rules"
end
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
local groupnames, filename
local group_list = {}
filename = m.uci:get(openclash, "config", "config_path")
if filename then
groupnames = SYS.exec(string.format('ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "YAML.load_file(\'%s\')[\'proxy-groups\'].each do |i| puts i[\'name\']+\'##\' end" 2>/dev/null',filename))
if groupnames then
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
table.insert(group_list, groupname)
end
end
end
end
m.uci:foreach("openclash", "groups",
function(s)
if s.name ~= "" and s.name ~= nil then
table.insert(group_list, s.name)
end
end)
table.sort(group_list)
table.insert(group_list, "DIRECT")
table.insert(group_list, "REJECT")
table.insert(group_list, "REJECT-DROP")
table.insert(group_list, "PASS")
table.insert(group_list, "GLOBAL")
-- [[ Edit Game Rule ]] --
s = m:section(TypedSection, "game_config", translate("Game Rules Append"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "openclash/tblsection"
s.rmempty = false
---- 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
---- config
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
---- rule name
o = s:option(DynamicList, "rule_name", translate("Game Rule's Name"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/game_rules/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].filename=fs.basename(f)
if IsRuleFile(e[t].filename) then
e[t].name=string.gsub(luci.sys.exec(string.format("grep ',%s$' /usr/share/openclash/res/game_rules.list |awk -F ',' '{print $1}' 2>/dev/null",e[t].filename)), "[\r\n]", "")
if e[t].name ~= "" and e[t].name ~= nil then
o:value(e[t].name)
end
end
end
end
o.rmempty = true
---- Proxy Group
o = s:option(ListValue, "group", translate("Select Proxy Group"))
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
-- [[ Edit Other Rule Provider ]] --
s = m:section(TypedSection, "rule_provider_config", translate("Other Rule Providers Append"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "openclash/tblsection"
s.rmempty = false
---- 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
---- config
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
---- rule name
o = s:option(DynamicList, "rule_name", translate("Rule Provider's Name"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/rule_provider/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].filename=fs.basename(f)
if IsYamlFile(e[t].filename) or IsYmlFile(e[t].filename) then
e[t].name=string.gsub(luci.sys.exec(string.format("grep ',%s$' /usr/share/openclash/res/rule_providers.list |awk -F ',' '{print $1}' 2>/dev/null",e[t].filename)), "[\r\n]", "")
if e[t].name ~= "" and e[t].name ~= nil then
o:value(e[t].name)
end
end
end
end
o.rmempty = true
---- Proxy Group
o = s:option(ListValue, "group", translate("Select Proxy Group"))
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(Value, "interval", translate("Rule Providers Interval(s)"))
o.default = "86400"
o.rmempty = false
---- position
o = s:option(ListValue, "position", translate("Append Position"))
o.rmempty = false
o:value("0", translate("Priority Match"))
o:value("1", translate("Extended Match"))
-- [[ Edit Custom Rule Provider ]] --
s = m:section(TypedSection, "rule_providers", translate("Custom Rule Providers Append"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "openclash/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/openclash/rule-providers-config/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
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, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "name", translate("Rule Providers Name"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
---- Proxy Group
o = s:option(ListValue, "group", translate("Select Proxy Group"))
o.rmempty = true
for _, groupname in ipairs(group_list) do
o:value(groupname)
end
o = s:option(ListValue, "position", translate("Append Position"))
o.rmempty = false
o:value("0", translate("Priority Match"))
o:value("1", translate("Extended Match"))
local rm = {
{rule_mg, pro_mg}
}
rmg = m:section(Table, rm)
o = rmg:option(Button, "rule_mg", " ")
o.inputtitle = translate("Game Rules Manage")
o.inputstyle = "reload"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "game-rules-manage"))
end
o = rmg:option(Button, "pro_mg", " ")
o.inputtitle = translate("Other Rule Provider Manage")
o.inputstyle = "reload"
o.write = function()
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-manage"))
end
local t = {
{Commit, Apply}
}
ss = m:section(Table, t)
o = ss:option(Button, "Commit", " ")
o.inputtitle = translate("Commit Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit("openclash")
end
o = ss:option(Button, "Apply", " ")
o.inputtitle = translate("Apply Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
m:append(Template("openclash/toolbar_show"))
return m
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,276 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "luci.openclash"
font_red = [[<b style=color:red>]]
font_off = [[</b>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map(openclash, translate("Onekey Create (Servers&Groups manage)"))
m.pageaction = false
m.description=translate("Attention:")..
"<br/>"..translate("1. Before modifying the configuration file, please click the button below to read the configuration file")..
"<br/>"..translate("2. Proxy-providers address can be directly filled in the subscription link")..
"<br/>"..
"<br/>"..translate("Introduction to proxy usage:").." <a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/config/proxies/\")'>"..translate("https://wiki.metacubex.one/config/proxies/").."</a>"..
"<br/>"..translate("Introduction to proxy-provider usage:").." <a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/config/proxy-providers/\")'>"..translate("https://wiki.metacubex.one/config/proxy-providers/").."</a>"
s = m:section(TypedSection, "openclash")
s.anonymous = true
o = s:option(Flag, "create_config", translate("Create Config"))
o.description = font_red .. bold_on .. translate("Create Config By One-Click Only Need Proxies") .. bold_off .. font_off
o.default = 0
o = s:option(ListValue, "rule_sources", translate("Choose Template For Create Config"))
o.description = translate("Use Other Rules To Create Config")
o:depends("create_config", 1)
o:value("lhie1", translate("lhie1 Rules"))
o = s:option(Flag, "mix_proxies", translate("Mix Proxies"))
o.description = font_red .. bold_on .. translate("Mix This Page's Proxies") .. bold_off .. font_off
o:depends("create_config", 1)
o.default = 0
o = s:option(Flag, "servers_update", translate("Keep Settings"))
o.description = font_red .. bold_on .. translate("Only Update Servers Below When Subscription") .. bold_off .. font_off
o.default = 0
o = s:option(DynamicList, "new_servers_group", translate("New Servers Group (Support Regex)"))
o.description = translate("Set The New Subscribe Server's Default Proxy Groups")
o.rmempty = true
o:depends("servers_update", 1)
o:value("all", translate("All Groups"))
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)"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "openclash/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/openclash/groups-config/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
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, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "type", translate("Group Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "name", translate("Group Name"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
-- [[ Proxy-Provider Manage ]]--
s = m:section(TypedSection, "proxy-provider", translate("Proxy-Provider"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "openclash/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/openclash/proxy-provider-config/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
end
end
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(Flag, "manual", translate("Custom Tag"))
o.rmempty = false
o.default = "0"
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
o = s:option(DummyValue, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "type", translate("Provider Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "name", translate("Provider Name"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
-- [[ Servers Manage ]]--
s = m:section(TypedSection, "servers", translate("Proxies"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "openclash/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/openclash/servers-config/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
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(Flag, "manual", translate("Custom Tag"))
o.rmempty = false
o.default = "0"
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
o = s:option(DummyValue, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "type", translate("Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "name", translate("Server Alias"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "server", translate("Server Address"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "port", translate("Server Port"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "udp", translate("UDP Support"))
function o.cfgvalue(...)
if Value.cfgvalue(...) == "true" then
return translate("Enable")
elseif Value.cfgvalue(...) == "false" then
return translate("Disable")
else
return translate("None")
end
end
local tt = {
{Delete_Unused_Servers, Delete_Servers, Delete_Proxy_Provider, 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()
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_Servers", " ")
o.inputtitle = translate("Delete Servers")
o.inputstyle = "reset"
o.write = function()
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_Proxy_Provider", " ")
o.inputtitle = translate("Delete Proxy Providers")
o.inputstyle = "reset"
o.write = function()
m.uci:delete_all("openclash", "proxy-provider", 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: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("Read Config")
o.inputstyle = "apply"
o.write = function()
m.uci:commit("openclash")
luci.sys.call("/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 Settings")
o.inputstyle = "apply"
o.write = function()
fs.unlink("/tmp/Proxy_Group")
m.uci:commit("openclash")
end
o = a:option(Button, "Apply", " ")
o.inputtitle = translate("Apply Settings")
o.inputstyle = "apply"
o.write = function()
m.uci:commit("openclash")
fs.unlink("/tmp/Proxy_Group")
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
m:append(Template("openclash/toolbar_show"))
return m
File diff suppressed because it is too large. Load diff
+335
View File
@@ -0,0 +1,335 @@
--[[
LuCI - Filesystem tools
Description:
A module offering often needed filesystem manipulation functions
FileId:
$Id$
License:
Copyright 2008 Steven Barth <steven@midlink.org>
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
local io = require "io"
local os = require "os"
local ltn12 = require "luci.ltn12"
local fs = require "nixio.fs"
local nutil = require "nixio.util"
local uci = require "luci.model.uci".cursor()
local SYS = require "luci.sys"
local type = type
local string = string
--- LuCI filesystem library.
module "luci.openclash"
--- Test for file access permission on given path.
-- @class function
-- @name access
-- @param str String value containing the path
-- @return Number containing the return code, 0 on sucess or nil on error
-- @return String containing the error description (if any)
-- @return Number containing the os specific errno (if any)
access = fs.access
--- Evaluate given shell glob pattern and return a table containing all matching
-- file and directory entries.
-- @class function
-- @name glob
-- @param filename String containing the path of the file to read
-- @return Table containing file and directory entries or nil if no matches
-- @return String containing the error description (if no matches)
-- @return Number containing the os specific errno (if no matches)
function glob(...)
local iter, code, msg = fs.glob(...)
if iter then
return nutil.consume(iter)
else
return nil, code, msg
end
end
--- Checks wheather the given path exists and points to a regular file.
-- @param filename String containing the path of the file to test
-- @return Boolean indicating wheather given path points to regular file
function isfile(filename)
return fs.stat(filename, "type") == "reg"
end
--- Checks wheather the given path exists and points to a directory.
-- @param dirname String containing the path of the directory to test
-- @return Boolean indicating wheather given path points to directory
function isdirectory(dirname)
return fs.stat(dirname, "type") == "dir"
end
--- Read the whole content of the given file into memory.
-- @param filename String containing the path of the file to read
-- @return String containing the file contents or nil on error
-- @return String containing the error message on error
readfile = fs.readfile
--- Write the contents of given string to given file.
-- @param filename String containing the path of the file to read
-- @param data String containing the data to write
-- @return Boolean containing true on success or nil on error
-- @return String containing the error message on error
writefile = fs.writefile
--- Copies a file.
-- @param source Source file
-- @param dest Destination
-- @return Boolean containing true on success or nil on error
copy = fs.datacopy
--- Renames a file.
-- @param source Source file
-- @param dest Destination
-- @return Boolean containing true on success or nil on error
rename = fs.move
--- Get the last modification time of given file path in Unix epoch format.
-- @param path String containing the path of the file or directory to read
-- @return Number containing the epoch time or nil on error
-- @return String containing the error description (if any)
-- @return Number containing the os specific errno (if any)
function mtime(path)
return fs.stat(path, "mtime")
end
--- Set the last modification time of given file path in Unix epoch format.
-- @param path String containing the path of the file or directory to read
-- @param mtime Last modification timestamp
-- @param atime Last accessed timestamp
-- @return 0 in case of success nil on error
-- @return String containing the error description (if any)
-- @return Number containing the os specific errno (if any)
function utime(path, mtime, atime)
return fs.utimes(path, atime, mtime)
end
--- Return the last element - usually the filename - from the given path with
-- the directory component stripped.
-- @class function
-- @name basename
-- @param path String containing the path to strip
-- @return String containing the base name of given path
-- @see dirname
basename = fs.basename
--- Return the directory component of the given path with the last element
-- stripped of.
-- @class function
-- @name dirname
-- @param path String containing the path to strip
-- @return String containing the directory component of given path
-- @see basename
dirname = fs.dirname
--- Return a table containing all entries of the specified directory.
-- @class function
-- @name dir
-- @param path String containing the path of the directory to scan
-- @return Table containing file and directory entries or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function dir(...)
local iter, code, msg = fs.dir(...)
if iter then
local t = nutil.consume(iter)
t[#t+1] = "."
t[#t+1] = ".."
return t
else
return nil, code, msg
end
end
--- Create a new directory, recursively on demand.
-- @param path String with the name or path of the directory to create
-- @param recursive Create multiple directory levels (optional, default is true)
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function mkdir(path, recursive)
return recursive and fs.mkdirr(path) or fs.mkdir(path)
end
--- Remove the given empty directory.
-- @class function
-- @name rmdir
-- @param path String containing the path of the directory to remove
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
rmdir = fs.rmdir
local stat_tr = {
reg = "regular",
dir = "directory",
lnk = "link",
chr = "character device",
blk = "block device",
fifo = "fifo",
sock = "socket"
}
--- Get information about given file or directory.
-- @class function
-- @name stat
-- @param path String containing the path of the directory to query
-- @return Table containing file or directory properties or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function stat(path, key)
local data, code, msg = fs.stat(path)
if data then
data.mode = data.modestr
data.type = stat_tr[data.type] or "?"
end
return key and data and data[key] or data, code, msg
end
--- Set permissions on given file or directory.
-- @class function
-- @name chmod
-- @param path String containing the path of the directory
-- @param perm String containing the permissions to set ([ugoa][+-][rwx])
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
chmod = fs.chmod
--- Create a hard- or symlink from given file (or directory) to specified target
-- file (or directory) path.
-- @class function
-- @name link
-- @param path1 String containing the source path to link
-- @param path2 String containing the destination path for the link
-- @param symlink Boolean indicating wheather to create a symlink (optional)
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function link(src, dest, sym)
return sym and fs.symlink(src, dest) or fs.link(src, dest)
end
--- Remove the given file.
-- @class function
-- @name unlink
-- @param path String containing the path of the file to remove
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
unlink = fs.unlink
--- Retrieve target of given symlink.
-- @class function
-- @name readlink
-- @param path String containing the path of the symlink to read
-- @return String containing the link target or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
readlink = fs.readlink
function filename(str)
if not str then
return nil
end
local idx = str:match(".+()%.%w+$")
if idx then
return str:sub(1, idx-1)
else
return str
end
end
function filesize(e)
local t=0
local a={' KB',' MB',' GB',' TB',' PB'}
if e < 0 then
e = -e
end
repeat
e=e/1024
t=t+1
until(e<=1024)
return string.format("%.1f",e)..a[t] or "0.0 KB"
end
function lanip()
local lan_int_name = uci:get("openclash", "@overwrite[0]", "lan_interface_name") or uci:get("openclash", "config", "lan_interface_name") or "0"
local lan_ip
if lan_int_name == "0" then
lan_ip = SYS.exec("uci -q get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
else
lan_ip = SYS.exec(string.format("ip address show %s 2>/dev/null | grep -w 'inet' 2>/dev/null | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -1 | tr -d '\n'", lan_int_name))
end
if not lan_ip or lan_ip == "" then
lan_ip = SYS.exec("ip address show $(uci -q -p /tmp/state get network.lan.device || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -1 | tr -d '\n'")
end
if not lan_ip or lan_ip == "" then
lan_ip = SYS.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
end
return lan_ip
end
function find_case_insensitive_path(path)
local dir = dirname(path)
local base = basename(path)
local files = dir and fs.dir(dir)
if not files then
return nil
end
for f in files do
if f:lower() == base:lower() then
return dir .. "/" .. f
end
end
return nil
end
function get_resourse_mtime(path)
local real_path = path
if not fs.access(path) then
local found = find_case_insensitive_path(path)
if found then
real_path = found
else
return "File Not Exist"
end
end
local file = fs.readlink(real_path) or real_path
local model_version = os.date("%Y-%m-%d %H:%M:%S", mtime(real_path))
if model_version and model_version ~= "" then
return model_version
else
return "Unknown"
end
end
function uci_get_config(section, key)
local val
if section == "config" then
val = uci:get("openclash", "@overwrite[0]", key)
end
if val == nil then
val = uci:get("openclash", section, key)
end
return val
end
@@ -0,0 +1,18 @@
<%+cbi/valueheader%>
<div>
<%
local val = self:cfgvalue(section)
if val == translate("Enable") or val == translate("Enabled") or val == translate("Config Normal") or val == translate("Exist") then
%>
<div style="color: green; font-weight:bold;">
<%
else
%>
<div style="color: red; font-weight:bold;">
<%
end
write(pcdata(val))
%>
</div>
</div>
<%+cbi/valuefooter%>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,515 @@
<style>
.CodeMirror {
text-align: left !important;
font-size: 15px;
line-height: 150%;
resize: both !important;
}
.CodeMirror-merge {
border: none !important;
}
.CodeMirror-merge-r-chunk {
background: #0095ff2e !important;
}
.CodeMirror-merge-2pane .CodeMirror-merge-gap {
height: 700px !important;
}
.CodeMirror-merge-r-connect {
fill: #0095ff2e !important;
stroke: #0095ff2e !important;
}
.CodeMirror-vscrollbar-oc {
display: none !important;
}
.CodeMirror, .CodeMirror-line {
width: 100% !important;
max-width: 100% !important;
min-width: 0 !important;
box-sizing: border-box;
word-break: break-all !important;
overflow-wrap: break-word !important;
}
:root[data-darkmode="true"] .CodeMirror-merge-gap {
background: #d0cfcf !important;
}
</style>
<link rel="stylesheet" href="/luci-static/resources/openclash/lib/codemirror.css"/>
<link rel="stylesheet" href="/luci-static/resources/openclash/theme/material.css"/>
<link rel="stylesheet" href="/luci-static/resources/openclash/theme/material-log.css"/>
<link rel="stylesheet" href="/luci-static/resources/openclash/theme/idea.css"/>
<link rel="stylesheet" href="/luci-static/resources/openclash/addon/fold/foldgutter.css"/>
<link rel="stylesheet" href="/luci-static/resources/openclash/addon/lint/lint.css">
<link rel="stylesheet" href="/luci-static/resources/openclash/addon/display/fullscreen.css">
<link rel="stylesheet" href="/luci-static/resources/openclash/addon/dialog/dialog.css">
<link rel="stylesheet" href="/luci-static/resources/openclash/addon/search/matchesonscrollbar.css">
<script src="/luci-static/resources/openclash/lib/codemirror.js"></script>
<script src="/luci-static/resources/openclash/mode/yaml/yaml.js"></script>
<script src="/luci-static/resources/openclash/mode/lua/lua.js"></script>
<script src="/luci-static/resources/openclash/mode/shell/shell.js"></script>
<script src="/luci-static/resources/openclash/addon/fold/foldcode.js"></script>
<script src="/luci-static/resources/openclash/addon/fold/foldgutter.js"></script>
<script src="/luci-static/resources/openclash/addon/fold/indent-fold.js"></script>
<script src="/luci-static/resources/openclash/addon/edit/matchbrackets.js"></script>
<script src="/luci-static/resources/openclash/addon/selection/active-line.js"></script>
<script src="/luci-static/resources/openclash/addon/lint/lint.js"></script>
<script src="/luci-static/resources/openclash/addon/lint/yaml-lint.js"></script>
<script src="/luci-static/resources/openclash/addon/lint/js-yaml.min.js"></script>
<script src="/luci-static/resources/openclash/addon/display/fullscreen.js"></script>
<script src="/luci-static/resources/openclash/addon/display/autorefresh.js"></script>
<script src="/luci-static/resources/openclash/addon/dialog/dialog.js"></script>
<script src="/luci-static/resources/openclash/addon/search/searchcursor.js"></script>
<script src="/luci-static/resources/openclash/addon/search/search.js"></script>
<script src="/luci-static/resources/openclash/addon/scroll/annotatescrollbar.js"></script>
<script src="/luci-static/resources/openclash/addon/search/matchesonscrollbar.js"></script>
<script src="/luci-static/resources/openclash/addon/search/jump-to-line.js"></script>
<script src="/luci-static/resources/openclash/addon/merge/diff_match_patch.js"></script>
<script src="/luci-static/resources/openclash/addon/merge/merge.js"></script>
<link rel=stylesheet href="/luci-static/resources/openclash/addon/merge/merge.css">
<%-
local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash"
local conf = fs.uci_get_config("config", "config_path")
if not conf then conf = "/etc/openclash/config/config.yaml" end
local conf_name = fs.basename(conf)
if not conf_name then conf_name = "config.yaml" end
local sconf = "/etc/openclash/"..conf_name
-%>
<table id="my_editor_div" style="width: 100%; text-align: center; display: none;">
<tr>
<td style="width: 50%; overflow: hidden;"><%:Modify Your Config file:%> <b style=color:green><%=conf_name%></b> <%:Here, Except The Settings That Were Taken Over%></td>
<%-
if fs.isfile(sconf) then
-%>
<td style="width: 50%; overflow: hidden;"><%:Config File Edited By OpenClash For Running%></td>
<%-
else
-%>
<td style="width: 50%; overflow: hidden;"><%:Default Config File With Correct Template%></td>
<%-
end
-%>
</tr>
</table>
<script type="text/javascript">//<![CDATA[
function isDarkBackground(element) {
var cachedTheme = localStorage.getItem('oc-theme');
if (cachedTheme === 'dark') {
return true;
} else if (cachedTheme === 'light') {
return false;
}
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return true;
}
var style = window.getComputedStyle(element);
var bgColor = style.backgroundColor;
let r, g, b;
if (/rgb\(/.test(bgColor)) {
var rgb = bgColor.match(/\d+/g);
r = parseInt(rgb);
g = parseInt(rgb);
b = parseInt(rgb);
} else if (/#/.test(bgColor)) {
if (bgColor.length === 4) {
r = parseInt(bgColor + bgColor, 16);
g = parseInt(bgColor + bgColor, 16);
b = parseInt(bgColor + bgColor, 16);
} else {
r = parseInt(bgColor.slice(1, 3), 16);
g = parseInt(bgColor.slice(3, 5), 16);
b = parseInt(bgColor.slice(5, 7), 16);
}
} else {
return false;
}
var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
return luminance < 128;
};
function merge_editor(id, id2, target, target2, readOnly, readOnly2, wid, height)
{
var value, orig1, orig2, merge_editor, descr, gap, vscrollbar, vscrollbar_oc, panes = 2, highlight = true, connect = null, collapse = false;
descr = document.getElementById("my_editor_div");
target.parentNode.parentNode.parentNode.insertBefore(descr, target.parentNode.parentNode);
descr.style.display="inline-table"
value = id.value;
if (value == null) {
editor(id, readOnly, wid, height);
editor(id2, readOnly2, wid, height);
}
else {
target2.parentNode.style.display="none";
orig1 = '';
orig2 = id2.value;
target.style.height= "700px"
id.style.display = "none";
id2.style.display = "none";
merge_editor = CodeMirror.MergeView(target, {
mode: "text/yaml",
value: value,
origLeft: panes == 3 ? orig1 : null,
orig: orig2,
theme: "material",
lineNumbers: true,
autoRefresh: true,
styleActiveLine: true,
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
lint: true,
highlightDifferences: highlight,
connect: connect,
collapseIdentical: collapse,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter", "CodeMirror-lint-markers"],
extraKeys: {
"F10": function() {
merge_editor.setShowDifferences(highlight = !highlight);
},
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
gap = document.getElementsByClassName("CodeMirror-merge-gap")[0];
vscrollbar = document.getElementsByClassName("CodeMirror-vscrollbar")[0];
vscrollbar_oc = document.getElementsByClassName("CodeMirror-vscrollbar-oc")[0];
if (cm.getOption("fullScreen")) {
console.log(gap.style.display)
gap.style.display = "none";
vscrollbar.className = "CodeMirror-vscrollbar-oc";
}
else {
gap.style.display = "";
vscrollbar_oc.className = "CodeMirror-vscrollbar";
};
},
"Esc": function(cm) {
gap = document.getElementsByClassName("CodeMirror-merge-gap")[0];
vscrollbar = document.getElementsByClassName("CodeMirror-vscrollbar")[0];
vscrollbar_oc = document.getElementsByClassName("CodeMirror-vscrollbar-oc")[0];
if (cm.getOption("fullScreen")) {
cm.setOption("fullScreen", false);
gap.style.display = "";
vscrollbar_oc.className = "CodeMirror-vscrollbar";
};
},
"Tab": function(cm) {
if (cm.somethingSelected()) {
cm.indentSelection('add')
} else {
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ")
cm.replaceSelection(spaces)
}
}
}
});
merge_editor.edit.on("change", function(cm) {
id.value = cm.getValue();
});
if (wid && height) {
merge_editor.editor().setSize(wid, height);
merge_editor.rightOriginal().setSize(wid, height);
};
};
};
function editor(id, readOnly, wid, height)
{
var editor = CodeMirror.fromTextArea(id, {
mode: "text/yaml",
autoRefresh: true,
styleActiveLine: true,
lineNumbers: true,
theme: "material",
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
lint: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter", "CodeMirror-lint-markers"],
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
},
"Tab": function(cm) {
if (cm.somethingSelected()) {
cm.indentSelection('add')
} else {
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ")
cm.replaceSelection(spaces)
}
}
}
});
if (readOnly == "true") {
editor.setOption("readOnly","true");
};
if (wid && height) {
editor.setSize(wid, height);
};
};
function shell_editor(id, readOnly, wid, height)
{
var editor = CodeMirror.fromTextArea(id, {
mode: "shell",
autoRefresh: true,
styleActiveLine: true,
lineNumbers: true,
theme: "material",
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
},
"Tab": function(cm) {
if (cm.somethingSelected()) {
cm.indentSelection('add')
} else {
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ")
cm.replaceSelection(spaces)
}
}
}
});
if (wid && height) {
editor.setSize(wid, height);
};
};
function other_editor(id, readOnly, wid, height)
{
var editor = CodeMirror.fromTextArea(id, {
mode: "lua",
autoRefresh: true,
styleActiveLine: true,
lineNumbers: true,
theme: "material",
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
},
"Tab": function(cm) {
if (cm.somethingSelected()) {
cm.indentSelection('add')
} else {
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ")
cm.replaceSelection(spaces)
}
}
}
});
if (wid && height) {
editor.setSize(wid, height);
};
};
function other_log_area(id, readOnly, wid, height)
{
var other_log_area = CodeMirror.fromTextArea(id, {
mode: "lua",
autoRefresh: true,
styleActiveLine: true,
lineNumbers: true,
theme: "idea",
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
if (readOnly == "true") {
other_log_area.setOption("readOnly","true");
};
if (wid && height) {
other_log_area.setSize(wid, height);
};
other_log_area.markText({line:0,ch:0},{line:9999,ch:9999}, {css: 'font-size:13px'});
};
var custom_cfg_value = document.getElementById("cbid.openclash." + window.location.pathname.split("/")[window.location.pathname.split("/").length - 1] + ".other_parameters");
if (custom_cfg_value) {
editor(custom_cfg_value, 'false', '100%', '300px');
};
var custom_firewall = document.getElementById("cbid.openclash.config.firewall_custom");
var custom_ymchange = document.getElementById("cbid.openclash.config.ymchange_custom");
if (custom_firewall) {
shell_editor(custom_firewall, 'false', "100%", '300px');
};
if (custom_ymchange) {
shell_editor(custom_ymchange, 'false', "100%", '300px');
};
var myEditor_use = document.getElementById("cbid.table.1.user");
var myEditor_def = document.getElementById("cbid.table.1.default");
if (myEditor_use && myEditor_def) {
var myEditor_div_use = document.getElementById("cbi-table-1-user");
var myEditor_div_def = document.getElementById("cbi-table-1-default");
myEditor_div_def.parentNode.parentNode.style.cssText="text-align: left !important"
myEditor_div_def.parentNode.className='cbi-value';
myEditor_div_def.parentNode.style.display="revert"
myEditor_div_def.parentNode.style.width="100%"
myEditor_div_use.parentNode.className='cbi-value';
myEditor_div_use.parentNode.style.display="revert"
myEditor_div_use.parentNode.style.width="100%"
merge_editor(myEditor_use, myEditor_def, myEditor_div_use, myEditor_div_def, 'true', 'false', 'auto', '700px');
};
var myEditor_hosts = document.getElementById("cbid.openclash.config.custom_hosts");
var myEditor_fall_fil = document.getElementById("cbid.openclash.config.custom_fallback_fil");
var myEditor_name_pol = document.getElementById("cbid.openclash.config.custom_domain_dns_core");
var myEditor_name_cus_r1 = document.getElementById("cbid.openclash.config.custom_rules_2");
var myEditor_name_cus_r2 = document.getElementById("cbid.openclash.config.custom_rules");
var myEditor_fake_filter = document.getElementById("cbid.openclash.config.custom_fake_filter");
var myEditor_custom_domain_dns = document.getElementById("cbid.openclash.config.custom_domain_dns");
var myEditor_edit_file = document.getElementById("cbid.openclash.config.edit_file");
var myEditor_custom_sniffer = document.getElementById("cbid.openclash.config.sniffer_custom");
var myEditor_proxy_name_pol = document.getElementById("cbid.openclash.config.custom_proxy_server_dns_policy");
if (myEditor_hosts) {
editor(myEditor_hosts, 'false', '100%', '300px');
};
if (myEditor_edit_file) {
editor(myEditor_edit_file, 'false', '100%', '700px');
};
if (myEditor_fall_fil) {
editor(myEditor_fall_fil, 'false', '100%', '300px');
};
if (myEditor_name_pol) {
editor(myEditor_name_pol, 'false', '100%', '300px');
};
if (myEditor_proxy_name_pol) {
editor(myEditor_proxy_name_pol, 'false', '100%', '300px');
};
if (myEditor_name_cus_r1) {
editor(myEditor_name_cus_r1, 'false', '100%', '300px');
editor(myEditor_name_cus_r2, 'false', '100%', '300px');
};
if (myEditor_fake_filter) {
other_editor(myEditor_fake_filter, 'false', '100%', '300px');
};
if (myEditor_custom_domain_dns) {
other_editor(myEditor_custom_domain_dns, 'false', '100%', '300px');
};
if (myEditor_custom_sniffer) {
other_editor(myEditor_custom_sniffer, 'false', '100%', '300px');
};
var core_log = document.getElementById("core_log");
var oc_log = document.getElementById("cbid.openclash.config.clog");
if (core_log && oc_log) {
var core_editor = CodeMirror.fromTextArea(core_log, {
mode: "lua",
autoRefresh: true,
styleActiveLine: true,
lineNumbers: true,
theme: "idea",
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
var oc_editor = CodeMirror.fromTextArea(oc_log, {
mode: "lua",
autoRefresh: true,
styleActiveLine: true,
lineNumbers: true,
theme: "idea",
lineWrapping: true,
matchBrackets: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {
"F11": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
core_editor.setSize("100%", "540px");
core_editor.setOption("readOnly","true");
oc_editor.setSize("100%", "540px");
oc_editor.setOption("readOnly","true");
if (isDarkBackground(document.body)) {
core_editor.setOption('theme', 'material-log');
oc_editor.setOption('theme', 'material-log');
document.documentElement.setAttribute('data-darkmode', 'true');
};
};
var proxy_mg = document.getElementById('cbi-table-1-proxy_mg');
var rule_mg = document.getElementById('cbi-table-1-rule_mg');
var game_mg = document.getElementById('cbi-table-1-game_mg');
var Commit = document.getElementById('cbi-table-1-Commit');
var Apply = document.getElementById('cbi-table-1-Apply');
var Create = document.getElementById('cbi-table-1-Create');
if (proxy_mg) {
proxy_mg.style.textAlign="center";
rule_mg.style.textAlign="center";
game_mg.style.textAlign="center";
Commit.style.textAlign="center";
Apply.style.textAlign="center";
Create.style.textAlign="center";
};
//]]>
</script>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,241 @@
<%#
Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%
local diag_host = "www.instagram.com"
local dns_host = "www.instagram.com"
%>
<style>
:root[data-darkmode="true"] .diag-style {
background-color: #404040;
}
:root[data-darkmode="true"] #diag-rc-output > pre {
background-color: #404040;
color: #ffffff;
}
:root[data-darkmode="true"] #dns-rc-output > pre {
background-color: #404040;
color: #ffffff;
}
.diag-style {
background-color: #f5f5f5;
}
#diag-rc-output > pre {
background-color: #ffffff;
display: block;
padding: 8.5px;
margin: 0 0 18px;
line-height: 1.5rem;
-moz-border-radius: 3px;
white-space: pre-wrap;
word-wrap: break-word;
font-size: 1.4rem;
color: #404040;
}
#dns-rc-output > pre {
background-color: #ffffff;
display: block;
padding: 8.5px;
margin: 0 0 18px;
line-height: 1.5rem;
-moz-border-radius: 3px;
white-space: pre-wrap;
word-wrap: break-word;
font-size: 1.4rem;
color: #404040;
}
</style>
<script type="text/javascript">//<![CDATA[
setTimeout(function(){
if (isDarkBackground(document.body)) {
document.documentElement.setAttribute('data-darkmode', 'true');
};
}, 300);
function show_diag_info(addr)
{
var addr = addr;
var legend = document.getElementById('diag-rc-legend');
var output = document.getElementById('diag-rc-output');
if (legend && output)
{
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "diag_connection")%>', {addr: addr}, function(x, status) {
if (x && x.status == 200 && x.responseText != "")
{
legend.style.display = 'none';
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
}
else if (x.status == 500)
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:Bad address specified!%></span>';
}
else
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:Could not find any connection logs!%></br></br><%:1. It may be that the plugin is not running%></br></br><%:2. It may be that the cache causes the browser to directly use the IP for access%></br></br><%:3. It may be that DNS hijacking did not take effect, so clash unable to reverse the domain name%></br></br><%:4. It may be that the filled address cannot be resolved and connected%></span>';
}
});
}
}
function update_status(field)
{
var addr = field.value;
var legend = document.getElementById('diag-rc-legend');
var output = document.getElementById('diag-rc-output');
if (legend && output)
{
output.innerHTML =
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>';
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
}
let HTTP = {
checker: (domain) => {
let img = new Image;
let timeout = setTimeout(() => {
img.onerror = img.onload = null;
show_diag_info(addr);
}, 10000);
img.onerror = () => {
clearTimeout(timeout);
show_diag_info(addr);
}
img.onload = () => {
clearTimeout(timeout);
show_diag_info(addr);
}
img.src = `https://${domain}/favicon.ico?${+(new Date)}`
},
runcheck: () => {
HTTP.checker(addr);
}
};
HTTP.runcheck();
}
function diag_dns(field)
{
var addr = field.value;
var legend = document.getElementById('dns-rc-legend');
var output = document.getElementById('dns-rc-output');
if (legend && output)
{
output.innerHTML =
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>';
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
}
if (legend && output)
{
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "diag_dns")%>', {addr: addr}, function(x, status) {
if (x && x.status == 200 && x.responseText != "")
{
legend.style.display = 'none';
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
}
else if (x.status == 500)
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:Bad address specified!%></span>';
}
else
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:No Response Found!%></span>';
}
});
}
}
function gen_debug_logs()
{
var legend = document.getElementById('debug-rc-legend');
var output = document.getElementById('debug-rc-output');
if (legend && output)
{
output.innerHTML =
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>';
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "gen_debug_logs")%>', null, function(x, status) {
if (x && x.status == 200 && x.responseText != "")
{
legend.style.display = 'none';
output.innerHTML = '<textarea class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="30" cols="60" readonly="readonly" >'+x.responseText+'</textarea>';
}
else
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:Some error occurred!%></span>';
}
}
);
}
}
//]]></script>
<form>
<fieldset class="diag-style">
<div style="width:33%; float: left; text-align: center; white-space: nowrap;">
<%:Connection Test%>&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" value="<%=diag_host%>" name="diag" />
<input type="button" value="<%:Click to Test%>" class="btn cbi-button cbi-button-apply" onclick="update_status(this.form.diag)" />
</div>
<div style="width:33%; float: left; text-align: center; white-space: nowrap;">
<%:DNS Test%>&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" value="<%=dns_host%>" name="dns_host" />
<input type="button" value="<%:Click to Test%>" class="btn cbi-button cbi-button-apply" onclick="diag_dns(this.form.dns_host)" />
</div>
<div style="width:33%; float: left; text-align: center; white-space: nowrap;">
<%:Generate Logs%>&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="<%:Click to Generate%>" class="btn cbi-button cbi-button-apply" onclick="gen_debug_logs(this)" />
</div>
</fieldset>
<fieldset class="diag-style" style="display:none">
<legend id="diag-rc-legend"><%:Collecting data...%></legend>
<br />
<span id="diag-rc-output"></span>
</fieldset>
<fieldset class="diag-style" style="display:none">
<legend id="dns-rc-legend"><%:Collecting data...%></legend>
<br />
<span id="dns-rc-output"></span>
</fieldset>
<fieldset class="diag-style" style="display:none">
<legend id="debug-rc-legend"><%:Collecting data...%></legend>
<br />
<span id="debug-rc-output"></span>
</fieldset>
</form>
@@ -0,0 +1,420 @@
<style>
.oc[data-darkmode="true"] .developer-container {
background: var(--bg-white);
border-color: var(--border-light);
}
.oc[data-darkmode="true"] .developer-avatar {
border-color: rgba(249, 250, 251, 0.8);
background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
}
.oc[data-darkmode="true"] .developer-avatar:hover {
border-color: rgba(249, 250, 251, 1);
}
.oc[data-darkmode="true"] .developer-label {
background: rgba(31, 41, 55, 0.9);
border-color: rgba(107, 114, 128, 0.3);
color: var(--text-primary);
}
.oc .developer_ {
text-align: justify;
text-align-last: justify;
}
.oc .developer-container {
background: var(--bg-white);
border: 1px solid var(--border-light);
border-radius: var(--radius-lg);
padding: var(--card-padding);
box-shadow: var(--shadow-md);
margin: 0;
width: 100%;
transition: all var(--transition-fast);
overflow: hidden;
position: relative;
}
.oc .developer-grid {
display: flex;
flex-wrap: wrap;
gap: 8px 30px;
padding: 0;
justify-content: center;
align-items: flex-start;
position: relative;
z-index: 1;
min-height: auto;
line-height: 1;
padding-top: 5px;
}
.oc .developer-avatar-container {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
flex-shrink: 0;
min-width: 50px;
width: 50px;
}
.oc .developer-avatar-container:hover {
transform: translateY(-3px);
}
.oc .developer-avatar {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
border-radius: 50%;
width: 50px;
height: 50px;
object-fit: cover;
border: 2px solid rgba(255, 255, 255, 0.8);
box-shadow:
0 3px 10px rgba(0, 0, 0, 0.1),
0 1px 6px rgba(0, 0, 0, 0.08),
inset 0 1px 0 rgba(255, 255, 255, 0.4);
position: relative;
background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
padding: 1px;
}
.oc .developer-avatar::before {
content: '';
position: absolute;
top: -4px;
left: -4px;
right: -4px;
bottom: -4px;
border-radius: 50%;
background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #f5576c);
opacity: 0;
transition: opacity 0.3s ease;
z-index: -1;
animation: rotate 3s linear infinite;
}
.oc .developer-avatar:hover::before {
opacity: 0.6;
}
.oc .developer-avatar:hover {
transform: scale(1.1) rotate(3deg);
box-shadow:
0 6px 20px rgba(0, 0, 0, 0.12),
0 3px 10px rgba(102, 126, 234, 0.25),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
border-color: rgba(255, 255, 255, 1);
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.oc .developer-label {
margin-top: 6px;
font-size: 11px;
font-weight: 400;
color: #555;
text-align: center;
opacity: 0;
transform: translateY(6px);
transition: all 0.25s ease;
background: rgba(255, 255, 255, 0.9);
padding: 2px 6px;
border-radius: 6px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
backdrop-filter: blur(8px);
border: 1px solid rgba(255, 255, 255, 0.3);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
white-space: nowrap;
}
.oc .developer-avatar-container:hover .developer-label {
opacity: 1;
transform: translateY(0);
}
.oc .developer-grid > span {
animation: fadeInUp 0.6s ease forwards;
opacity: 0;
transform: translateY(20px);
}
.oc .developer-grid > span:nth-child(1) { animation-delay: 0.1s; }
.oc .developer-grid > span:nth-child(2) { animation-delay: 0.15s; }
.oc .developer-grid > span:nth-child(3) { animation-delay: 0.2s; }
.oc .developer-grid > span:nth-child(4) { animation-delay: 0.25s; }
.oc .developer-grid > span:nth-child(5) { animation-delay: 0.3s; }
.oc .developer-grid > span:nth-child(6) { animation-delay: 0.35s; }
.oc .developer-grid > span:nth-child(7) { animation-delay: 0.4s; }
.oc .developer-grid > span:nth-child(8) { animation-delay: 0.45s; }
.oc .developer-grid > span:nth-child(9) { animation-delay: 0.5s; }
.oc .developer-grid > span:nth-child(10) { animation-delay: 0.55s; }
.oc .developer-grid > span:nth-child(11) { animation-delay: 0.6s; }
.oc .developer-grid > span:nth-child(12) { animation-delay: 0.65s; }
.oc .developer-grid > span:nth-child(13) { animation-delay: 0.7s; }
.oc .developer-grid > span:nth-child(14) { animation-delay: 0.75s; }
.oc .developer-grid > span:nth-child(15) { animation-delay: 0.8s; }
@keyframes fadeInUp {
to {
opacity: 1;
transform: translateY(0);
}
}
@media (min-width: 1200px) {
.oc .developer-grid {
gap: 10px 35px;
}
.oc .developer-avatar {
width: 60px;
height: 60px;
border-width: 3px;
}
.oc .developer-avatar-container {
min-width: 60px;
width: 60px;
}
.oc .developer-label {
font-size: 11px;
padding: 3px 8px;
margin-top: 6px;
}
}
@media (max-width: 768px) {
.oc .developer-grid {
gap: 6px 25px;
}
.oc .developer-avatar {
width: 45px;
height: 45px;
border-width: 2px;
}
.oc .developer-avatar-container {
min-width: 45px;
width: 45px;
}
.oc .developer-label {
font-size: 9px;
padding: 2px 4px;
margin-top: 6px;
}
}
@media (max-width: 600px) {
.oc .developer-grid {
gap: 4px 20px;
}
.oc .developer-avatar {
width: 40px;
height: 40px;
}
.oc .developer-avatar-container {
min-width: 40px;
width: 40px;
}
.oc .developer-label {
font-size: 8px;
padding: 1px 4px;
margin-top: 4px;
}
}
@media (max-width: 480px) {
.oc .developer-grid {
gap: 3px 15px;
}
.oc .developer-avatar {
width: 35px;
height: 35px;
}
.oc .developer-avatar-container {
min-width: 35px;
width: 35px;
}
.oc .developer-label {
font-size: 7px;
padding: 1px 3px;
margin-top: 3px;
}
}
@media (max-width: 320px) {
.oc .developer-grid {
gap: 2px 10px;
}
.oc .developer-avatar {
width: 30px;
height: 30px;
}
.oc .developer-avatar-container {
min-width: 30px;
width: 30px;
}
.oc .developer-label {
font-size: 6px;
padding: 1px 2px;
margin-top: 3px;
}
}
</style>
<fieldset class="cbi-section">
<div class="oc">
<div class="developer-container">
<div class="developer-grid">
<span id="_Dreamacro"><%:Collecting data...%></span>
<span id="_vernesong"><%:Collecting data...%></span>
<span id="_frainzy1477"><%:Collecting data...%></span>
<span id="_SukkaW"><%:Collecting data...%></span>
<span id="_lhie1_dev"><%:Collecting data...%></span>
<span id="_ConnersHua_dev"><%:Collecting data...%></span>
<span id="_haishanh"><%:Collecting data...%></span>
<span id="_MaxMind"><%:Collecting data...%></span>
<span id="_FQrabbit"><%:Collecting data...%></span>
<span id="_Alecthw"><%:Collecting data...%></span>
<span id="_Tindy_X"><%:Collecting data...%></span>
<span id="_lmc999"><%:Collecting data...%></span>
<span id="_dlercloud"><%:Collecting data...%></span>
<span id="_immortalwrt"><%:Collecting data...%></span>
<span id="_MetaCubeX"><%:Collecting data...%></span>
</div>
</div>
</div>
</fieldset>
<script type="text/javascript">//<![CDATA[
var Dreamacro = document.getElementById('_Dreamacro');
var vernesong = document.getElementById('_vernesong');
var frainzy1477 = document.getElementById('_frainzy1477');
var SukkaW = document.getElementById('_SukkaW');
var lhie1_dev = document.getElementById('_lhie1_dev');
var ConnersHua_dev = document.getElementById('_ConnersHua_dev');
var MaxMind = document.getElementById('_MaxMind');
var haishanh = document.getElementById('_haishanh');
var FQrabbit = document.getElementById('_FQrabbit');
var Alecthw = document.getElementById('_Alecthw');
var Tindy_X = document.getElementById('_Tindy_X');
var dlercloud = document.getElementById('_dlercloud');
var immortalwrt = document.getElementById('_immortalwrt');
var lmc999 = document.getElementById('_lmc999');
var MetaCubeX = document.getElementById('_MetaCubeX');
function getAvatarSize() {
var width = window.innerWidth;
if (width <= 320) return '30px';
if (width <= 480) return '35px';
if (width <= 600) return '40px';
if (width <= 768) return '45px';
if (width >= 1200) return '60px';
return '50px';
}
function createAvatarHTML(src, title, alt, clickHandler) {
var size = getAvatarSize();
return '<div class="developer-avatar-container">' +
'<img src="' + src + '" loading="lazy" class="developer-avatar" title="' + title + '" alt="' + alt + '" width="' + size + '" height="' + size + '" onerror="return imgerrorfun(this,this.src)" onclick="return ' + clickHandler + '()" />' +
'<div class="developer-label">' + title + '</div>' +
'</div>';
}
function setAvatars() {
Dreamacro.innerHTML = createAvatarHTML('https://avatars3.githubusercontent.com/u/8615343?s=460&v=4', 'Dreamacro', 'Dreamacro', 'Dreamacro_rediret');
vernesong.innerHTML = createAvatarHTML('https://avatars2.githubusercontent.com/u/42875168?s=460&v=4', 'vernesong', 'vernesong', 'vernesong_rediret');
frainzy1477.innerHTML = createAvatarHTML('https://avatars2.githubusercontent.com/u/49537471?s=460&v=4', 'frainzy1477', 'frainzy1477', 'frainzy1477_rediret');
SukkaW.innerHTML = createAvatarHTML('https://avatars1.githubusercontent.com/u/40715044?s=460&v=4', 'SukkaW', 'SukkaW', 'SukkaW_rediret');
lhie1_dev.innerHTML = createAvatarHTML('https://avatars1.githubusercontent.com/u/11873197?s=460&v=4', 'lhie1', 'lhie1', 'lhie1_rediret');
ConnersHua_dev.innerHTML = createAvatarHTML('https://avatars1.githubusercontent.com/u/11730838?s=460&v=4', 'ConnersHua', 'ConnersHua', 'ConnersHua_rediret');
MaxMind.innerHTML = createAvatarHTML('https://avatars3.githubusercontent.com/u/1181834?s=460&v=4', 'MaxMind', 'MaxMind', 'MaxMind_rediret');
haishanh.innerHTML = createAvatarHTML('https://avatars1.githubusercontent.com/u/1166872?s=460&v=4', 'haishanh', 'haishanh', 'haishanh_rediret');
FQrabbit.innerHTML = createAvatarHTML('https://avatars1.githubusercontent.com/u/29931248?s=460&v=4', 'FQrabbit', 'FQrabbit', 'FQrabbit_rediret');
Alecthw.innerHTML = createAvatarHTML('https://avatars.githubusercontent.com/u/22856212?v=4', 'Alecthw', 'Alecthw', 'Alecthw_rediret');
Tindy_X.innerHTML = createAvatarHTML('https://avatars0.githubusercontent.com/u/49061470?s=460&u=22a89312bf2de411e87340e04b5f9d149f7366cc&v=4', 'Tindy X', 'Tindy X', 'Tindy_X_rediret');
dlercloud.innerHTML = createAvatarHTML('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAAEcq2jCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjFFQjY1RjRCMjJENDExRUM5NjlEQURCQTU4RDMyNUM3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjFFQjY1RjRDMjJENDExRUM5NjlEQURCQTU4RDMyNUM3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MUVCNjVGNDkyMkQ0MTFFQzk2OURBREJBNThEMzI1QzciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MUVCNjVGNEEyMkQ0MTFFQzk2OURBREJBNThEMzI1QzciLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5CHITsAAACx1BMVEVjY2P+/v79/f1kZGT8/PwDAwMCAgIBAQFiYmIEBAT7+/tlZWX6+vpmZmZnZ2dhYWFpaWnb29toaGhaWlrh4eFgYGAFBQVXV1dNTU1qampVVVXi4uJcXFxYWFhfX19dXV1MTExZWVlsbGw7OztQUFBRUVFSUlLy8vJPT0/d3d0iIiL09PRWVlZUVFS6urqUlJTo6Oj5+fmLi4uxsbGYmJhLS0tzc3P39/fz8/M9PT1TU1OhoaHr6+sZGRkLCwsJCQk3NzdeXl6MjIzDw8N6enqoqKjOzs7V1dXAwMBKSkqjo6OFhYX29va5ublwcHDg4OAxMTFbW1szMzN7e3tCQkIYGBiPj4/c3NwwMDCNjY1FRUUrKystLS1JSUnl5eV3d3fW1tbw8PC/v7+2traJiYmVlZWenp7Nzc2amppOTk6ysrKmpqZubm5ISEh+fn42NjY8PDxHR0c4ODja2to5OTnf398QEBAkJCQfHx8WFhYgICAbGxvq6urt7e28vLwGBgZ0dHTn5+fZ2dnCwsJ4eHgMDAweHh41NTX19fV5eXns7OzY2NigoKAHBwfm5uYICAhvb2+7u7vv7+/MzMwODg5tbW3x8fElJSXKysoXFxdEREQTExOKioru7u6bm5t1dXWdnZ0yMjKpqamGhobS0tLIyMg+Pj6Hh4e3t7cjIyPQ0NAKCgoUFBTR0dEnJyd9fX2BgYEPDw8oKCj4+Pi+vr4sLCwVFRXj4+MdHR2vr686OjohISGQkJA/Pz+rq6unp6e1tbVDQ0OsrKywsLDJyckcHBzFxcWIiIiCgoLk5OTPz8+RkZGTk5Pp6enT09PGxsYaGhqXl5dycnKzs7PU1NSqqqrBwcF/f3+lpaVAQECEhITExMSWlpa0tLSDg4Otra18fHxBQUFGRkbe3t6ZmZlra2s0NDRxcXGioqIuLi4SEhIAAAD///+mEWvaAAAN20lEQVR42mJ4QwAwDE4FTPgVCDAAASNOBYx+QGkOBuYjuBS8ZuAF22KUgF3B69cEHEmEAia8Cl6/fp1GSAEbISsw7MBQ8JqgAia8cYFpBKkKuIAKGPHGJoYjsCjAb0IkATdgxhemAgJp8pAAAQWvh0jOQgUAATREFTDiTw/FwOzPLIwn0YKKBw4GBlwKXF4zbAAzFHFlHK03hDIvIQWsFJtAWAH+NLkRI1+RVYDgVcAIVBCJNzZZCRUgmhgFIXppT8gEoDPvEFLwhlIFBBIt49DMegABRFDBqAFUMIClVEGOQ048g0wDWDkYIICZGdKuIc2A3WxgzaIyLpF5siq8DMwmpBnA/rqfQ4MJf2LHZwC2gooEA5hAJchrRvIN4HtNoQtevybOBJwGzIEYYE22ASysxDmBQCwAQSL5SRlqgib5eYGYgMRrgDHEAFbycyPEAHYm8rMzOCrYKDCAcCAQMECdskCEOMGGEgO0CSZFQmGwhsJClYLyYLRmIh4ABGC/7pEIBsIwAGfXR37WTPwUhiEKf6NMZUbtAHqtUqPTchKdKxhHcAyNIjmEyCYKDfleCiMHyJPN7jfZ982BHPgdQAgIuNYtt91wJA+gTRTQ4pTmEQtYGWnMM9y1YFxtSj9u3auvMaCsQGkRv3yqDstm3ysoRZmAKKN0Das1emzf9jKUGRNKpfZ0oPtsgHkkYJDei4lfBE53YIQmVcUHyP5IVi4SCOBpfc4GynoPbAftCzs2MAvQuG9qoAyN8hu963XhOKNAINHGwl6BCNDGMtHP28QFKCks/LuxY4KlKxmmKhuQAQiEPRTwY8BHGgt2CrrC8+cgHcYQ/IQQBSQISGQFAvojxadgSyxolsCkOs7Teg78DXATgF37d2kYiOIAnrskd2ma2ErRUlR0UbEU6VoVLIggpYLoIgguioKbIFihXQVxcBLRWQQXB0Fd/BccXQRdHC9/hKY/c6IopnlvufsDmk+/d8nde0noH1AABVAABVAAr970rk0cv+ftrx9QAQCI97znurrebHJpbmpwnQACrnK6Jg3906KPTYMAiCfutO+HpRfG7cgBgpnJwP+3rITV6vT5OfTN25ECiqZghcZbaDcxulmtZ0Ib7dZaaXhEz8QTrzQqAM3XS5+kpsVzbz+8+aGkvJKdoZEAjEe/dmPXPcXFX1Y8jSQBmo412xAE5UFE0uZfX4FHAqBzXKAC2q0oYZZsBICx0AaIfpQEZnlHUKUIgM7lBat4uAAhJik8YI0FBfAJkLIUgUC4DSvBCNgtOIA4UgLmBYFOwNiQVgHLgh9K7ZeYJDgHPxUbGVOeBvBjORmSBOwMvC4gu9IsxE4d6MKELMuz4BBggOedBK/PDxBKsy49Ef8NoE8SYICCJ0CmAsuA98ID5KMBBsDY4sgJeIIjLkJ/7Le2JX6PAjC2WfhzSbgGRWs3OnJQAeYSRU2A34BvxxLATFEsAL30b8OHcLVBGABZZewQ/lgu9akwyvPODOx0o0WimtUKoAAKoADogA8B2DmXnSiCKAxT1dX3tjUj6GQM4IAarhJRLkZBlASCJqgBZYMxuFGEBYrGiBs1GI1RE19AIhs1Jl4SE+PGuHRtfAYTU/UQzkzDTNcgAaa7z9lUvUB/85/q02eq/nMUgAJQAApAASgABaAAFIACiAmA5BcWABWCfZ2fr57aoGkxGQAi6LG2TH2NZdXU72zqHt6ymywiAO1J70+5WmGgRW657vQRAeklE21dfsE3FZqrkb4OBuCcPTFbpZV72Sy3y2MgAM6zC365jS0QI/2DAgB4F/kvbR03nbWUPAD7abe4mvRUK2iazUVFS41sdi9WCsCuGTy71s1XtPOl5jZJUCEAa+acN2ir/kU321Y3+qnz1JmlmvZ9GdfVNNf/szmCygDo0/xBfUPwfDezbdAppOPAT8h+d0+f91P+4yQVyN9T9LuFX9/+cs0wCSrI2+1N/nhyAAsG5/qAVWXt2Dvx/+SbywSDN0YSAqBfClc1WS01flCsn3OYaH2Y0JyN4K6qYXZgo31GElGApoJba38MqyBZuazb7eEA0KOBAHoHQ1KgeF2KA+B9tFdDQHEUKHoW/qIAkBLAAkpZ7izbHNfW+8FABrBLto0JFGt3yEFmefAA5EHIuvMOIQR0T7ye2q0DVIcBjhNcAL2OIIeAY+8B3kvA34Jeyc3qM8w8gOMtF31m2Mr5jUEDsE7JT/scXAH6Qo7BFIEOgbwJjDl4gDnZUcyg3fVEzgT6LYSq2IwzGVXQX9AhxcDsw/pnVFy3oe189L6UCsxH4AqUSzBEgQFYrSzBZ3AFyiV4QoAB6LTc4tEIrQAplwA8BOKSJIE+SKEB5HSoT4IrIF7rMcWgQgD5/wHnDnyXjfxJusKgAZxX4WRkL3rgCkhvol1L4QH6Ql1/Zj/4WyDYdxO30ansg4ABcNfABWBvdFwAcgg7BAIdoMWMoSKI0ms2tqs4COAyQiYUzulSNj7MEABIa2kL9BCMPSAQ6wEZQG9kOACTK7nQGKIoAF6djVYVBwBWAKAfILgAkQ7rYgAw7iADRDsjiQ5g3BRYCjgn7ejHtZHywLlcSWIuO3gA+QDcEwIVIPJ5eVSAZoYH4Mzo/KqDqAAdtWeiz2SKEoL3ixgDkUJrLA4DQaTGZ4EMIBSAAlAACkABKAAFoAAUgAKIY/0ToL1zf42jiuL4zp3Zmc3szu52N4/dZNO802DMo82jNm0TE2wTTWNMaNIY7YPWqihpoGhFq0m1+MAXtdVarRWlVqQqglXxFxERFVF8ILine truncated
immortalwrt.innerHTML = createAvatarHTML('https://avatars.githubusercontent.com/u/82308430?v=4', 'immortalwrt', 'immortalwrt', 'immortalwrt_rediret');
lmc999.innerHTML = createAvatarHTML('https://avatars.githubusercontent.com/u/39726914?v=4', 'lmc999', 'lmc999', 'lmc999_rediret');
MetaCubeX.innerHTML = createAvatarHTML('https://avatars.githubusercontent.com/u/84378451?v=4', 'MetaCubeX', 'MetaCubeX', 'MetaCubeX_rediret');
}
setAvatars();
window.addEventListener('resize', function() {
setAvatars();
});
function Dreamacro_rediret() {
window.open('https://github.com/Dreamacro');
}
function vernesong_rediret() {
window.open('https://github.com/vernesong');
}
function frainzy1477_rediret() {
window.open('https://github.com/frainzy1477');
}
function SukkaW_rediret() {
window.open('https://github.com/SukkaW');
}
function lhie1_rediret() {
window.open('https://github.com/lhie1');
}
function ConnersHua_rediret() {
window.open('https://github.com/ConnersHua');
}
function MaxMind_rediret() {
window.open('https://dev.maxmind.com/geoip/geoip2/geolite2/');
}
function haishanh_rediret() {
window.open('https://github.com/haishanh');
}
function FQrabbit_rediret() {
window.open('https://github.com/FQrabbit');
}
function Alecthw_rediret() {
window.open('https://github.com/alecthw');
}
function Tindy_X_rediret() {
window.open('https://github.com/tindy2013');
}
function dlercloud_rediret() {
window.open('https://bit.ly/32mrABp');
}
function immortalwrt_rediret() {
window.open('https://github.com/immortalwrt');
}
function lmc999_rediret() {
window.open('https://github.com/lmc999');
}
function MetaCubeX_rediret() {
window.open('https://github.com/MetaCubeX');
}
function imgerrorfun(imgobj, imgSrc) {
setTimeout(function() {
imgobj.src = imgSrc;
}, 1000 * 10);
}
//]]></script>
@@ -0,0 +1,111 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function dler_login(btn,option)
{
btn.disabled = true;
if (option == "dler_login") {
var s = document.getElementById(option+'-status');
var e = document.getElementsByName('cbid.openclash.config.dler_email');
var p = document.getElementsByName('cbid.openclash.config.dler_passwd');
var c = document.getElementsByName('cbid.openclash.config.dler_checkin');
if (!e[0].value || !p[0].value) {
btn.disabled = false;
s.innerHTML ="<font color='red'><strong>"+"<%:Error Login Info%>"+"</strong></font>";
return false;
};
if (c[0] && c[0].checked) {
c = "1";
var i = document.getElementsByName('cbid.openclash.config.dler_checkin_interval');
var m = document.getElementsByName('cbid.openclash.config.dler_checkin_multiple');
if (!i[0].value || !(/(^[1-9]\d*$)/.test(i[0].value))) { i = "1"} else {i = i[0].value};
if (!m[0].value || !(/(^[1-9]\d*$)/.test(m[0].value)))
{
btn.disabled = false;
s.innerHTML ="<font color='red'><strong>"+"<%:Multiple Must Be a Positive Integer and No More Than 100%>"+"</strong></font>";
return false;
}
else if (m[0].value < 1)
{
btn.disabled = false;
s.innerHTML ="<font color='red'><strong>"+"<%:Multiple Must Be a Positive Integer and No More Than 100%>"+"</strong></font>";
return false;
}
else if (m[0].value > 100)
{
btn.disabled = false;
s.innerHTML ="<font color='red'><strong>"+"<%:Multiple Must Be a Positive Integer and No More Than 100%>"+"</strong></font>";
return false;
}
else {
m = m[0].value;
};
}
else {
c = "0";
var i = "1";
var m = "1";
};
btn.value = '<%:Login...%>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_login_info_save")%>', {email: e[0].value, passwd : p[0].value, checkin: c, interval: i, multiple: m}, function(x, status) {
if (x && x.status == 200) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_login")%>', null, function(x, status) {
if (s)
{
if (x && x.status == 200 && status.dler_login == 200) {
s.innerHTML ="<font color='green'><strong>"+"<%:Dler Cloud Login Successful%>"+"</strong></font>";
window.location.href='<%="settings?tab.openclash.config=dlercloud"%>';
}
else {
s.innerHTML ="<font color='red'><strong>"+"<%:Dler Cloud Login Faild%>"+"</strong></font>";
if (status.dler_login) {
alert("<%:Dler Cloud Login Faild%>: "+status.dler_login)
}
window.location.href='<%="settings?tab.openclash.config=dlercloud"%>';
}
}
btn.disabled = false;
btn.value = '<%:Login Account%>';
});
}
});
};
if (option == "dler_logout") {
var s = document.getElementById('dler_login-status');
btn.value = '<%:Logout...%>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_logout")%>', null, function(x, status) {
if (s)
{
if (x && x.status == 200 && status.dler_logout == 200) {
s.innerHTML ="<font color='green'><strong>"+"<%:Dler Cloud Logout Successful%>"+"</strong></font>";
window.location.href='<%="settings?tab.openclash.config=dlercloud"%>';
}
else {
s.innerHTML ="<font color='red'><strong>"+"<%:Dler Cloud Logout Faild%>"+"</strong></font>";
if (status.dler_logout) {
alert("<%:Dler Cloud Logout Faild%>: "+status.dler_logout)
}
}
}
btn.disabled = false;
btn.value = '<%:Logout Account%>';
}
);
};
return false;
}
function web_dler(btn)
{
btn.disabled = true;
url='https://bit.ly/32mrABp';
window.open(url);
btn.disabled = false;
return false;
}
//]]></script>
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Login Account%>" onclick="return dler_login(this,'dler_login')" />
<input type="button" class="btn cbi-button cbi-button-remove" value="<%:Logout Account%>" onclick="return dler_login(this,'dler_logout')" />
<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Official Website%>" onclick="return web_dler(this)" />
<span id="<%=self.option%>-status"><%=self.value%></span>
<%+cbi/valuefooter%>
@@ -0,0 +1,845 @@
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimal-ui">
<style>
.oc[data-darkmode="true"] .card {
background: linear-gradient(var(--bg-gray), #657183);
}
.oc[data-darkmode="true"] .card .additional {
background: linear-gradient(#337ab7, #657183);
}
.oc[data-darkmode="true"] .card .general .dler-title {
color: #dfdfdf;
}
.oc[data-darkmode="true"] .card .general .dler-result {
color: #dfdfdf;
}
.oc[data-darkmode="true"] .card .general .dler-result2 {
color: #dfdfdf;
}
.oc[data-darkmode="true"] .card .general h1 {
color: #dfdfdf;
}
.oc[data-darkmode="true"] .card .additional .user-card::after {
border-left: 2px solid #ffffff33;
}
.oc[data-darkmode="true"] .card .additional .more-info h1 {
color: #ededed;
}
.oc[data-darkmode="true"] .card .additional .coords {
color: #ededed;
}
.oc[data-darkmode="true"] .card .general .dler-info::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.3);
}
.oc[data-darkmode="true"] .card .general .dler-info::-webkit-scrollbar-thumb:hover {
background: rgba(255,255,255,0.4);
}
.oc .dler-main-container {
background: var(--bg-white);
margin: 0 auto;
width: 100%;
transition: all var(--transition-fast);
}
.oc .center {
width: 100%;
background: var(--bg-white);
border: 1px solid var(--border-light);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
padding: 12px;
transition: all var(--transition-fast);
}
.oc .card {
width: 100%;
height: 250px;
background-color: #fff;
background: linear-gradient(#f8f8f8, #fff);
box-shadow: 0 8px 16px -8px rgba(0,0,0,0.4);
border-radius: 6px;
position: relative;
}
.oc .card h1 {
text-align: center;
}
.oc .card .additional {
position: absolute;
width: 150px;
height: 100%;
background: linear-gradient(#337ab7, #fefefe);
transition: width 0.5s cubic-bezier(0.4, 0.0, 0.2, 1), border-radius 0.5s ease;
overflow: hidden;
z-index: 2;
display: flex;
align-items: stretch;
border-radius: var(--radius-lg);
}
.oc .card .additional.expanded {
width: 100%;
}
.oc .card .additional.collapsed {
width: 150px;
}
.oc .card .additional .user-card {
width: 150px;
height: 100%;
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.oc .card .additional .user-card::after {
content: "";
display: block;
position: absolute;
top: 10%;
right: -2px;
height: 80%;
border-left: 2px solid rgba(0,0,0,0.025);
}
.oc .card .additional .user-card .img {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.oc .card .additional .user-card img {
width: 65%;
border-radius: 50%;
position: relative;
top: auto;
left: auto;
bottom: auto;
}
.oc .card .additional .more-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
padding: 1rem;
text-align: center;
transition: opacity 0.3s ease, visibility 0.3s ease;
opacity: 0;
visibility: hidden;
overflow: visible;
}
.oc .card .additional.expanded .more-info {
opacity: 1;
visibility: visible;
}
.oc .card .additional.collapsed .more-info {
opacity: 0;
visibility: hidden;
}
.oc .card .additional .more-info h1 {
color: #fff;
margin: 0.5rem 0;
font-size: 2.5rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-bottom: none;
position: relative;
line-height: 1.2;
padding-top: 0.2rem;
}
.oc .card .additional .more-info h1::after {
content: "";
position: absolute;
bottom: -0.2rem;
left: 50%;
transform: translateX(-50%);
width: 60%;
height: 1px;
background-color: #eee;
margin-bottom: 5px;
}
.oc .card .additional .coords {
color: #fff;
font-size: 1rem;
line-height: 1.4;
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.oc .card .additional.expanded + .general {
margin-left: 0;
opacity: 0;
}
.oc .card .additional.collapsed + .general {
opacity: 1;
}
.oc .card .general {
width: auto;
height: 100%;
position: relative;
margin-left: 180px;
top: 0;
right: 0;
z-index: 1;
overflow: hidden;
padding-top: 0;
padding-right: 10px;
transition: margin-left 0.5s ease, opacity 0.5s ease;
opacity: 1;
}
.oc .card .general h1 {
font-size: 30px;
text-align: center;
padding-top: 10px;
margin: 0 0 0 -15%;
line-height: 35px;
color: var(--text-title) !important;
}
.oc .card .general .dler-info {
top: 8%;
width: 90%;
height: 65%;
display: grid;
grid-template-columns: 1fr 1fr 120px;
gap: 5%;
position: absolute;
margin: 0 auto;
overflow-y: auto;
overflow-x: hidden;
position: relative;
}
.oc .card .general .dler-info-left {
display: flex;
flex-direction: column;
gap: 4px;
overflow: visible;
}
.oc .card .general .dler-info-center {
display: flex;
flex-direction: column;
gap: 4px;
overflow: visible;
}
.oc .card .general .dler-info-right {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-width: 100px;
width: 100%;
height: 100%;
padding-right: 10px;
}
.oc .card .general .dler-btn-container {
display: flex;
justify-content: center;
align-items: center;
flex: 1;
margin-bottom: 30px;
}
.oc .card .general .dler-info p {
padding: 4px 0 !important;
text-align: left;
margin-bottom: 0;
line-height: 25px;
min-height: 25px;
}
.oc .card .general .dler-info div {
position: relative;
}
.oc .card .general .dler-title {
font-weight: bold;
color: var(--text-primary) !important;
font-size: 15px;
display: inline-block;
width: 45%;
overflow: hidden;
vertical-align: bottom;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 25px;
height: 25px;
text-align: left;
}
.oc .card .general .dler-result {
color: var(--text-secondary) !important;
font-size: 15px;
white-space: nowrap;
display: inline-block;
width: 55%;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: bottom;
text-align: right;
line-height: 25px;
height: 25px;
}
.oc .card .general .dler-result2 {
color: var(--text-secondary) !important;
font-size: 15px;
white-space: nowrap;
display: inline-block;
width: 55%;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: bottom;
text-align: right;
line-height: 25px;
height: 25px;
}
.oc .card .general .btn {
color: white !important;
border-color: #337ab7 !important;
background: #1473e6;
background-color: var(--primary-color) !important;
box-shadow: 0 8px 16px -8px rgba(0,0,0,0.4);
border-radius: 6px;
width: 90px;
height: 90px !important;
font-size: 15px;
font-weight: bold;
display: inline-block;
overflow: hidden;
appearance: button;
-webkit-appearance: button;
border: none !important;
cursor: pointer;
transition: all var(--transition-fast);
text-shadow: none !important;
}
.oc .card .general .btn:hover {
background: #2563eb !important;
}
.oc .card .general .more {
font-size: 12px;
line-height: 16px;
padding: 0;
margin: 0;
pointer-events: auto;
overflow: hidden;
display: flex;
justify-content: flex-end;
align-items: center;
position: absolute;
bottom: 8px;
left: 0;
right: 0;
width: 100%;
z-index: 10;
padding-right: 16px;
padding-bottom: 5px;
white-space: nowrap;
text-overflow: ellipsis;
}
.oc .card .general .more p {
margin: 0;
font-size: 15px;
padding: 0;
color: var(--text-secondary) !important;
text-align: right;
white-space: nowrap;
overflow: hidden;
width: 100%;
min-width: 0;
flex-shrink: 1;
text-overflow: ellipsis;
}
.oc .card .general .more a {
text-decoration: none;
color: var(--primary-color);
opacity: 0.8;
transition: opacity var(--transition-fast);
white-space: nowrap;
font-weight: 500;
}
.oc .card .general .more a:hover {
opacity: 1;
text-decoration: underline;
}
.oc .card .general .dler-info::-webkit-scrollbar {
width: 4px;
}
.oc .card .general .dler-info::-webkit-scrollbar-track {
background: transparent;
}
.oc .card .general .dler-info::-webkit-scrollbar-thumb {
background: rgba(0,0,0,0.2);
border-radius: 2px;
}
.oc .card .general .dler-info::-webkit-scrollbar-thumb:hover {
background: rgba(0,0,0,0.3);
}
@media screen and (max-width: 1200px) {
.oc .dler-main-container {
width: calc(100% - 32px);
}
.oc .card .additional.collapsed {
width: 140px;
}
.oc .card .additional .user-card {
width: 140px;
}
.oc .card .additional .more-info h1 {
font-size: 1.8rem;
}
.oc .card .additional .coords {
font-size: 0.95rem;
}
.oc .card .general {
margin-left: 120px;
padding-right: 8px;
}
.oc .card .general .more {
bottom: 6px;
padding-right: 12px;
}
}
@media screen and (max-width: 768px) {
.oc .dler-main-container {
width: 100%;
}
.oc .card .additional.collapsed {
width: 125px;
}
.oc .card .additional .user-card {
width: 125px;
}
.oc .card .additional .more-info h1 {
font-size: 1.5rem;
}
.oc .card .additional .coords {
font-size: 0.8rem;
}
.oc .card .general {
margin-left: 110px;
padding-right: 6px;
}
.oc .card .general h1 {
font-size: 24px;
line-height: 30px;
margin: 0;
}
.oc .card .general .dler-info {
grid-template-columns: 1fr;
grid-template-rows: auto auto auto;
gap: 12px;
padding-right: 8px;
height: 50%;
}
.oc .card .general .dler-info-right {
justify-content: flex-start;
padding-top: 8px;
gap: 12px;
}
.oc .card .general .btn {
width: 80px !important;
height: 80px !important;
font-size: 14px;
padding: 0 !important;
}
.oc .card .general .dler-title {
font-size: 14px;
width: 50%;
}
.oc .card .general .dler-result,
.oc .card .general .dler-result2 {
font-size: 14px;
width: 50%;
}
.oc .card .general .more {
bottom: 4px;
padding-right: 10px;
}
.oc .card .general .more p {
font-size: 13px;
}
}
@media screen and (max-width: 575px) {
.oc .center {
padding: 8px;
}
.oc .card .additional.collapsed {
width: 115px;
}
.oc .card .additional .user-card {
width: 115px;
}
.oc .card .additional .more-info h1 {
font-size: 1.3rem;
}
.oc .card .additional .coords {
font-size: 0.7rem;
}
.oc .card .general {
margin-left: 120px;
padding-right: 4px;
}
.oc .card .general .dler-info {
height: 50%;
}
.oc .card .general h1 {
font-size: 18px;
line-height: 26px;
margin: 0;
}
.oc .card .general .dler-title {
font-size: 12px;
width: 50%;
}
.oc .card .general .dler-result,
.oc .card .general .dler-result2 {
font-size: 12px;
width: 50%;
}
.oc .card .general .more {
bottom: 2px;
padding-right: 8px;
}
.oc .card .general .btn {
width: 60px !important;
height: 60px !important;
font-size: 10px;
padding: 0 !important;
}
.oc .card .general .more p {
font-size: 11px;
}
}
</style>
</head>
<body>
<fieldset class="cbi-section">
<table width="100%"><tr><td>
<div class="oc">
<div class="dler-main-container">
<div class="center">
<div id="card" class="card">
<div id="additional" class="additional">
<div class="user-card">
<div class="img">
<img id="dler_logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAAEcq2jCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjFFQjY1RjRCMjJENDExRUM5NjlEQURCQTU4RDMyNUM3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjFFQjY1RjRDMjJENDExRUM5NjlEQURCQTU4RDMyNUM3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MUVCNjVGNDkyMkQ0MTFFQzk2OURBREJBNThEMzI1QzciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MUVCNjVGNEEyMkQ0MTFFQzk2OURBREJBNThEMzI1QzciLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5CHITsAAACx1BMVEVjY2P+/v79/f1kZGT8/PwDAwMCAgIBAQFiYmIEBAT7+/tlZWX6+vpmZmZnZ2dhYWFpaWnb29toaGhaWlrh4eFgYGAFBQVXV1dNTU1qampVVVXi4uJcXFxYWFhfX19dXV1MTExZWVlsbGw7OztQUFBRUVFSUlLy8vJPT0/d3d0iIiL09PRWVlZUVFS6urqUlJTo6Oj5+fmLi4uxsbGYmJhLS0tzc3P39/fz8/M9PT1TU1OhoaHr6+sZGRkLCwsJCQk3NzdeXl6MjIzDw8N6enqoqKjOzs7V1dXAwMBKSkqjo6OFhYX29va5ublwcHDg4OAxMTFbW1szMzN7e3tCQkIYGBiPj4/c3NwwMDCNjY1FRUUrKystLS1JSUnl5eV3d3fW1tbw8PC/v7+2traJiYmVlZWenp7Nzc2amppOTk6ysrKmpqZubm5ISEh+fn42NjY8PDxHR0c4ODja2to5OTnf398QEBAkJCQfHx8WFhYgICAbGxvq6urt7e28vLwGBgZ0dHTn5+fZ2dnCwsJ4eHgMDAweHh41NTX19fV5eXns7OzY2NigoKAHBwfm5uYICAhvb2+7u7vv7+/MzMwODg5tbW3x8fElJSXKysoXFxdEREQTExOKioru7u6bm5t1dXWdnZ0yMjKpqamGhobS0tLIyMg+Pj6Hh4e3t7cjIyPQ0NAKCgoUFBTR0dEnJyd9fX2BgYEPDw8oKCj4+Pi+vr4sLCwVFRXj4+MdHR2vr686OjohISGQkJA/Pz+rq6unp6e1tbVDQ0OsrKywsLDJyckcHBzFxcWIiIiCgoLk5OTPz8+RkZGTk5Pp6enT09PGxsYaGhqXl5dycnKzs7PU1NSqqqrBwcF/f3+lpaVAQECEhITExMSWlpa0tLSDg4Otra18fHxBQUFGRkbe3t6ZmZlra2s0NDRxcXGioqIuLi4SEhIAAAD///+mEWvaAAAN20lEQVR42mJ4QwAwDE4FTPgVCDAAASNOBYx+QGkOBuYjuBS8ZuAF22KUgF3B69cEHEmEAia8Cl6/fp1GSAEbISsw7MBQ8JqgAia8cYFpBKkKuIAKGPHGJoYjsCjAb0IkATdgxhemAgJp8pAAAQWvh0jOQgUAATREFTDiTw/FwOzPLIwn0YKKBw4GBlwKXF4zbAAzFHFlHK03hDIvIQWsFJtAWAH+NLkRI1+RVYDgVcAIVBCJNzZZCRUgmhgFIXppT8gEoDPvEFLwhlIFBBIt49DMegABRFDBqAFUMIClVEGOQ048g0wDWDkYIICZGdKuIc2A3WxgzaIyLpF5siq8DMwmpBnA/rqfQ4MJf2LHZwC2gooEA5hAJchrRvIN4HtNoQtevybOBJwGzIEYYE22ASysxDmBQCwAQSL5SRlqgib5eYGYgMRrgDHEAFbycyPEAHYm8rMzOCrYKDCAcCAQMECdskCEOMGGEgO0CSZFQmGwhsJClYLyYLRmIh4ABGC/7pEIBsIwAGfXR37WTPwUhiEKf6NMZUbtAHqtUqPTchKdKxhHcAyNIjmEyCYKDfleCiMHyJPN7jfZ982BHPgdQAgIuNYtt91wJA+gTRTQ4pTmEQtYGWnMM9y1YFxtSj9u3auvMaCsQGkRv3yqDstm3ysoRZmAKKN0Das1emzf9jKUGRNKpfZ0oPtsgHkkYJDei4lfBE53YIQmVcUHyP5IVi4SCOBpfc4GynoPbAftCzs2MAvQuG9qoAyN8hu963XhOKNAINHGwl6BCNDGMtHP28QFKCks/LuxY4KlKxmmKhuQAQiEPRTwY8BHGgt2CrrC8+cgHcYQ/IQQBSQISGQFAvojxadgSyxolsCkOs7Teg78DXATgF37d2kYiOIAnrskd2ma2ErRUlR0UbEU6VoVLIggpYLoIgguioKbIFihXQVxcBLRWQQXB0Fd/BccXQRdHC9/hKY/c6IopnlvufsDmk+/d8nde0noH1AABVAABVAAr970rk0cv+ftrx9QAQCI97znurrebHJpbmpwnQACrnK6Jg3906KPTYMAiCfutO+HpRfG7cgBgpnJwP+3rITV6vT5OfTN25ECiqZghcZbaDcxulmtZ0Ib7dZaaXhEz8QTrzQqAM3XS5+kpsVzbz+8+aGkvJKdoZEAjEe/dmPXPcXFX1Y8jSQBmo412xAE5UFE0uZfX4FHAqBzXKAC2q0oYZZsBICx0AaIfpQEZnlHUKUIgM7lBat4uAAhJik8YI0FBfAJkLIUgUC4DSvBCNgtOIA4UgLmBYFOwNiQVgHLgh9K7ZeYJDgHPxUbGVOeBvBjORmSBOwMvC4gu9IsxE4d6MKELMuz4BBggOedBK/PDxBKsy49Ef8NoE8SYICCJ0CmAsuA98ID5KMBBsDY4sgJeIIjLkJ/7Le2JX6PAjC2WfhzSbgGRWs3OnJQAeYSRU2A34BvxxLATFEsAL30b8OHcLVBGABZZewQ/lgu9akwyvPODOx0o0WimtUKoAAKoADogA8B2DmXnSiCKAxT1dX3tjUj6GQM4IAarhJRLkZBlASCJqgBZYMxuFGEBYrGiBs1GI1RE19AIhs1Jl4SE+PGuHRtfAYTU/UQzkzDTNcgAaa7z9lUvUB/85/q02eq/nMUgAJQAApAASgABaAAFIACiAmA5BcWABWCfZ2fr57aoGkxGQAi6LG2TH2NZdXU72zqHt6ymywiAO1J70+5WmGgRW657vQRAeklE21dfsE3FZqrkb4OBuCcPTFbpZV72Sy3y2MgAM6zC365jS0QI/2DAgB4F/kvbR03nbWUPAD7abe4mvRUK2iazUVFS41sdi9WCsCuGTy71s1XtPOl5jZJUCEAa+acN2ir/kU321Y3+qnz1JmlmvZ9GdfVNNf/szmCygDo0/xBfUPwfDezbdAppOPAT8h+d0+f91P+4yQVyN9T9LuFX9/+cs0wCSrI2+1N/nhyAAsG5/qAVWXt2Dvx/+SbywSDN0YSAqBfClc1WS01flCsn3OYaH2Y0JyN4K6qYXZgo31GElGApoJba38MqyBZuazb7eEA0KOBAHoHQ1KgeF2KA+B9tFdDQHEUKHoW/qIAkBLAAkpZ7izbHNfW+8FABrBLto0JFGt3yEFmefAA5EHIuvMOIQR0T7ye2q0DVIcBjhNcAL2OIIeAY+8B3kvA34Jeyc3qM8w8gOMtF31m2Mr5jUEDsE7JT/scXAH6Qo7BFIEOgbwJjDl4gDnZUcyg3fVEzgT6LYSq2IwzGVXQX9AhxcDsw/pnVFy3oe189L6UCsxH4AqUSzBEgQFYrSzBZ3AFyiV4QoAB6LTc4tEIrQAplwA8BOKSJIE+SKEB5HSoT4IrIF7rMcWgQgD5/wHnDnyXjfxJusKgAZxX4WRkL3rgCkhvol1L4QH6Ql1/Zj/4WyDYdxO30ansg4ABcNfABWBvdFwAcgg7BAIdoMWMoSKI0ms2tqs4COAyQiYUzulSNj7MEABIa2kL9BCMPSAQ6wEZQG9kOACTK7nQGKIoAF6djVYVBwBWAKAfILgAkQ7rYgAw7iADRDsjiQ5g3BRYCjgn7ejHtZHywLlcSWIuO3gA+QDcEwIVIPJ5eVSAZoYH4Mzo/KqDqAAdtWeiz2SKEoL3ixgDkUJrLA4DQaTGZ4EMIBSAAlAACkABKAAFoAAUgAKIY/0ToL1zf42jiuL4zp3Zmc3szu52N4/dZNO802DMo82jNm0TE2wTTWNMaNIY7YPWqihpoGhFq0m1+MAXtdVarRWlVqQqglXxFxERLine truncated
</div>
</div>
<div class="more-info" id="more_info">
<h1>Dler Cloud</h1>
<div class="coords" id="dler_it">
<%:Simple & trustworthy%>
</div>
</div>
</div>
<div class="general">
<h1 id="dler-plan"></h1>
<div class="dler-info">
<div class="dler-info-left">
<div>
<p>
<span class="dler-title" title="<%:Plan Expiration Time%>"><%:Plan Expiration Time%>:</span><span class="dler-result" id="dler-plantime" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
<p>
<span class="dler-title" title="<%:Account Balances%>"><%:Account Balances%>:</span><span class="dler-result" id="dler-money" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
<p>
<span class="dler-title" title="<%:Aff Balances%>"><%:Aff Balances%>:</span><span class="dler-result" id="dler-affmoney" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
<p>
<span class="dler-title" title="<%:Account Integral%>"><%:Account Integral%>:</span><span class="dler-result" id="dler-integral" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
</div>
</div>
<div class="dler-info-center">
<div>
<p>
<span class="dler-title" title="<%:Today Used%>"><%:Today Used%>:</span><span class="dler-result2" id="dler-today-used" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
<p>
<span class="dler-title" title="<%:Plan Used%>"><%:Plan Used%>:</span><span class="dler-result2" id="dler-used" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
<p>
<span class="dler-title" title="<%:Plan Unused%>"><%:Plan Unused%>:</span><span class="dler-result2" id="dler-unused" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
<p>
<span class="dler-title" title="<%:Plan Traffic%>"><%:Plan Traffic%>:</span><span class="dler-result2" id="dler-traffic" title="<%:Collecting data...%>"><%:Collecting data...%></span>
</p>
</div>
</div>
<div class="dler-info-right">
<div class="dler-btn-container">
<input type="button" class="btn" value="<%:Checkin%>" onclick="return dler_checkin_btn(this)">
</div>
</div>
</div>
<div class="more">
<p>Powered by <a class="myip-footer" onclick="return web_dler()" href="javascript:void(0);">dlercloud.com</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</td></tr></table>
</fieldset>
<script type="text/javascript">//<![CDATA[
var dler_plan = document.getElementById('dler-plan');
var dler_plantime = document.getElementById('dler-plantime');
var dler_money = document.getElementById('dler-money');
var dler_affmoney = document.getElementById('dler-affmoney');
var dler_today_used = document.getElementById('dler-today-used');
var dler_used = document.getElementById('dler-used');
var dler_unused = document.getElementById('dler-unused');
var dler_traffic = document.getElementById('dler-traffic');
var dler_integral = document.getElementById('dler-integral');
var dler_checkin = document.getElementById('dler-checkin');
var obj = document.getElementById("additional");
var card = document.getElementById("card");
var dler_it = document.getElementById("dler_it");
var more_info = document.getElementById("more_info");
var dler_logo = document.getElementById("dler_logo");
var showmore=1;
document.addEventListener('DOMContentLoaded', function() {
DarkModeDetector.init();
obj.classList.remove('collapsed');
obj.classList.add('expanded');
});
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_info")%>', null, function(x, status) {
if (x && x.status == 200 && status.dler_info != "error") {
dler_plan.innerHTML = status.dler_info.plan;
dler_plantime.innerHTML = status.dler_info.plan_time;
dler_plantime.title = status.dler_info.plan_time;
dler_money.innerHTML = status.dler_info.money;
dler_money.title = status.dler_info.money;
dler_affmoney.innerHTML = status.dler_info.aff_money;
dler_affmoney.title = status.dler_info.aff_money;
dler_today_used.innerHTML = status.dler_info.today_used;
dler_today_used.title = status.dler_info.today_used;
dler_used.innerHTML = status.dler_info.used;
dler_used.title = status.dler_info.used;
dler_unused.innerHTML = status.dler_info.unused;
dler_unused.title = status.dler_info.unused;
dler_traffic.innerHTML = status.dler_info.traffic;
dler_traffic.title = status.dler_info.traffic;
dler_integral.innerHTML = status.dler_info.integral;
dler_integral.title = status.dler_info.integral;
show_info();
}
else {
show_less();
}
});
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_info")%>', null, function(x, status) {
if (x && x.status == 200 && status.dler_info != "error") {
dler_plan.innerHTML = status.dler_info.plan;
dler_plantime.innerHTML = status.dler_info.plan_time;
dler_plantime.title = status.dler_info.plan_time;
dler_money.innerHTML = status.dler_info.money;
dler_money.title = status.dler_info.money;
dler_affmoney.innerHTML = status.dler_info.aff_money;
dler_affmoney.title = status.dler_info.aff_money;
dler_today_used.innerHTML = status.dler_info.today_used;
dler_today_used.title = status.dler_info.today_used;
dler_used.innerHTML = status.dler_info.used;
dler_used.title = status.dler_info.used;
dler_unused.innerHTML = status.dler_info.unused;
dler_unused.title = status.dler_info.unused;
dler_traffic.innerHTML = status.dler_info.traffic;
dler_traffic.title = status.dler_info.traffic;
dler_integral.innerHTML = status.dler_info.integral;
dler_integral.title = status.dler_info.integral;
if (showmore != 0) {
show_info();
}
else {
show_less();
}
}
else {
show_less();
}
});
function dler_checkin_btn(btn)
{
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dler_checkin")%>', null, function(x, status) {
if ( x && x.status == 200 && status.dler_checkin != "error") {
if (status.dler_checkin.ret == 200) {
alert("<%:Dler Cloud Checkin Successful, Result:%>\n\n"+
status.dler_checkin.data.checkin);
}
else if (status.dler_checkin.msg) {
alert("<%:Dler Cloud Checkin Failed, Result:%>\n\n"+
status.dler_checkin.msg);
}
else {
alert("<%:Dler Cloud Checkin Failed! Please Check And Try Again...%>")
}
}
else {
alert("<%:Dler Cloud Checkin Failed! Please Check And Try Again...%>")
}
});
}
function web_dler()
{
url='https://bit.ly/32mrABp';
window.open(url);
}
function show_more()
{
if (obj.classList.contains('expanded')) {
show_info();
showmore = 1;
}
else {
if (dler_plan.innerHTML != "") {
show_less();
showmore = 0;
}
else {
web_dler();
}
}
}
function show_less()
{
if (!obj.classList.contains('expanded')) {
obj.classList.add('expanded');
obj.classList.remove('collapsed');
}
var rdmdl = Math.floor(Math.random() * 6) + 1;
if (rdmdl == 1) {
dler_it.innerHTML = '<%:Simple & trustworthy%>';
}
if (rdmdl == 2) {
dler_it.innerHTML = '<%:Cross-platform Support%>';
}
if (rdmdl == 3) {
dler_it.innerHTML = '<%:Global Acceleration Network%>';
}
if (rdmdl == 4) {
dler_it.innerHTML = '<%:Easy to Use%>';
}
if (rdmdl == 5) {
dler_it.innerHTML = '<%:Intelligent Shunting%>';
}
if (rdmdl == 6) {
dler_it.innerHTML = '<%:Perfect Technical Support%>';
}
}
function show_info()
{
if (!obj.classList.contains('collapsed')) {
obj.classList.add('collapsed');
obj.classList.remove('expanded');
}
}
function imgerrorfuns(imgobj,imgSrc)
{
setTimeout(function(){
imgobj.src=imgSrc;
},1000*10);
}
//]]></script>
</html>
@@ -0,0 +1,41 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function act_download_rule(btn,filename)
{
btn.disabled = true;
btn.value = '<%:Downloading Rule...%> ';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","download_rule")%>',
{
filename: filename
},
function(x,status)
{
if ( x && x.status == 200 ) {
if(status.rule_download_status=="0")
{
btn.value = '<%:Download Failed%>';
}
else if (status.rule_download_status=="1")
{
btn.value = '<%:Download Successful%>';
}
else if (status.rule_download_status=="2")
{
btn.value = '<%:Rule No Change%>';
}
}
else {
btn.value = '<%:Download Timeout%>';
}
}
);
btn.disabled = false;
return false;
}
//]]></script>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Click to Update%>" onclick="return act_download_rule(this,'<%=self:cfgvalue(section)%>')" />
<%+cbi/valuefooter%>
@@ -0,0 +1,13 @@
<%+cbi/valueheader%>
<div style="text-align: center; margin:2% auto; display: block; width: 100%; text-overflow: ellipsis;">
<div>
<%:Note: Please Upload File According To File Type, File Will Be Saved To The Prompt Path%>
</div>
<div style="color: green; margin-top: 1%;">
<%
local val = self:cfgvalue(section) or self.default or ""
write(pcdata(val))
%>
</div>
</div>
<%+cbi/valuefooter%>
@@ -0,0 +1,37 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function act_flush_dns_cache(btn)
{
btn.disabled = true;
btn.value = '<%:Flushing...%> ';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","flush_dns_cache")%>',
null,
function(x,status)
{
if ( x && x.status == 200 ) {
if(status.flush_status == "0" || status.flush_status != "")
{
btn.value = '<%:Flush Failed%>';
}
else
{
btn.value = '<%:Flush Successful%>';
}
}
else {
btn.value = '<%:Flush Timeout%>';
}
}
);
btn.disabled = false;
return false;
};
//]]></script>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Flush%>" onclick="return act_flush_dns_cache(this)" />
<%+cbi/valuefooter%>
@@ -0,0 +1,37 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function act_flush_smart_cache(btn)
{
btn.disabled = true;
btn.value = '<%:Flushing...%> ';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","flush_smart_cache")%>',
null,
function(x,status)
{
if ( x && x.status == 200 ) {
if(status.flush_status == "0" || status.flush_status != "")
{
btn.value = '<%:Flush Failed%>';
}
else
{
btn.value = '<%:Flush Successful%>';
}
}
else {
btn.value = '<%:Flush Timeout%>';
}
}
);
btn.disabled = false;
return false;
};
//]]></script>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Flush%>" onclick="return act_flush_smart_cache(this)" />
<%+cbi/valuefooter%>
@@ -0,0 +1,19 @@
<%+cbi/valueheader%>
<script type="text/javascript">
//<![CDATA[
function import_file_name(btn, option, file_path) {
var file_name = prompt("<%:Paste the name of the new file (including the extension) here:%>", "");
if (file_name == null || file_name == "") {
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "create_file")%>', {filename: file_name, filepath: file_path}, function(x, status) {
if (x && x.status == 200)
{
location.reload();
}
});
}
//]]>
</script>
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Create File%>" onclick="return import_file_name(this, '<%=self.option%>', '<%=self.value%>')" />
<%+cbi/valuefooter%>
@@ -0,0 +1,23 @@
<%+cbi/valueheader%>
<script type="text/javascript">
//<![CDATA[
function import_new_file_name(btn, file_path, file_name) {
var new_file_name = prompt("<%:Paste the new file name (including the extension) here:%>", "");
if (new_file_name == null || new_file_name == "") {
return false;
}
if (file_path == "/etc/openclash/config/" && new_file_name.split('.').pop() != "yaml" && new_file_name.split('.').pop() != "yml") {
alert('<%:Illegal extension!%>')
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "rename_file")%>', {new_file_name: new_file_name, file_path: file_path, file_name: file_name}, function(x, status) {
if (x && x.status == 200)
{
location.reload();
}
});
}
//]]>
</script>
<input type="button" class="btn cbi-button cbi-input-apply" value="<%:Rename%>" onclick="return import_new_file_name(this, '<%=self.option%>', '<%=self.value%>')" />
<%+cbi/valuefooter%>
@@ -0,0 +1,790 @@
<%+cbi/valueheader%>
<style type="text/css">
*{margin: 0;padding: 0;}
ul{
list-style: none;
}
#tab{
width: 100%;
height: 100%;
border: 1px solid #ddd;
box-shadow: 0 0 2px #ddd;
overflow: hidden;
}
#tab-header {
display: flex;
align-items: center;
justify-content: flex-start;
padding: 16px 20px;
border-bottom: 1px solid var(--border-light, #e2e8f0);
background: var(--bg-gray, #f1f5f9);
min-width: 0;
box-shadow: none;
position: relative;
z-index: 1;
}
#tab-header ul.cbi-tabmenu {
display: flex;
width: 100%;
background: #f1f5f9;
border-radius: 8px;
border-bottom: none !important;
border: none !important;
gap: 5px;
margin: 0;
padding: 0;
}
#tab-header ul.cbi-tabmenu li {
flex: 1 1 0;
min-width: 0;
width: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 0;
height: 40px;
font-size: 15px;
font-weight: 500;
color: #64748b;
background: transparent;
border: 1px solid #e2e8f0;
border-radius: 8px;
cursor: pointer;
transition: all 0.18s;
margin: 0;
user-select: none;
position: relative;
box-sizing: border-box;
}
#tab-header ul.cbi-tabmenu li.cbi-tab {
background: #3b82f6;
color: #fff;
font-weight: 600;
z-index: 2;
border-radius: 6px;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03);
}
#tab-header ul.cbi-tabmenu li.cbi-tab a {
color: #fff !important;
font-weight: 600;
}
#tab-header ul.cbi-tabmenu li.cbi-tab-disabled {
color: #fff;
background: #f9f9f9;
opacity: 0.7;
cursor: pointer;
}
#tab-header ul.cbi-tabmenu li.cbi-tab-disabled a {
color: #000 !important;
}
#tab-header ul.cbi-tabmenu li:not(.cbi-tab):hover,
#tab-header ul.cbi-tabmenu li:not(.cbi-tab):focus {
color: #3b82f6;
background: rgba(59,130,246,0.10);
}
#tab-header ul.cbi-tabmenu li:not(.cbi-tab):hover a,
#tab-header ul.cbi-tabmenu li:not(.cbi-tab):focus a {
color: #3b82f6 !important;
}
#tab-header ul.cbi-tabmenu li a {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
text-align: center;
text-decoration: none;
background: none;
border: none;
outline: none;
font: inherit;
color: inherit;
cursor: inherit;
padding: 0;
margin: 0;
user-select: none;
transition: color 0.18s;
}
#tab-content .dom{
display: none;
}
#tab-content .dom ul li{
float: left;
margin: 15px 10px;
width: 225px;
}
.radio-button {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
background: #f1f5f9;
border-radius: 6px;
padding: 6px 10px;
margin: 10px auto;
width: 100%;
max-width: 500px;
flex-wrap: wrap;
box-sizing: border-box;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.radio-button input[type="radio"] {
display: none;
}
.radio-button label {
display: flex;
align-items: center;
justify-content: center;
padding: 6px 18px;
font-size: 15px;
color: #64748b;
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
font-weight: 500;
min-width: 60px;
user-select: none;
}
.radio-button label:hover {
color: #3b82f6;
border-color: #3b82f6;
background: #f0f6ff;
}
.radio-button input[type="radio"]:checked + label {
background: #3b82f6;
color: #fff;
border-color: #3b82f6;
box-shadow: 0 1px 2px 0 rgba(59,130,246,0.08);
}
.btn-group {
display: flex;
justify-content: space-between;
width: 80%;
margin: 10px auto;
}
:root[data-darkmode="true"] #tab-header {
background: #374151;
border-bottom: 1px solid #374151;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu {
background: #374151;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li {
background: #1f2937;
color: #a1a1aa;
border-color: #374151;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li.cbi-tab {
background: #2563eb;
color: #fff;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li.cbi-tab a {
color: #fff !important;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li.cbi-tab-disabled {
color: #1f2937;
background: #1f2937;
opacity: 0.7;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li.cbi-tab-disabled a {
color: #fff !important;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li:not(.cbi-tab):hover,
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li:not(.cbi-tab):focus {
color: #3b82f6;
border-color: #3b82f6;
background: #22304a;
}
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li:not(.cbi-tab):hover a,
:root[data-darkmode="true"] #tab-header ul.cbi-tabmenu li:not(.cbi-tab):focus a {
color: #60a5fa !important;
}
:root[data-darkmode="true"] {
.radio-button {
background: #374151;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.15);
}
.radio-button label {
background: #1f2937;
color: #d1d5db;
border-color: #4b5563;
}
.radio-button label:hover {
color: #3b82f6;
border-color: #3b82f6;
background: #22304a;
}
.radio-button input[type="radio"]:checked + label {
background: #3b82f6;
color: #fff;
border-color: #3b82f6;
box-shadow: 0 1px 2px 0 rgba(59,130,246,0.18);
}
}
</style>
<body>
<div id="tab" class="cbi-section">
<div id="tab-header">
<ul class="cbi-tabmenu">
<li name="tab-header" class="cbi-tab"><a href="#"><%:OpenClash Log%></a></li>
<li name="tab-header" class="cbi-tab-disabled"><a href="#"><%:Core Log%></a></li>
</ul>
</div>
<div id="tab-content">
<div class="dom" style="display: block;">
<textarea id="cbid.openclash.config.clog" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
</div>
<div class="dom">
<textarea id="core_log" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
<div class="radio-button">
<input type="radio" id="info" name="radios" value="info" checked onclick="return switch_log_level(this.value)"/>
<label for="info">Info</label>
<input type="radio" id="warning" name="radios" value="warning" onclick="return switch_log_level(this.value)"/>
<label for="warning">Warning</label>
<input type="radio" id="error" name="radios" value="error" onclick="return switch_log_level(this.value)"/>
<label for="error">Error</label>
<input type="radio" id="debug" name="radios" value="debug" onclick="return switch_log_level(this.value)"/>
<label for="debug">Debug</label>
<input type="radio" id="silent" name="radios" value="silent" onclick="return switch_log_level(this.value)"/>
<label for="silent">Silent</label>
</div>
</div>
</div>
</div>
<fieldset style="text-align: center; width: 100%" class="cbi-section">
<div class="btn-group">
<input type="button" class="btn cbi-button cbi-button-apply" id="stop_refresh_button" value="<%:Stop Refresh%>" onclick=" return stop_refresh() "/>
<input type="button" class="btn cbi-button cbi-button-apply" id="start_refresh_button" value="<%:Start Refresh%>" onclick=" return start_refresh() "/>
<input type="button" class="btn cbi-button cbi-button-apply" id="del_log_button" value="<%:Clean%>" onclick=" return del_log() " />
<input type="button" class="btn cbi-button cbi-button-apply" id="down_log_button" value="<%:Download Log%>" onclick=" return download_log() " />
</div>
</fieldset>
</body>
<script type="text/javascript">//<![CDATA[
var r;
var s;
var log_len = 0;
var lv = document.getElementById('cbid.openclash.config.clog');
var cl = document.getElementById('core_log');
var animatingOC = false;
var animatingCore = false;
function get_log_level() {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "log_level")%>', null, function(x, status) {
if (x && x.status == 200 && status.log_level != "") {
var radio = document.getElementsByName("radios");
for (i=0; i<radio.length; i++) {
if (radio[i].value == status.log_level && ! radio[i].checked) {
radio[i].checked = true;
}
}
}
});
s=setTimeout("get_log_level()",5000);
};
function switch_log_level(value)
{
clearTimeout(s);
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "switch_log")%>', {log_level: value}, function(x, status) {
if (x && x.status == 200) {
alert(' <%:Log Level%>: ' + value + ' <%:switching succeeded!%>');
get_log_level();
}
else {
alert(' <%:Log Level%>: ' + value + ' <%:switching failed!%>');
get_log_level();
}
});
};
function stop_refresh() {
clearTimeout(r);
return
};
function start_refresh() {
clearTimeout(r);
r=setTimeout("poll_log()",1000*2);
return
};
function createAndDownloadFile(fileName, content) {
var aTag = document.createElement('a');
var blob = new Blob([content]);
aTag.download = fileName;
aTag.href = URL.createObjectURL(blob);
aTag.click();
URL.revokeObjectURL(blob);
};
function download_log(){
var dt = new Date();
var timestamp = dt.getFullYear()+"-"+(dt.getMonth()+1)+"-"+dt.getDate()+"-"+dt.getHours()+"-"+dt.getMinutes()+"-"+dt.getSeconds();
var oc_content = "";
if (typeof oc_editor !== 'undefined' && oc_editor) {
oc_content = oc_editor.getValue();
} else if (lv && lv.value) {
oc_content = lv.value;
} else if (lv && lv.innerHTML) {
oc_content = lv.innerHTML;
}
var core_content = "";
if (typeof core_editor !== 'undefined' && core_editor) {
core_content = core_editor.getValue();
} else if (cl && cl.value) {
core_content = cl.value;
} else if (cl && cl.innerHTML) {
core_content = cl.innerHTML;
}
oc_content = oc_content.split('\n').filter(function(line) {
return line.indexOf("】订阅的下载链接为【") === -1 && line.indexOf("】Downloading URL【") === -1;
}).join('\n');
if (!oc_content.trim() && !core_content.trim()) {
return;
}
var downloadContent = "";
if (oc_content.trim()) {
downloadContent += "<%:OpenClash Log%>:\n" + oc_content + "\n\n";
}
if (core_content.trim()) {
downloadContent += "<%:Core Log%>:\n" + core_content;
}
createAndDownloadFile("OpenClash-"+timestamp+".log", downloadContent);
return;
};
function del_log() {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "del_log")%>',null,function(x, data){
lv.innerHTML="";
cl.innerHTML="";
log_len = 0;
oc_editor.setValue(lv.value);
core_editor.setValue(cl.value);
core_editor.refresh();
oc_editor.refresh();
});
return
};
function p(s) {
return s < 10 ? '0' + s: s;
};
function line_tolocal(str) {
var trans_local = new Array();
var local_count = 0;
str.trim().split('\n').forEach(function(v, i) {
var regex = /(time=)"([^"]*)"/g;
var res = regex.exec(v);
try {
if (res) {
var dt = new Date(res[2]);
if (!isNaN(dt.getTime())) {
if (v.indexOf("level=") != -1) {
var log_info = v.substring(res[2].length + 7);
} else {
var log_info = v.substring(res[2].length + 2);
}
trans_local[local_count] = dt.getFullYear() + "-" + p(dt.getMonth() + 1) + "-" + p(dt.getDate()) + " " +
p(dt.getHours()) + ":" + p(dt.getMinutes()) + ":" + p(dt.getSeconds()) + log_info;
local_count++;
} else {
trans_local[local_count] = v;
local_count++;
}
} else {
try {
var dtt = new Date(v.substring(0, 19));
if (!isNaN(dtt.getTime()) && v.substring(0, 19).match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
trans_local[local_count] = v;
local_count++;
} else {
trans_local[local_count] = v;
local_count++;
}
} catch (e) {
trans_local[local_count] = v;
local_count++;
}
}
} catch (e) {
trans_local[local_count] = v;
local_count++;
}
});
return trans_local;
};
function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiveTab) {
var scrollPosition = null;
var isAtTop = false;
var cursorPos = null;
var selectionRange = null;
var isFirstLoad = !currentContent || currentContent.trim() === "";
if (isEditor && target) {
scrollPosition = target.getScrollInfo();
isAtTop = (scrollPosition.top < 20);
if (target.hasFocus()) {
cursorPos = target.getCursor();
if (cursorPos.line === 0) {
cursorPos = null;
selectionRange = null;
} else if (target.somethingSelected()) {
selectionRange = {
from: target.getCursor(true),
to: target.getCursor(false)
};
} else {
selectionRange = null;
}
} else {
cursorPos = null;
selectionRange = null;
}
} else if (!isEditor && target) {
scrollPosition = target.scrollTop;
isAtTop = (target.scrollTop < 20);
}
if ((target === oc_editor && animatingOC) || (target === core_editor && animatingCore) || !isActiveTab) {
var content = "";
var lines = newLines.slice().reverse();
for (var i = 0; i < lines.length; i++) {
content += lines[i] + "\n";
}
content = content + (currentContent || "");
var allLines = content.split("\n");
if (allLines.length > 2000) {
allLines = allLines.slice(0, 1999);
allLines.push("...");
content = allLines.join("\n");
}
if (isEditor) {
var addedLines = lines.length;
target.setValue(content);
if (!isAtTop && scrollPosition) {
if (cursorPos) {
cursorPos.line += addedLines;
target.setCursor(cursorPos);
target.scrollIntoView({line: cursorPos.line, ch: cursorPos.ch}, 300);
} else {
target.scrollTo(scrollPosition.left, scrollPosition.top);
}
if (selectionRange) {
selectionRange.from.line += addedLines;
selectionRange.to.line += addedLines;
target.setSelection(selectionRange.from, selectionRange.to);
target.scrollIntoView({
from: selectionRange.from,
to: selectionRange.to
}, 300);
}
} else if (isAtTop) {
target.scrollTo(0, 0);
if (isFirstLoad) {
target.setCursor({line: 0, ch: 0});
}
}
target.refresh();
} else {
var oldScrollTop = scrollPosition;
target.innerHTML = content;
if (!isAtTop && oldScrollTop) {
target.scrollTop = oldScrollTop;
}
}
return;
}
if (target === oc_editor || target === lv) {
animatingOC = true;
} else {
animatingCore = true;
}
var totalLines = newLines.length;
var batchSize, interval;
if (totalLines <= 10) {
batchSize = 2;
interval = 90;
} else if (totalLines <= 50) {
batchSize = 10;
interval = 60;
} else if (totalLines <= 200) {
batchSize = 30;
interval = 35;
} else if (totalLines <= 500) {
batchSize = 60;
interval = 25;
} else if (totalLines <= 1000) {
batchSize = 120;
interval = 15;
} else if (totalLines <= 1500) {
batchSize = 180;
interval = 10;
} else {
batchSize = 250;
interval = 5;
}
var displayedContent = currentContent || "";
var logLines = newLines.slice();
var currentBatchCount = 0;
var accumulatedContent = "";
function displayNextBatch() {
if (currentBatchCount >= logLines.length) {
if (target === oc_editor || target === lv) {
animatingOC = false;
} else {
animatingCore = false;
}
if (isEditor && !isAtTop && cursorPos) {
cursorPos.line += logLines.length;
target.setCursor(cursorPos);
if (selectionRange) {
selectionRange.from.line += logLines.length;
selectionRange.to.line += logLines.length;
target.setSelection(selectionRange.from, selectionRange.to);
target.scrollIntoView({
from: selectionRange.from,
to: selectionRange.to
}, 300);
} else {
target.scrollIntoView({line: cursorPos.line, ch: cursorPos.ch}, 300);
}
}
return;
}
var nextBatchSize = Math.min(batchSize, logLines.length - currentBatchCount);
var batchLines = logLines.slice(currentBatchCount, currentBatchCount + nextBatchSize).reverse();
currentBatchCount += nextBatchSize;
if (accumulatedContent) {
accumulatedContent = batchLines.join("\n") + "\n" + accumulatedContent;
} else {
accumulatedContent = batchLines.join("\n");
}
var content = accumulatedContent + (displayedContent ? "\n" + displayedContent : "");
var contentLines = content.split("\n");
if (contentLines.length > 2000) {
contentLines = contentLines.slice(0, 1999);
contentLines.push("...");
content = contentLines.join("\n");
}
if (isEditor) {
var currentScrollInfo = isAtTop ? null : target.getScrollInfo();
target.setValue(content);
if (!isAtTop && currentScrollInfo) {
target.scrollTo(currentScrollInfo.left, currentScrollInfo.top);
}
target.refresh();
} else {
var currentScrollTop = isAtTop ? null : target.scrollTop;
target.innerHTML = content;
if (!isAtTop && currentScrollTop !== null) {
target.scrollTop = currentScrollTop;
}
}
if (currentBatchCount < logLines.length) {
setTimeout(displayNextBatch, interval);
} else {
if (target === oc_editor || target === lv) {
animatingOC = false;
} else {
animatingCore = false;
}
if (isEditor && !isAtTop && cursorPos) {
cursorPos.line += logLines.length;
target.setCursor(cursorPos);
if (selectionRange) {
selectionRange.from.line += logLines.length;
selectionRange.to.line += logLines.length;
target.setSelection(selectionRange.from, selectionRange.to);
target.scrollIntoView({
from: selectionRange.from,
to: selectionRange.to
}, 300);
} else {
target.scrollIntoView({line: cursorPos.line, ch: cursorPos.ch}, 300);
}
}
}
}
displayNextBatch();
}
function poll_log(){
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "refresh_log")%>',
{
log_len: log_len
},
function(x, status) {
if (x && x.status == 200) {
if (status) {
if (!status.update) {
r = setTimeout("poll_log()", 2000);
return;
}
if (status.len) {
log_len = status.len;
}
var activeTabId = 0;
var titles = document.getElementsByName('tab-header');
for(var i=0; i<titles.length; i++){
if(titles[i].className === 'cbi-tab') {
activeTabId = i;
break;
}
}
if (status.oc_log && status.oc_log !== "") {
var oc_logs = line_tolocal(status.oc_log);
if (oc_logs && oc_logs.length > 0) {
if (oc_editor) {
var currentContent = oc_editor.getValue();
smoothlyDisplayLogs(oc_logs, oc_editor, true, currentContent, activeTabId === 0);
} else if (lv) {
var currentContent = lv.innerHTML;
smoothlyDisplayLogs(oc_logs, lv, false, currentContent, activeTabId === 0);
}
}
}
if (status.core_log && status.core_log !== "") {
var core_logs = line_tolocal(status.core_log);
if (core_logs && core_logs.length > 0) {
if (core_editor) {
var currentCoreContent = core_editor.getValue();
smoothlyDisplayLogs(core_logs, core_editor, true, currentCoreContent, activeTabId === 1);
} else if (cl) {
var currentCoreContent = cl.innerHTML;
smoothlyDisplayLogs(core_logs, cl, false, currentCoreContent, activeTabId === 1);
}
}
}
}
}
r = setTimeout("poll_log()", 2000);
}
);
};
window.onload = function(){
var titles = document.getElementsByName('tab-header');
var divs = document.getElementsByClassName('dom');
if(titles.length != divs.length) return;
for(var i=0; i<titles.length; i++){
var li = titles[i];
li.id = i;
function handleTabSwitch(tab) {
return function(e) {
if (tab.className === 'cbi-tab') return;
for(var j=0; j<titles.length; j++){
titles[j].className = 'cbi-tab-disabled';
divs[j].style.display = 'none';
}
tab.className = 'cbi-tab';
divs[tab.id].style.display = 'block';
if(tab.id == 0 && typeof oc_editor !== 'undefined') {
setTimeout(function(){
oc_editor.refresh();
}, 10);
} else if(tab.id == 1 && typeof core_editor !== 'undefined') {
setTimeout(function(){
core_editor.refresh();
}, 10);
}
};
}
li.onclick = handleTabSwitch(li);
li.ontouchstart = handleTabSwitch(li);
}
get_log_level();
poll_log();
};
//]]>
</script>
<%+cbi/valuefooter%>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
<%+cbi/valueheader%>
<% if self:cfgvalue(section) ~= false then %>
<input class="btn cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
<% else %>
-
<% end %>
<%+cbi/valuefooter%>
@@ -0,0 +1,88 @@
<%+cbi/valueheader%>
<%
local stream_id_name = string.gsub(self.value, "%W", "")
%>
<script type="text/javascript">//<![CDATA[
function act_manual_unlock_test_<%=stream_id_name%>(btn, type)
{
var manual_<%=stream_id_name%>_type_legend = document.getElementById('manual-<%=stream_id_name%>-test-state');
var manual_<%=stream_id_name%>_type_output = document.getElementById('manual-<%=stream_id_name%>-test-output');
var r = confirm("<%:Network instability may occur during testing, Are you sure want to start test?%>")
if (r == true) {
if (manual_<%=stream_id_name%>_type_legend && manual_<%=stream_id_name%>_type_output)
{
manual_<%=stream_id_name%>_type_output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>';
manual_<%=stream_id_name%>_type_legend.parentNode.style.display = 'block';
manual_<%=stream_id_name%>_type_legend.style.display = 'inline';
};
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "manual_stream_unlock_test")%>', {type: type}, function(x, status) {
if (x && x.status == 200 && x.responseText != "")
{
manual_<%=stream_id_name%>_type_legend.style.display = 'none';
manual_<%=stream_id_name%>_type_output.innerHTML = '<textarea id="manual_<%=stream_id_name%>_type_output" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="10" cols="50" readonly="readonly" >'+x.responseText+'</textarea>';
other_log_area(document.getElementById("manual_<%=stream_id_name%>_type_output"), 'true', manual_<%=stream_id_name%>_type_output.offsetWidth, '250px');
}
else
{
manual_<%=stream_id_name%>_type_legend.style.display = 'none';
manual_<%=stream_id_name%>_type_output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
}
}
);
};
};
function act_all_proxies_test_<%=stream_id_name%>(btn, type)
{
var all_<%=stream_id_name%>_legend = document.getElementById('all-<%=stream_id_name%>-test-state');
var all_<%=stream_id_name%>_output = document.getElementById('all-<%=stream_id_name%>-test-output');
var r = confirm("<%:Network instability may occur during testing, Are you sure want to start test?%>")
if (r == true) {
if (all_<%=stream_id_name%>_legend && all_<%=stream_id_name%>_output)
{
all_<%=stream_id_name%>_output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>';
all_<%=stream_id_name%>_legend.parentNode.style.display = 'block';
all_<%=stream_id_name%>_legend.style.display = 'inline';
};
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "all_proxies_stream_test")%>', {type: type}, function(x, status) {
if (x && x.status == 200 && x.responseText != "")
{
all_<%=stream_id_name%>_legend.style.display = 'none';
all_<%=stream_id_name%>_output.innerHTML = '<textarea id="all_<%=stream_id_name%>_output" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="10" cols="50" readonly="readonly" >'+x.responseText+'</textarea>';
other_log_area(document.getElementById("all_<%=stream_id_name%>_output"), 'true', all_<%=stream_id_name%>_output.offsetWidth, '250px');
}
else
{
all_<%=stream_id_name%>_legend.style.display = 'none';
all_<%=stream_id_name%>_output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
}
}
);
};
};
//]]></script>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Unlock Test(Select)%>" onclick="return act_manual_unlock_test_<%=stream_id_name%>(this, '<%=self.value%>')" />
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:All Proxies Test%>" onclick="return act_all_proxies_test_<%=stream_id_name%>(this, '<%=self.value%>')" />
<fieldset style="display: none;margin: 0 auto;">
<legend id="manual-<%=stream_id_name%>-test-state"><%:Collecting data...%></legend>
<br />
<span id="manual-<%=stream_id_name%>-test-output"></span>
</fieldset>
<fieldset style="display: none;margin: 0 auto;">
<legend id="all-<%=stream_id_name%>-test-state"><%:Collecting data...%></legend>
<br />
<span id="all-<%=stream_id_name%>-test-output"></span>
</fieldset>
<%+cbi/valuefooter%>
@@ -0,0 +1,894 @@
<style type="text/css">
.oc {
--bg-white: #ffffff;
--bg-light: #f8fafc;
--bg-gray: #f1f5f9;
--text-primary: #374151;
--text-secondary: #64748b;
--text-title: #4d4d4d;
--border-color: #b1b1b1;
--border-light: #e2e8f0;
--hover-bg: #f8fafc;
--primary-color: #3b82f6;
--success-color: #059669;
--success-dark: #047857;
--warning-color: #f59e0b;
--error-color: #dc2626;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--radius-sm: 6px;
--radius-md: 6px;
--radius-lg: 8px;
--transition-fast: 0.15s ease;
--transition-normal: 0.3s ease;
--control-height: 36px;
--card-padding: 6px 8px;
--gap-size: 16px;
}
.oc[data-darkmode="true"] {
--bg-white: #1f2937;
--bg-light: #374151;
--bg-gray: #4b5563;
--text-primary: #ebebeb;
--text-secondary: #d0cfcf;
--text-title: #e5e7eb;
--border-color: #939393;
--border-light: #6b7280;
--hover-bg: #374151;
--primary-color: #3b82f6;
--success-color: #34d399;
--success-dark: #10b981;
}
.oc * {
box-sizing: border-box;
}
.oc {
font-family: var(--font-family-base);
line-height: 1.6;
color: var(--text-primary);
background-color: var(--bg-light);
border-radius: var(--radius-lg);
}
.select-popup {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--bg-white);
border: 1px solid var(--border-light);
border-radius: var(--radius-lg);
padding: 24px;
z-index: 1000;
max-width: 90%;
min-width: 300px;
width: 60%;
box-shadow: var(--shadow-md);
transition: all var(--transition-normal);
}
.close-btn {
background: none;
border: 1px solid var(--border-light);
color: var(--text-secondary);
cursor: pointer;
width: 24px !important;
height: 24px !important;
min-width: 24px !important;
padding: 0 !important;
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
transition: all var(--transition-fast);
line-height: 1;
margin-left: 8px;
}
.close-btn:hover {
background: var(--hover-bg) !important;
border-color: var(--primary-color) !important;
color: var(--primary-color) !important;
transform: translateY(-1px) !important;
box-shadow: var(--shadow-sm) !important;
}
.close-btn:focus {
outline: none;
box-shadow: var(--shadow-sm) !important;
border-color: var(--primary-color) !important;
}
.close-btn svg {
width: 14px !important;
height: 14px !important;
flex-shrink: 0 !important;
}
.select-popup.hidden {
display: none;
}
.select-popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid var(--border-light);
background: var(--bg-gray);
flex-shrink: 0;
margin-bottom: 20px;
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
}
.select-config-section {
background: var(--bg-gray);
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
padding: var(--card-padding);
margin-bottom: 20px;
box-shadow: var(--shadow-sm);
}
.config-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--gap-size);
align-items: center;
}
.config-item {
display: flex;
flex-direction: column;
gap: 8px;
min-width: 0;
width: 100%;
position: relative;
}
.config-item::after {
content: '';
position: absolute;
right: 12px;
bottom: 20px;
transform: translateY(50%);
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid var(--text-secondary);
pointer-events: none;
z-index: 1;
}
.config-editor-title {
font-size: 16px;
font-weight: 600;
color: var(--text-primary);
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
text-align: center;
flex: 1;
}
.config-label {
font-size: 13px;
font-weight: 600;
color: var(--text-secondary);
text-align: center;
position: relative;
}
.config-label::after {
content: '';
position: absolute;
bottom: -4px;
left: 50%;
transform: translateX(-50%);
width: 20px;
height: 1px;
background-color: var(--border-color);
}
.select-class {
width: 100% !important;
height: var(--control-height);
padding: 8px 32px 8px 12px;
border: 1px solid var(--border-light);
border-radius: var(--radius-sm);
background: var(--bg-white);
color: var(--text-primary);
font-size: 13px;
appearance: none;
cursor: pointer;
transition: all var(--transition-fast);
box-sizing: border-box;
min-width: 0;
}
.select-class:hover {
border-color: var(--primary-color);
}
.select-class:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.help-link {
display: inline-flex;
align-items: center;
color: var(--primary-color);
text-decoration: none;
opacity: 0.7;
transition: opacity var(--transition-fast);
margin-bottom: 2px;
border-radius: var(--radius-sm);
}
.select-class option {
width: 100%;
padding: 8px 12px;
font-size: 13px;
line-height: 1.4;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
background: var(--bg-white);
color: var(--text-primary);
}
.help-link:hover {
opacity: 1;
background: rgba(59, 130, 246, 0.1);
}
.select-popup-body {
max-height: 300px;
overflow-y: auto;
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
background: var(--bg-gray);
}
.select-option {
padding: 12px 16px;
cursor: pointer;
border-bottom: 1px solid var(--border-light);
transition: all var(--transition-fast);
font-size: 14px;
color: var(--text-primary);
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
}
.select-option span {
white-space: normal;
word-break: break-all;
}
.select-option:last-child {
border-bottom: none;
}
.select-option:hover {
background-color: var(--hover-bg);
color: var(--primary-color);
}
.select-option[data-value="custom"] {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(99, 102, 241, 0.1));
border-color: rgba(59, 130, 246, 0.2);
font-weight: 500;
}
.select-option[data-value="custom"]:hover {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
}
.custom-option-input {
margin: 12px auto;
padding: 12px;
width: calc(100% - 24px) !important;
border: 1px solid var(--border-light);
border-radius: var(--radius-sm);
background: var(--bg-white);
color: var(--text-primary);
font-size: 14px;
transition: all var(--transition-fast);
}
.custom-option-input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.custom-option-input::placeholder {
color: var(--text-secondary);
opacity: 0.7;
}
#addCustomOption {
background: var(--primary-color);
color: white;
font-weight: 500;
border-bottom: none !important;
margin: 0 12px 12px 12px;
border-radius: var(--radius-sm);
text-align: center;
}
#addCustomOption:hover {
background: #2563eb;
color: white;
}
.cdn-status {
font-size: 12px;
font-weight: 500;
padding: 4px 8px;
border-radius: var(--radius-sm);
margin-left: 8px;
white-space: nowrap !important;
}
.cdn-status.fast {
background: rgba(5, 150, 105, 0.1);
color: var(--success-color);
}
.cdn-status.medium {
background: rgba(245, 158, 11, 0.1);
color: var(--warning-color);
}
.cdn-status.slow {
background: rgba(220, 38, 38, 0.1);
color: var(--error-color);
}
.cdn-status.error {
background: rgba(220, 38, 38, 0.1);
color: var(--error-color);
}
@media screen and (max-width: 1200px) {
.config-grid {
grid-template-columns: 1fr;
gap: 12px;
}
.config-item {
width: 100%;
max-width: 100%;
}
.select-class {
max-width: 100%;
font-size: 13px;
}
}
@media screen and (max-width: 768px) {
.select-popup {
min-width: 80%;
width: 80%;
padding: 15px;
max-height: 90vh;
overflow-y: auto;
}
.config-grid {
grid-template-columns: 1fr;
gap: 12px;
}
.config-item {
text-align: center;
}
.select-popup-header {
font-size: 16px;
margin-bottom: 16px;
padding-bottom: 12px;
}
.select-config-section {
padding: 12px;
margin-bottom: 16px;
}
.select-popup-body {
max-height: 200px;
}
.select-option {
padding: 10px 12px;
font-size: 13px;
align-items: flex-start;
gap: 4px;
}
.custom-option-input {
font-size: 13px;
padding: 10px;
}
}
@media screen and (max-width: 575px) {
.select-popup {
min-width: 80%;
width: 80%;
padding: 12px;
}
.select-popup-header {
font-size: 15px;
margin-bottom: 12px;
}
.select-config-section {
padding: 10px;
}
.config-label {
font-size: 12px;
}
.select-class {
font-size: 12px;
padding: 6px 28px 6px 10px;
}
.config-item::after {
right: 10px;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid var(--text-secondary);
}
.select-option {
padding: 8px 10px;
font-size: 12px;
}
}
.oc[data-darkmode="true"] .select-popup {
background-color: var(--bg-white);
border-color: var(--border-light);
}
.oc[data-darkmode="true"] .select-option:hover {
background-color: var(--hover-bg);
color: var(--primary-color);
}
.oc[data-darkmode="true"] .select-class {
background: var(--bg-white) !important;
border-color: var(--border-light) !important;
color: var(--text-primary) !important;
}
.oc[data-darkmode="true"] .select-class:hover {
border-color: var(--primary-color);
}
.oc[data-darkmode="true"] .select-class:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.oc[data-darkmode="true"] .select-class option {
background: var(--bg-white) !important;
color: var(--text-primary) !important;
}
.oc[data-darkmode="true"] .config-item::after {
border-top-color: var(--text-secondary);
}
.oc[data-darkmode="true"] .custom-option-input {
background: var(--bg-white);
border-color: var(--border-light);
color: var(--text-primary);
}
.oc[data-darkmode="true"] .custom-option-input::placeholder {
color: var(--text-secondary);
}
.oc[data-darkmode="true"] .select-config-section {
background: var(--bg-gray);
border-color: var(--border-light);
}
.oc[data-darkmode="true"] .select-popup-body {
background: var(--bg-gray);
border-color: var(--border-light);
}
.oc[data-darkmode="true"] #addCustomOption {
background: var(--primary-color);
}
.oc[data-darkmode="true"] #addCustomOption:hover {
background: #2563eb;
}
.oc[data-darkmode="true"] .close-btn {
color: var(--text-secondary);
}
.oc[data-darkmode="true"] .close-btn:hover {
background-color: var(--hover-bg);
color: var(--error-color);
}
</style>
<body>
<div id="selectPopup" class="oc select-popup hidden">
<div class="select-popup-header">
<div class="config-editor-title">
<%:Check Update%>
</div>
<div class="config-editor-actions">
<button type="button" class="icon-btn close-btn" onclick="closeSelectPopup()" title="<%:Close%>">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
</div>
<div class="select-config-section">
<div class="config-grid">
<div class="config-item">
<div class="config-label"><%:Compiled Version%></div>
<select class="select-class" id="CORE_VERSION_CDN">
<option value="linux-386"><%:linux-386%></option>
<option value="linux-amd64-v1"><%:linux-amd64-v1(x86-64)%></option>
<option value="linux-amd64-v2"><%:linux-amd64-v2(x86-64)%></option>
<option value="linux-amd64-v3"><%:linux-amd64-v3(x86-64)%></option>
<option value="linux-armv5"><%:linux-armv5%></option>
<option value="linux-armv6"><%:linux-armv6%></option>
<option value="linux-armv7"><%:linux-armv7%></option>
<option value="linux-arm64"><%:linux-arm64(armv8)%></option>
<option value="linux-loong64-abi1"><%:linux-loong64-abi1%></option>
<option value="linux-loong64-abi2"><%:linux-loong64-abi2%></option>
<option value="linux-riscv64"><%:linux-riscv64%></option>
<option value="linux-s390x"><%:linux-s390x%></option>
<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>
<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>
<option value="linux-mips64"><%:linux-mips64%></option>
<option value="linux-mips64le"><%:linux-mips64le%></option>
<option value="linux-mipsle-softfloat"><%:linux-mipsle-softfloat%></option>
<option value="linux-mipsle-hardfloat"><%:linux-mipsle-hardfloat%></option>
<option value="0"><%:Not Set%></option>
</select>
</div>
<div class="config-item">
<div class="config-label"><%:Release Branch%></div>
<select class="select-class" id="RELEASE_BRANCH_CDN">
<option value="master">Master</option>
<option value="dev">Developer</option>
</select>
</div>
<div class="config-item">
<div class="config-label">
<%:Smart Core%>
<a href="javascript:void(0);" onclick="window.open('https://github.com/vernesong/mihomo/releases', '_blank');" class="help-link" title="<%:View core infos that support smart group%>">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"></circle>
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path>
<line x1="12" y1="17" x2="12.01" y2="17"></line>
</svg>
</a>
</div>
<select class="select-class" id="SMART_ENABLE_CDN">
<option value="0"><%:Disabled%></option>
<option value="1"><%:Enable%></option>
</select>
</div>
</div>
</div>
<div class="select-popup-body">
<div class="select-option" data-value="https://raw.githubusercontent.com/">
<span>https://raw.githubusercontent.com/ (<%:RAW address%>)</span>
</div>
<div class="select-option" data-value="https://fastly.jsdelivr.net/">
<span>https://fastly.jsdelivr.net/</span>
</div>
<div class="select-option" data-value="https://testingcf.jsdelivr.net/">
<span>https://testingcf.jsdelivr.net/</span>
</div>
<div class="select-option" data-value="https://cdn.jsdelivr.net/">
<span>https://cdn.jsdelivr.net/</span>
</div>
<div class="select-option" data-value="custom">
<span><%:Custom Your CDN URL%></span>
<span style="display: flex; align-items: center; height: 100%;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" stroke="none" style="display: block;">
<polygon points="6,9 18,9 12,15"/>
</svg>
</span>
</div>
<input type="text" id="customOptionInput" class="custom-option-input" value="https://ghfast.top/" placeholder="<%:Type CDN URL, Format Like%> https://ghfast.top/" style="display: none;">
<div class="select-option" id="addCustomOption" style="display: none;"><%:Add%></div>
</div>
</div>
</body>
<script type="text/javascript">
//<![CDATA[
var core_version_cdn = document.getElementById('CORE_VERSION_CDN');
var release_branch_cdn = document.getElementById('RELEASE_BRANCH_CDN');
var smart_enable_cdn = document.getElementById('SMART_ENABLE_CDN');
function initDarkMode() {
var ocContainer = document.querySelector('.oc');
if (!ocContainer) return;
var shouldUseDark = isDarkBackground(document.body);
if (shouldUseDark) {
ocContainer.setAttribute('data-darkmode', 'true');
} else {
ocContainer.removeAttribute('data-darkmode');
}
}
document.addEventListener('DOMContentLoaded', function() {
initDarkMode();
});
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initDarkMode);
} else {
initDarkMode();
}
function get_update_info() {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_info")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.corever && status.corever != "0" && status.corever != "" ) {
core_version_cdn.value = status.corever;
}
else {
core_version_cdn.value = "0";
}
if ( status.release_branch && status.release_branch != "" ) {
release_branch_cdn.value = status.release_branch;
}
else {
release_branch_cdn.value = "master";
}
if ( status.smart_enable && status.smart_enable != "" ) {
smart_enable_cdn.value = status.smart_enable;
}
else {
smart_enable_cdn.value = "0";
}
}
else {
core_version_cdn.value = "0";
release_branch_cdn.value = "master";
smart_enable_cdn.value = "0";
}
});
}
function isValidURL(str) {
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.&#126;+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.&#126;+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?'+'\/$','i'); // fragment locator
return !!pattern.test(str);
}
function HTTP_delay(domain, ID) {
var xhr = new XMLHttpRequest();
xhr.open('GET', '/cgi-bin/luci/admin/services/openclash/website_check?domain=' + encodeURIComponent(domain), true);
xhr.timeout = 5000;
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
let status, text, response_time = 0;
if (xhr.status === 200) {
try {
var resp = JSON.parse(xhr.responseText);
response_time = resp.response_time || 0;
if (resp.success) {
if (response_time <= 500) {
status = 'fast';
text = response_time + ' ms';
} else if (response_time > 500 && response_time <= 1000) {
status = 'medium';
text = response_time + ' ms';
} else {
status = 'slow';
text = response_time + ' ms';
}
} else {
status = 'error';
text = resp.error || '<%:Access Denied%>';
}
} catch (e) {
status = 'error';
text = '<%:Access Denied%>';
}
} else {
status = 'error';
text = '<%:Access Timed Out%>';
}
updateCDNStatus(ID, status, text);
}
};
xhr.ontimeout = function() {
updateCDNStatus(ID, 'error', '<%:Access Timed Out%>');
};
xhr.onerror = function() {
updateCDNStatus(ID, 'error', '<%:Access Denied%>');
};
xhr.send();
}
function updateCDNStatus(element, status, text) {
var existingStatus = element.querySelector('.cdn-status');
if (existingStatus) {
existingStatus.remove();
}
var statusSpan = document.createElement('span');
statusSpan.className = 'cdn-status ' + status;
statusSpan.textContent = text;
element.appendChild(statusSpan);
}
function select_git_cdn(btn, type) {
var selectPopup = document.getElementById('selectPopup');
get_update_info();
selectPopup.classList.remove('hidden');
var customOptionInput = document.getElementById('customOptionInput');
var addCustomOption = document.getElementById('addCustomOption');
var selectOptions = document.getElementsByClassName('select-option');
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
selectPopup.addEventListener('click', function(event) {
select_window(event, type);
});
document.addEventListener('click', select_window_close);
refresh_httpdelay = setInterval(() => {
for(var i = 0; i < selectOptions.length; i++) {
if (isValidURL(selectOptions[i].dataset.value)) {
HTTP_delay(selectOptions[i].dataset.value, selectOptions[i]);
}
}
}, Math.floor(Math.random()*(7-3+1)+3)*1000);
}
function select_window_close(event) {
var selectPopup = document.getElementById('selectPopup');
if (!selectPopup.contains(event.target)) {
selectPopup.classList.add('hidden');
if (typeof refresh_httpdelay !== 'undefined') {
clearInterval(refresh_httpdelay);
}
}
}
function select_window(event, type) {
var v = core_version_cdn.value;
var r = release_branch_cdn.value;
var s = smart_enable_cdn.value;
var selectOptions = document.getElementsByClassName('select-option');
var target = event.target;
var selectPopup = document.getElementById('selectPopup');
var customOptionInput = document.getElementById('customOptionInput');
var addCustomOption = document.getElementById('addCustomOption');
var optionElem = target.closest ? target.closest('.select-option') : null;
if (optionElem && optionElem.dataset.value === 'custom' && customOptionInput.style.display === 'block') {
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
} else if (optionElem && optionElem.dataset.value === 'custom') {
customOptionInput.style.display = 'block';
addCustomOption.style.display = 'block';
customOptionInput.focus();
} else if (target === customOptionInput) {
customOptionInput.style.display = 'block';
addCustomOption.style.display = 'block';
customOptionInput.focus();
} else if (target === addCustomOption) {
var newValue = customOptionInput.value.trim();
if (newValue !== '' && isValidURL(newValue)) {
var newOption = document.createElement('div');
newOption.classList.add('select-option');
newOption.innerHTML = '<span>' + newValue + '</span>';
newOption.dataset.value = newValue;
selectPopup.querySelector('.select-popup-body').insertBefore(newOption, selectPopup.querySelector('.select-popup-body').children[selectOptions.length - 2]);
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
}
else {
alert("<%:Please enter a valid URL!%>");
}
} else if (optionElem && optionElem != addCustomOption && optionElem != customOptionInput) {
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
if (typeof LogManager !== 'undefined' && LogManager) {
LogManager.startLogDisplay('<%:Checking...%>');
}
if (optionElem.dataset.value === 'https://raw.githubusercontent.com/') {
optionElem.dataset.value = '';
}
if (type === 'core_download') {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', {url: optionElem.dataset.value}, function(x, status) {
});
}
});
}
else {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', {url: optionElem.dataset.value}, function(x, status) {
});
}
});
}
selectPopup.classList.add('hidden');
if (typeof refresh_httpdelay !== 'undefined') {
clearInterval(refresh_httpdelay);
}
}
else if (target != addCustomOption && target != customOptionInput) {
customOptionInput.style.display = 'none';
addCustomOption.style.display = 'none';
}
else {
if (target != customOptionInput) {
selectPopup.classList.add('hidden');
if (typeof refresh_httpdelay !== 'undefined') {
clearInterval(refresh_httpdelay);
}
}
}
}
function closeSelectPopup() {
var selectPopup = document.getElementById('selectPopup');
selectPopup.classList.add('hidden');
if (typeof refresh_httpdelay !== 'undefined') {
clearInterval(refresh_httpdelay);
}
}
//]]>
</script>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,686 @@
<%+cbi/valueheader%>
<style>
.sub_div {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
width: calc(100% - 24px);
box-sizing: border-box;
min-width: 280px;
max-width: 350px;
margin: 0 auto;
}
.sub_div > span:first-child {
flex: 1;
min-width: 0;
}
.sub_tab {
display: block;
white-space: nowrap;
font-size: 12px;
margin: 0;
opacity: 0;
width: 100%;
max-width: 100%;
overflow: hidden;
box-sizing: border-box;
}
.sub_tab_show {
display: block;
white-space: nowrap;
font-size: 12px;
margin: 0;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-ms-transition: all 1s;
-o-transition: all 1s;
transition: all 1s;
opacity: 1;
width: 100%;
max-width: 100%;
overflow: hidden;
box-sizing: border-box;
}
.sub_setting {
display: inline-block;
white-space: nowrap;
margin: 0;
opacity: 1;
vertical-align: middle;
line-height: 0;
flex-shrink: 0;
cursor: pointer;
}
.sub_setting img {
vertical-align: middle;
display: inline-block;
transition: opacity 0.3s ease;
}
.sub_setting:hover img {
opacity: 0.7;
}
.text_show {
color: #333333;
line-height: 1.2;
}
.progress_bar_bg {
border: 1px solid #999999;
background-color: #f5f5f5;
width: 100% !important;
max-width: 100% !important;
min-width: 220px;
box-sizing: border-box;
border-radius: 6px;
height: 36px;
}
.progress_bar_high {
background-color: #9edd9e;
}
.progress_bar_medium {
background-color: #ffc99f;
}
.progress_bar_low {
background-color: #ffb9b9;
}
:root[data-darkmode="true"] #icon_wrench {
-webkit-filter: invert(1);
filter: invert(1);
}
:root[data-darkmode="true"] #icon_arrow {
-webkit-filter: invert(1);
filter: invert(1);
}
:root[data-darkmode="true"] .text_show {
color: #e0e0e0;
line-height: 1.2;
}
:root[data-darkmode="true"] .progress_bar_bg {
border: 1px solid #666666;
background-color: #333333;
}
:root[data-darkmode="true"] .progress_bar_high {
background-color: #5da05d;
}
:root[data-darkmode="true"] .progress_bar_medium {
background-color: #cc8550;
}
:root[data-darkmode="true"] .progress_bar_low {
background-color: #cc6262;
}
@media (max-width: 1024px) {
.sub_tab, .sub_tab_show {
font-size: 11px;
}
.progress_bar_bg {
min-width: 220px;
}
.sub_div {
gap: 6px;
width: calc(100% - 20px);
margin: 0 10px;
}
}
@media (max-width: 768px) {
.sub_tab, .sub_tab_show {
font-size: 10px;
}
.progress_bar_bg {
min-width: 200px;
}
.sub_setting img {
height: 18px !important;
}
.sub_div {
gap: 4px;
width: calc(100% - 16px);
margin: 0 8px;
}
}
@media (max-width: 480px) {
.sub_tab, .sub_tab_show {
font-size: 9px;
}
.progress_bar_bg {
min-width: 180px !important;
}
.sub_setting img {
height: 16px !important;
}
.sub_div {
gap: 2px;
width: calc(100% - 12px);
margin: 0 6px;
}
}
@media (max-width: 320px) {
.sub_tab, .sub_tab_show {
font-size: 8px;
}
.progress_bar_bg {
min-width: 160px !important;
}
.sub_setting img {
height: 14px !important;
}
.sub_div {
width: calc(100% - 8px);
margin: 0 4px;
}
}
.sub_div * {
flex-shrink: 0;
}
.sub_div > span:first-child {
flex-shrink: 1;
}
/* Multiple providers container */
.sub_providers_container {
display: flex;
gap: 4px;
flex: 1;
min-width: 0;
overflow-x: auto;
scrollbar-width: thin;
cursor: grab;
user-select: none;
}
.sub_providers_container.no-scroll {
overflow-x: hidden;
cursor: default;
}
.sub_providers_container::-webkit-scrollbar {
height: 4px;
}
.sub_providers_container::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 2px;
}
.sub_providers_container::-webkit-scrollbar-thumb {
background: #888;
border-radius: 2px;
}
.sub_providers_container::-webkit-scrollbar-thumb:hover {
background: #555;
}
.sub_providers_container.dragging {
cursor: grabbing;
}
.sub_provider_item {
flex: 0 0 auto;
width: 100px;
position: relative;
min-height: 36px;
background-color: #f5f5f5;
border: 1px solid #999999;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.sub_provider_fill {
position: absolute;
left: 0;
top: 0;
bottom: 0;
transition: width 0.3s ease;
border-radius: 5px;
}
.sub_provider_fill.progress_bar_high {
background-color: #9edd9e;
}
.sub_provider_fill.progress_bar_medium {
background-color: #ffc99f;
}
.sub_provider_fill.progress_bar_low {
background-color: #ffb9b9;
}
.sub_provider_name {
position: relative;
z-index: 1;
font-size: 12px;
color: #333;
font-weight: 500;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
padding: 0 4px;
}
/* Dark mode support */
:root[data-darkmode="true"] .sub_provider_item {
background-color: #333333;
border-color: #666666;
}
:root[data-darkmode="true"] .sub_provider_fill.progress_bar_high {
background-color: #5da05d;
}
:root[data-darkmode="true"] .sub_provider_fill.progress_bar_medium {
background-color: #cc8550;
}
:root[data-darkmode="true"] .sub_provider_fill.progress_bar_low {
background-color: #cc6262;
}
:root[data-darkmode="true"] .sub_provider_name {
color: #e0e0e0;
}
/* Responsive adjustments for multiple providers */
@media (max-width: 1024px) {
.sub_providers_container {
gap: 3px;
}
.sub_provider_item {
width: 90px;
}
.sub_provider_name {
font-size: 11px;
}
}
@media (max-width: 768px) {
.sub_providers_container {
gap: 2px;
}
.sub_provider_item {
width: 80px;
min-height: 32px;
}
.sub_provider_name {
font-size: 10px;
}
}
@media (max-width: 480px) {
.sub_provider_item {
width: 70px;
min-height: 30px;
padding: 0 2px;
}
.sub_provider_name {
font-size: 9px;
}
}
@media (max-width: 320px) {
.sub_provider_item {
width: 60px;
min-height: 28px;
}
.sub_provider_name {
font-size: 8px;
}
}
</style>
<%
local fs = require "luci.openclash"
local val = self:cfgvalue(section)
local filename = fs.filename(val)
local idname = math.random(1000)..(string.match(filename, "[%w_]+") or "")
%>
<div class="sub_div">
<span id='<%=idname%>' class="sub_tab"></span>
<span class="sub_setting">
<img id="icon_arrow" src='/luci-static/resources/openclash/img/arrow-clockwise-light.svg' height="20px" title='<%:Refresh%>' alt='<%:Refresh%>' onclick='return sub_info_refresh_<%=idname%>(this)'>
</span>
<span class="sub_setting">
<img id="icon_wrench" src='/luci-static/resources/openclash/img/wrench-light.svg' height="20px" title='<%:Specify URL%>' alt='<%:Specify URL%>' onclick='return set_subinfo_url_<%=idname%>(this,"<%=filename%>")'>
</span>
</div>
<script type="text/javascript">//<![CDATA[
var retry_<%=idname%> = 0;
var s_<%=idname%>;
sub_info_get_<%=idname%>();
setTimeout(function(){
if (isDarkBackground(document.body)) {
document.documentElement.setAttribute('data-darkmode', 'true');
};
}, 300);
function progressbar_<%=idname%>(v, m, pc, np, f, t, tr) {
var screenWidth = window.innerWidth || document.documentElement.clientWidth;
var fontSize = '12px';
var minWidth = '220px';
var topPosition = tr == "null" ? '6px' : '2px';
if (screenWidth <= 320) {
fontSize = '8px';
minWidth = '160px';
topPosition = tr == "null" ? '8px' : '4px';
} else if (screenWidth <= 480) {
fontSize = '9px';
minWidth = '180px';
topPosition = tr == "null" ? '7px' : '3px';
} else if (screenWidth <= 768) {
fontSize = '10px';
minWidth = '200px';
topPosition = tr == "null" ? '6px' : '3px';
} else if (screenWidth <= 1024) {
fontSize = '11px';
minWidth = '220px';
topPosition = tr == "null" ? '6px' : '2px';
}
// Build title for native tooltip (format: "v / m (pc%)\nt (Remaining tr days)")
var titleText = v + ' / ' + m + ' (' + pc + '%%)';
if (t && t !== 'null' && tr && tr !== 'null' && parseInt(tr) > 0) {
titleText += '\n' + t + ' (<%:Remaining%> ' + tr + ' <%:days%>)';
}
return String.format(
'<div class="progress_bar_bg" title="' + titleText + '" style="position:relative; border-radius: 6px; min-width: %s; display: flex; align-items: center;">' +
(pc >= 50 ? '<div class="progress_bar_high" style="width:%d%%; height:34px; border-radius: 6px">' :
(pc < 50 && pc >= 20 ? '<div class="progress_bar_medium" style="width:%d%%; height:34px; border-radius: 6px">' :
'<div class="progress_bar_low" style="width:%d%%; height:34px; border-radius: 6px">')) +
'<div style="position:absolute; left:0; top:50%%; transform: translateY(-50%%); text-align:center; width:100%%; padding:0 4px; box-sizing:border-box; line-height:1.2;">' +
'<small class="text_show" style="font-size:%s; line-height:1.2;">%s '+ (f ? f : '/') +' %s ' + (np ? "" : '(%s%%)') +
(tr == "null" ? '<div style="visibility: hidden; line-height:1.2;">' : '<div style="visibility: visible; line-height:1.2;">') +
'%s (<%:Remaining%> %s <%:days%>)</small>' +
'</div>' +
'</div>' +
'</div>',
minWidth, pc, fontSize, v, m, pc, t, tr
);
};
function progressbar_multi_<%=idname%>(providers) {
if (!providers || !Array.isArray(providers) || providers.length === 0) {
return '<span>No Providers</span>';
}
var providerCount = providers.length;
var itemWidth;
var containerClass = 'sub_providers_container';
if (providerCount === 2) {
itemWidth = 'calc(50% - 2px)';
containerClass += ' no-scroll';
} else if (providerCount === 3) {
itemWidth = 'calc(33.33% - 2.67px)';
containerClass += ' no-scroll';
} else {
itemWidth = '100px';
}
var container = '<div class="' + containerClass + '" id="sub_providers_<%=idname%>">';
providers.forEach(function(provider) {
var percent = parseFloat(provider.percent) || 0;
var providerName = provider.provider_name || 'Unknown';
var used = provider.used || '0 B';
var total = provider.total || 'N/A';
var surplus = provider.surplus || used;
var expire = provider.expire || 'null';
var dayLeft = parseInt(provider.day_left) || 0;
// Determine background color based on percentage
var bgColorClass = percent >= 50 ? 'progress_bar_high' :
(percent >= 20 ? 'progress_bar_medium' : 'progress_bar_low');
// Build title for native tooltip (format: "surplus / total (percent%)\nexpire (Remaining dayLeft days)")
var titleText = surplus + ' / ' + total + ' (' + percent + '%)';
if (expire !== 'null' && dayLeft > 0) {
titleText += '\n' + expire + ' (<%:Remaining%> ' + dayLeft + ' <%:days%>)';
}
container += '<div class="sub_provider_item" style="width: ' + itemWidth + '" title="' + titleText + '">' +
'<div class="sub_provider_fill ' + bgColorClass + '" style="width: ' + percent + '%"></div>' +
'<span class="sub_provider_name">' + providerName + '</span>' +
'</div>';
});
container += '</div>';
if (providerCount > 3) {
setTimeout(function() {
initDragScroll_<%=idname%>();
}, 100);
}
return container;
}
function initDragScroll_<%=idname%>() {
var container = document.getElementById('sub_providers_<%=idname%>');
if (!container) return;
var isDragging = false;
var startX;
var scrollLeft;
var hasMoved = false;
container.addEventListener('mousedown', function(e) {
if (e.target.tagName === 'A' || e.target.tagName === 'BUTTON') {
return;
}
isDragging = true;
hasMoved = false;
startX = e.pageX - container.offsetLeft;
scrollLeft = container.scrollLeft;
container.classList.add('dragging');
});
container.addEventListener('mousemove', function(e) {
if (!isDragging) return;
var x = e.pageX - container.offsetLeft;
var walk = (x - startX) * 2;
if (Math.abs(walk) > 5) {
hasMoved = true;
e.preventDefault();
container.scrollLeft = scrollLeft - walk;
}
});
container.addEventListener('mouseup', function() {
isDragging = false;
container.classList.remove('dragging');
});
container.addEventListener('mouseleave', function() {
isDragging = false;
container.classList.remove('dragging');
});
container.addEventListener('dragstart', function(e) {
e.preventDefault();
});
}
function sub_info_refresh_<%=idname%>()
{
if (s_<%=idname%>) { clearTimeout(s_<%=idname%>);};
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "sub_info_get")%>', {filename: "<%=filename%>"}, function(x, status) {
if (x && x.status == 200 && status.sub_info != "" && status.sub_info != "No Sub Info Found") {
retry_<%=idname%> = 0;
localStorage.setItem("sub_info_<%=filename%>",JSON.stringify(status));
document.getElementById('<%=idname%>').className = "sub_tab_show";
if (status.providers && Array.isArray(status.providers) && status.providers.length > 0) {
if (status.providers.length === 1) {
var provider = status.providers[0];
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>(
(provider.surplus ? provider.surplus : provider.used),
(provider.total),
(provider.percent),
false, false,
(provider.expire),
(provider.day_left)
);
} else {
document.getElementById('<%=idname%>').innerHTML = progressbar_multi_<%=idname%>(status.providers);
}
} else {
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>(
(status.surplus ? status.surplus : status.used),
(status.total),
(status.percent),
false, false,
(status.expire),
(status.day_left)
);
}
}
else if ( x && x.status == 200 && status.sub_info == "No Sub Info Found" ) {
retry_<%=idname%> = 0;
localStorage.setItem("sub_info_<%=filename%>",JSON.stringify(status));
document.getElementById('<%=idname%>').className = "sub_tab_show";
document.getElementById('<%=idname%>').innerHTML = "<span><%:No Sub Info Found%></span>";
}
else {
if (document.getElementById('<%=idname%>').innerHTML == "" || retry_<%=idname%> > 2) {
document.getElementById('<%=idname%>').className = "sub_tab_show";
document.getElementById('<%=idname%>').innerHTML = "<span style=color:red><%:Sub Info Get Error%></span>";
}
if (retry_<%=idname%> > 2) {
retry_<%=idname%> = 0;
localStorage.removeItem("sub_info_<%=filename%>");
}
else {
retry_<%=idname%> ++;
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>()",1000*120);
return
}
};
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>()",1000*1800);
});
};
function sub_info_get_<%=idname%>()
{
if (localStorage.getItem("sub_info_<%=filename%>")) {
var save_info = JSON.parse(localStorage.getItem("sub_info_<%=filename%>"));
document.getElementById('<%=idname%>').className = "sub_tab_show";
if (save_info.sub_info == "No Sub Info Found") {
document.getElementById('<%=idname%>').innerHTML = "<span><%:No Sub Info Found%></span>";
}
else {
if (save_info.providers && Array.isArray(save_info.providers) && save_info.providers.length > 0) {
if (save_info.providers.length === 1) {
var provider = save_info.providers[0];
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>(
(provider.surplus ? provider.surplus : provider.used),
(provider.total),
(provider.percent ? provider.percent : 0),
false, false,
(provider.expire),
(provider.day_left ? provider.day_left : 0)
);
} else {
document.getElementById('<%=idname%>').innerHTML = progressbar_multi_<%=idname%>(save_info.providers);
}
} else {
document.getElementById('<%=idname%>').innerHTML = progressbar_<%=idname%>(
(save_info.surplus ? save_info.surplus : save_info.used),
(save_info.total),
(save_info.percent ? save_info.percent : 0),
false, false,
(save_info.expire),
(save_info.day_left ? save_info.day_left : 0)
);
}
}
}
else {
sub_info_refresh_<%=idname%>();
};
s_<%=idname%> = setTimeout("sub_info_refresh_<%=idname%>()",1000*30);
};
function set_subinfo_url_<%=idname%>(btn, filename) {
var new_url = prompt("<%:Paste the new url of subscribe infos sources here:%>", "");
if (filename == null || filename == "") {
return false;
}
if (new_url == null) {
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "set_subinfo_url")%>', {filename: filename, url: new_url}, function(x, status) {
if (x && x.status == 200 && status.info == "Success")
{
sub_info_refresh_<%=idname%>();
alert("<%:Specify subscribe infos sources url successfully!%>");
}
else if (x && x.status == 200 && status.info == "Delete success")
{
sub_info_refresh_<%=idname%>();
alert("<%:Delete Specify Subscribe infos sources url successfully!%>");
}
else
{
alert("<%:Specify subscribe infos sources url failed:%>\n" + status.info);
}
});
};
//]]></script>
<%+cbi/valuefooter%>
@@ -0,0 +1,148 @@
<%+cbi/valueheader%>
<div class="cbi-value-field" id="switch_dashboard_<%=self.option%>">
<%:Collecting data...%>
</div>
<div class="cbi-value-field" id="delete_dashboard_<%=self.option%>">
<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Delete%>" onclick="return delete_dashboard(this, '<%=self.option%>')"/>
</div>
<div class="cbi-value-field" id="default_dashboard_<%=self.option%>">
<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Set to Default%>" onclick="return default_dashboard(this, '<%=self.option%>')"/>
</div>
<script type="text/javascript">//<![CDATA[
var btn_type_<%=self.option%> = "<%=self.option%>";
var switch_dashboard_<%=self.option%> = document.getElementById('switch_dashboard_<%=self.option%>');
var default_dashboard_<%=self.option%> = document.getElementById('default_dashboard_<%=self.option%>');
var delete_dashboard_<%=self.option%> = document.getElementById('delete_dashboard_<%=self.option%>');
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "dashboard_type")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
if ( btn_type_<%=self.option%> == "Dashboard" ) {
if ( status.dashboard_type == "Meta" ) {
switch_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch To Official Version%>" onclick="return switch_dashboard(this, btn_type_<%=self.option%>, \'Official\')"/>';
}
else {
switch_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch To Meta Version%>" onclick="return switch_dashboard(this, btn_type_<%=self.option%>, \'Meta\')"/>';
}
}
if ( btn_type_<%=self.option%> == "Yacd" ) {
if ( status.yacd_type == "Meta" ) {
switch_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch To Official Version%>" onclick="return switch_dashboard(this, btn_type_<%=self.option%>, \'Official\')"/>';
}
else {
switch_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch To Meta Version%>" onclick="return switch_dashboard(this, btn_type_<%=self.option%>, \'Meta\')"/>';
}
}
if ( btn_type_<%=self.option%> == "Metacubexd" ) {
switch_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Update Metacubexd Version%>" onclick="return switch_dashboard(this, btn_type_<%=self.option%>, \'Official\')"/>';
}
if ( btn_type_<%=self.option%> == "Zashboard" ) {
switch_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Update Zashboard Version%>" onclick="return switch_dashboard(this, btn_type_<%=self.option%>, \'Official\')"/>';
}
if ( status.default_dashboard == btn_type_<%=self.option%>.toLowerCase() ) {
default_dashboard_<%=self.option%>.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Default%>" disabled="disabled" onclick="return default_dashboard(this, btn_type_<%=self.option%>)"/>';
}
if ( !status[btn_type_<%=self.option%>.toLowerCase()] ) {
default_dashboard_<%=self.option%>.firstElementChild.disabled = true;
delete_dashboard_<%=self.option%>.firstElementChild.disabled = true;
}
}
});
function switch_dashboard(btn, name, type)
{
btn.disabled = true;
btn.value = '<%:Downloading File...%>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "switch_dashboard")%>', {name: name, type : type}, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.download_state == "1" ) {
if ( type == "Meta" ) {
if ( name == "Dashboard" ) {
document.getElementById("switch_dashboard_"+name).innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch Successful%> - <%:Switch To Official Version%>" onclick="return switch_dashboard(this, \'Dashboard\', \'Official\')"/>';
}
else
{
document.getElementById("switch_dashboard_"+name).innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch Successful%> - <%:Switch To Official Version%>" onclick="return switch_dashboard(this, \'Yacd\', \'Official\')"/>';
}
}
else {
if ( name == "Dashboard" ) {
document.getElementById("switch_dashboard_"+name).innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch Successful%> - <%:Switch To Meta Version%>" onclick="return switch_dashboard(this, \'Dashboard\', \'Meta\')"/>';
}
else if ( name == "Yacd" )
{
document.getElementById("switch_dashboard_"+name).innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch Successful%> - <%:Switch To Meta Version%>" onclick="return switch_dashboard(this, \'Yacd\', \'Meta\')"/>';
}
else if ( name == "Metacubexd" ) {
document.getElementById("switch_dashboard_"+name).innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Update Successful%> - <%:Update Metacubexd Version%>" onclick="return switch_dashboard(this, \'Metacubexd\', \'Official\')"/>';
} else {
document.getElementById("switch_dashboard_"+name).innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Update Successful%> - <%:Update Zashboard Version%>" onclick="return switch_dashboard(this, \'Zashboard\', \'Official\')"/>';
}
}
document.getElementById("default_dashboard_"+name).firstElementChild.disabled = false;
document.getElementById("delete_dashboard_"+name).firstElementChild.disabled = false;
}
else if ( status.download_state == "2" ) {
btn.value = '<%:Unzip Error%>';
}
else {
if ( name == "Metacubexd" || name == "Zashboard" ) {
btn.value = '<%:Update Failed%>';
}
else {
btn.value = '<%:Switch Failed%>';
}
}
}
});
btn.disabled = false;
return false;
}
function delete_dashboard(btn, name)
{
if ( confirm("<%:Are you sure you want to delete this panel?%>") ) {
btn.disabled = true;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "delete_dashboard")%>', {name: name}, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.delete_state == "1" ) {
if ( document.getElementById('default_dashboard_' + name).firstElementChild.disabled ) {
document.getElementById('default_dashboard_' + name).firstElementChild.value = '<%:Set to Default%>';
}
document.getElementById('default_dashboard_' + name).firstElementChild.disabled = true;
}
else {
btn.disabled = false;
}
}
});
}
return false;
}
function default_dashboard(btn, name)
{
btn.disabled = true;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "default_dashboard")%>', {name: name}, function(x, status) {
if ( x && x.status == 200 ) {
btn.value = '<%:Default%>';
btn.disabled = true;
var allBtns = document.querySelectorAll('[id^="default_dashboard_"]');
for (var i = 0; i < allBtns.length; i++) {
var btnEl = allBtns[i].firstElementChild;
if (btnEl && btnEl !== btn && btnEl.value === '<%:Default%>') {
btnEl.disabled = false;
btnEl.value = '<%:Set to Default%>';
}
}
} else {
btn.disabled = false;
}
});
return false;
}
//]]></script>
<%+cbi/valuefooter%>
@@ -0,0 +1,45 @@
<fieldset class="cbi-section">
<table width="100%">
<tr><td width="100%" colspan="4">
<p align="center" id="switch_mode">
<%:Collecting data...%>
</p>
</td></tr>
</table>
</fieldset>
<script type="text/javascript">//<![CDATA[
var switch_mode = document.getElementById('switch_mode');
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "op_mode")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.op_mode == "redir-host" ) {
switch_mode.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch page to Fake-IP mode%>" onclick="return switch_modes(this)"/>';
}
else {
switch_mode.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Switch page to Redir-Host mode%>" onclick="return switch_modes(this)"/>';
}
}
});
function switch_modes(btn)
{
btn.disabled = true;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "switch_mode")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.switch_mode == "redir-host" ) {
alert('<%:Page has been switched to Fake-IP mode!%>')
window.location.href='<%="settings"%>';
}
else {
alert('<%:Page has been switched to Redir-Host mode!%>')
window.location.href='<%="settings"%>';
}
}
});
btn.disabled = false;
return false;
}
//]]></script>
@@ -0,0 +1,534 @@
<%-
local rowcnt = 1
local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash"
function rowstyle()
rowcnt = rowcnt + 1
return (rowcnt % 2) + 1
end
function width(o)
if o.width then
if type(o.width) == 'number' then
return ' style="width:%dpx"' % o.width
end
return ' style="width:%s"' % o.width
end
return ''
end
function table_include(table, value)
if table == nil then
return false
end
for k, v in pairs(table) do
if v == value then
return true
end
end
return false
end
local a={}
local e={}
for t,o in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(o)
if a then
e[t]={}
e[t].name=fs.basename(o)
end
end
if not table_include(e, "all") then
table.insert(e, 1, {name="all"})
end
local cfg_name
if uci:get("openclash", "config", "config_path") then
cfg_name = fs.basename(uci:get("openclash", "config", "config_path"))
end
local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]+") or "self.sectiontype"
-%>
<style type="text/css">
*{margin: 0;padding: 0;}
ul{
list-style: none;
}
h3{
margin-top: 0;
}
.cbi-value-field .cbi-dropdown, .cbi-value-field .cbi-input-select, .cbi-value input[type="text"], .cbi-value input[type="password"] {
min-width: auto;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%>{
display: flex;
align-items: center;
justify-content: flex-start;
padding: 16px 20px;
border-bottom: 1px solid var(--border-light, #e2e8f0);
background: var(--bg-gray, #f1f5f9);
min-width: 0;
box-shadow: none;
position: relative;
z-index: 1;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul{
display: flex;
width: 100%;
background: #f1f5f9;
border-radius: 8px;
border-bottom: none !important;
border: none !important;
gap: 5px;
margin: 0;
padding: 0;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li{
flex: 1 1 0;
min-width: 120px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 0;
height: 40px;
font-size: 12px;
font-weight: 400;
color: #64748b;
background: transparent;
border: 1px solid #e2e8f0;
border-radius: 8px;
cursor: pointer;
transition: all 0.18s;
margin: 0;
user-select: none;
position: relative;
box-sizing: border-box;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab{
background: #3b82f6;
color: #fff;
font-weight: 600;
z-index: 2;
border-radius: 6px;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03);
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li a{
display: block;
width: 100%;
height: 130%;
text-align: center;
text-decoration: none;
background: none;
border: none;
outline: none;
font: inherit;
color: inherit;
cursor: inherit;
padding: 5px;
margin: 0;
user-select: none;
transition: color 0.18s;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab > a{
color: #fff !important;
font-weight: 500;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled{
color: #fff;
background: #f9f9f9;
opacity: 0.7;
cursor: pointer;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled a{
color: #000 !important;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover,
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus{
color: #3b82f6;
background: rgba(59,130,246,0.10);
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover a,
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus a{
color: #3b82f6 !important;
}
#tab-content .dom-<%=self.config%>-<%=self.sectiontype%>{
display: none;
}
#tab-content .dom-<%=self.config%>-<%=self.sectiontype%> ul li{
float: left;
margin: 15px 10px;
width: 225px;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%>{
background: #374151;
border-bottom: 1px solid #374151;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul{
background: #374151;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li{
background: #1f2937;
color: #a1a1aa;
border-color: #374151;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab{
background: #2563eb;
color: #fff;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab a{
color: #fff !important;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled{
color: #1f2937;
background: #1f2937;
opacity: 0.7;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled a{
color: #fff !important;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover,
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus{
color: #3b82f6;
border-color: #3b82f6;
background: #22304a;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover a,
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus a{
color: #60a5fa !important;
}
</style>
<!-- tblsection -->
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
<%- if self.sortable then -%>
<input type="hidden" id="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" value="" />
<%- end -%>
<div class="cbi-section-descr"><%=self.description%></div>
<%- local count = 0 -%>
<div id="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tabmenu">
<ul class="cbi-tabmenu">
<%-
if #e ~= 1 then
for t,o in ipairs(e)do
if o.name == cfg_name and cfg_name then
-%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab"><a><%=o.name%></a></li>
<%- elseif not cfg_name and o.name == "all" then -%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab"><a>ALL</a></li>
<%- elseif o.name == "all" then -%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab-disabled"><a>ALL</a></li>
<%- else -%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab-disabled"><a><%=o.name%></a></li>
<%- end -%>
<%- end -%>
<%- else -%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab"><a>ALL</a></li>
<%- end -%>
</ul>
</div>
<div id="tab-content">
<%- for t,o in ipairs(e)do
if #e ~= 1 and o.name == cfg_name and cfg_name then
-%>
<div class="dom-<%=self.config%>-<%=self.sectiontype%>" style="display: block;">
<%- elseif #e ~= 1 and o.name == "all" and not cfg_name then -%>
<div class="dom-<%=self.config%>-<%=self.sectiontype%>" style="display: block;">
<%- elseif #e == 1 then -%>
<div class="dom-<%=self.config%>-<%=self.sectiontype%>" style="display: block;">
<%- else -%>
<div class="dom-<%=self.config%>-<%=self.sectiontype%>">
<%- end -%>
<table class="cbi-section-table">
<tr class="cbi-section-table-titles">
<%- if not self.anonymous then -%>
<%- if self.sectionhead then -%>
<th class="cbi-section-table-cell"><%=self.sectionhead%></th>
<%- else -%>
<th>&#160;</th>
<%- end -%>
<%- end -%>
<%- for i, k in pairs(self.children) do if not k.optional then -%>
<%- if i == 1 then -%>
<th class="cbi-section-table-cell"><%:Serial Number%></th>
<%- end -%>
<th class="cbi-section-table-cell"<%=width(k)%>>
<%- if k.titleref then -%><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%>
<%-=k.title-%>
<%- if k.titleref then -%></a><%- end -%>
</th>
<%- count = count + 1; end; end; if self.sortable then -%>
<th class="cbi-section-table-cell"><%:Sort%></th>
<%- end; if self.extedit or self.addremove then -%>
<th class="cbi-section-table-cell"><%:Edit%></th>
<%- count = count + 1; end -%>
</tr>
<tr class="cbi-section-table-descr">
<%- if not self.anonymous then -%>
<%- if self.sectiondesc then -%>
<th class="cbi-section-table-cell"><%=self.sectiondesc%></th>
<%- else -%>
<th></th>
<%- end -%>
<%- end -%>
<%- for i, k in pairs(self.children) do if not k.optional then -%>
<th class="cbi-section-table-cell"<%=width(k)%>><%=k.description%></th>
<%- end; end; if self.sortable then -%>
<th class="cbi-section-table-cell"></th>
<%- end; if self.extedit or self.addremove then -%>
<th class="cbi-section-table-cell"></th>
<%- end -%>
</tr>
<%- local isempty = true
local num = 1
for i, k in ipairs(self:cfgsections()) do
section = k
while true do
if not uci:get("openclash", section, "config") then
uci:set("openclash", section, "config", "all")
uci:save("openclash")
end
if uci:get("openclash", section, "config") ~= o.name then
break
end
isempty = false
scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
-%>
<tr class="cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>">
<% if not self.anonymous then -%>
<th><h3><%=(type(self.sectiontitle) == "function") and self:sectiontitle(section) or k%></h3></th>
<%- end %>
<td class="cbi-section-table-cell">
<p><%=num%></p>
<% num = num + 1 -%>
</td>
<%-
for k, node in ipairs(self.children) do
if not node.optional then
node:render(section, scope or {})
end
end
-%>
<%- if self.sortable then -%>
<td class="cbi-section-table-cell">
<input class="cbi-button cbi-button-up" type="button" value="<%:∧%>" onclick="return cbi_row_swap(this, true, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt="<%:Move up%>" title="<%:Move up%>" />
<input class="cbi-button cbi-button-down" type="button" value="<%:∨%>" onclick="return cbi_row_swap(this, false, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt="<%:Move down%>" title="<%:Move down%>" />
</td>
<%- end -%>
<%- if self.extedit or self.addremove then -%>
<td class="cbi-section-table-cell">
<%- if self.extedit then -%>
<input class="btn cbi-button cbi-button-edit" type="button" value="<%:Edit%>"
<%- if type(self.extedit) == "string" then
%> onclick="location.href='<%=self.extedit:format(section)%>';return switch_to_tab<%=sectiontype%>()"
<%- elseif type(self.extedit) == "function" then
%> onclick="location.href='<%=self:extedit(section)%>';return switch_to_tab<%=sectiontype%>()"
<%- end
%> alt="<%:Edit%>" title="<%:Edit%>" />
<%- end; if self.addremove then %>
<input class="btn cbi-button cbi-button-remove" type="submit" value="<%:Delete%>" onclick="this.form.cbi_state='del-section'; return switch_to_tab<%=sectiontype%>()" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" />
<%- end -%>
</td>
<%- end -%>
<%-
break
end
-%>
</tr>
<%- end -%>
<%- if isempty then -%>
<tr class="cbi-section-table-row">
<td colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></td>
</tr>
<%- end -%>
</table>
<% if self.error then %>
<div class="cbi-section-error">
<ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
<li><%=pcdata(e):gsub("\n","<br />")%></li>
<%- end end %></ul>
</div>
<% end %>
<%- if self.addremove then -%>
<% if self.template_addremove then include(self.template_addremove) else -%>
<div class="cbi-section-create cbi-tblsection-create">
<% if self.anonymous then %>
<input class="btn cbi-button cbi-button-add" type="submit" onclick="return switch_to_tab<%=sectiontype%>('create')" value="<%:Add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" title="<%:Add%>" />
<% else %>
<% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
<input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" />
<input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
<% if self.invalid_cts then -%>
<br /><%:Invalid%></div>
<%- end %>
<% end %>
</div>
<%- end %>
<%- end -%>
</div>
<%- end -%>
</div>
</fieldset>
<!-- /tblsection -->
<script type="text/javascript">//<![CDATA[
window.addEventListener('load', onload<%=sectiontype%>, false);
var titles<%=sectiontype%> = document.getElementsByName('tab-header-<%=self.config%>-<%=self.sectiontype%>');
var divs<%=sectiontype%> = document.getElementsByClassName('dom-<%=self.config%>-<%=self.sectiontype%>');
function isDarkBackground(element) {
var cachedTheme = localStorage.getItem('oc-theme');
if (cachedTheme === 'dark') {
return true;
} else if (cachedTheme === 'light') {
return false;
}
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return true;
}
var style = window.getComputedStyle(element);
var bgColor = style.backgroundColor;
let r, g, b;
if (/rgb\(/.test(bgColor)) {
var rgb = bgColor.match(/\d+/g);
r = parseInt(rgb);
g = parseInt(rgb);
b = parseInt(rgb);
} else if (/#/.test(bgColor)) {
if (bgColor.length === 4) {
r = parseInt(bgColor + bgColor, 16);
g = parseInt(bgColor + bgColor, 16);
b = parseInt(bgColor + bgColor, 16);
} else {
r = parseInt(bgColor.slice(1, 3), 16);
g = parseInt(bgColor.slice(3, 5), 16);
b = parseInt(bgColor.slice(5, 7), 16);
}
} else {
return false;
}
var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
return luminance < 128;
};
function switch_to_tab<%=sectiontype%>(type){
if(titles<%=sectiontype%>.length != divs<%=sectiontype%>.length) return;
if ( type == 'create' ) {
localStorage.setItem("titles<%=sectiontype%>", 0);
} else {
for(var j=0; j < titles<%=sectiontype%>.length; j++){
if(titles<%=sectiontype%>[j].className === 'cbi-tab'){
localStorage.setItem("titles<%=sectiontype%>", j);
break;
}
}
}
localStorage.setItem("id<%=sectiontype%>",'cbi-<%=self.config%>-<%=self.sectiontype%>');
return true;
};
function onload<%=sectiontype%>() {
if (isDarkBackground(document.body)) {
document.documentElement.setAttribute('data-darkmode', 'true');
};
if(titles<%=sectiontype%>.length != divs<%=sectiontype%>.length) return;
if (localStorage.getItem("id<%=sectiontype%>")) {
if (document.getElementById(localStorage.getItem("id<%=sectiontype%>"))) {
document.getElementById(localStorage.getItem("id<%=sectiontype%>")).scrollIntoView();
};
localStorage.removeItem("id<%=sectiontype%>");
};
if (localStorage.getItem("titles<%=sectiontype%>")) {
if (titles<%=sectiontype%>[localStorage.getItem("titles<%=sectiontype%>")]) {
for(var j=0; j < titles<%=sectiontype%>.length; j++){
titles<%=sectiontype%>[j].className = 'cbi-tab-disabled';
divs<%=sectiontype%>[j].style.display = 'none';
};
titles<%=sectiontype%>[localStorage.getItem("titles<%=sectiontype%>")].className = 'cbi-tab';
divs<%=sectiontype%>[localStorage.getItem("titles<%=sectiontype%>")].style.display = 'block';
};
localStorage.removeItem("titles<%=sectiontype%>");
};
for(var i=0; i < titles<%=sectiontype%>.length; i++){
var li<%=sectiontype%> = titles<%=sectiontype%>[i];
li<%=sectiontype%>.id = i;
var a<%=sectiontype%> = li<%=sectiontype%>.querySelector('a');
if (a<%=sectiontype%>) {
if (a<%=sectiontype%>.scrollWidth > a<%=sectiontype%>.clientWidth) {
a<%=sectiontype%>.style.textAlign = 'left';
} else {
a<%=sectiontype%>.style.textAlign = 'center';
}
}
li<%=sectiontype%>.onclick = function(){
for(var j=0; j < titles<%=sectiontype%>.length; j++){
titles<%=sectiontype%>[j].className = 'cbi-tab-disabled';
divs<%=sectiontype%>[j].style.display = 'none';
};
this.className = 'cbi-tab';
divs<%=sectiontype%>[this.id].style.display = 'block';
localStorage.setItem("titles<%=sectiontype%>",this.id);
};
li<%=sectiontype%>.onTouchStart = function(){
for(var j=0; j < titles<%=sectiontype%>.length; j++){
titles<%=sectiontype%>[j].className = 'cbi-tab-disabled';
divs<%=sectiontype%>[j].style.display = 'none';
};
this.className = 'cbi-tab';
divs<%=sectiontype%>[this.id].style.display = 'block';
localStorage.setItem("titles<%=sectiontype%>",this.id);
};
};
};
//]]>
</script>
@@ -0,0 +1,488 @@
<%-
local rowcnt = 1
local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash"
function rowstyle()
rowcnt = rowcnt + 1
return (rowcnt % 2) + 1
end
function width(o)
if o.width then
if type(o.width) == 'number' then
return ' style="width:%dpx"' % o.width
end
return ' style="width:%s"' % o.width
end
return ''
end
local head_width
local e={}
table.insert(e, {group="nameserver", title="NameServer"})
table.insert(e, {group="fallback", title="FallBack"})
table.insert(e, {group="default", title="Default-NameServer"})
local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]+") or "self.sectiontype"
-%>
<style type="text/css">
*{margin: 0;padding: 0;}
ul{
list-style: none;
}
h3{
margin-top: 0;
}
.cbi-value-field .cbi-dropdown, .cbi-value-field .cbi-input-select, .cbi-value input[type="text"], .cbi-value input[type="password"] {
min-width: auto;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%>{
display: flex;
align-items: center;
justify-content: flex-start;
padding: 16px 20px;
border-bottom: 1px solid var(--border-light, #e2e8f0);
background: var(--bg-gray, #f1f5f9);
min-width: 0;
box-shadow: none;
position: relative;
z-index: 1;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul{
display: flex;
width: 100%;
background: #f1f5f9;
border-radius: 8px;
border-bottom: none !important;
border: none !important;
gap: 5px;
margin: 0;
padding: 0;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li{
flex: 1 1 0;
min-width: 120px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 0;
height: 40px;
font-size: 12px;
font-weight: 400;
color: #64748b;
background: transparent;
border: 1px solid #e2e8f0;
border-radius: 8px;
cursor: pointer;
transition: all 0.18s;
margin: 0;
user-select: none;
position: relative;
box-sizing: border-box;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab{
background: #3b82f6;
color: #fff;
font-weight: 600;
z-index: 2;
border-radius: 6px;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03);
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li a{
display: block;
width: 100%;
height: 130%;
text-align: center;
text-decoration: none;
background: none;
border: none;
outline: none;
font: inherit;
color: inherit;
cursor: inherit;
padding: 5px;
margin: 0;
user-select: none;
transition: color 0.18s;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab > a{
color: #fff !important;
font-weight: 500;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled{
color: #fff;
background: #f9f9f9;
opacity: 0.7;
cursor: pointer;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled a{
color: #000 !important;
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover,
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus{
color: #3b82f6;
background: rgba(59,130,246,0.10);
}
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover a,
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus a{
color: #3b82f6 !important;
}
#tab-content .dom-<%=self.config%>-<%=self.sectiontype%>{
display: none;
}
#tab-content .dom-<%=self.config%>-<%=self.sectiontype%> ul li{
float: left;
margin: 15px 10px;
width: 225px;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%>{
background: #374151;
border-bottom: 1px solid #374151;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul{
background: #374151;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li{
background: #1f2937;
color: #a1a1aa;
border-color: #374151;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab{
background: #2563eb;
color: #fff;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab a{
color: #fff !important;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled{
color: #1f2937;
background: #1f2937;
opacity: 0.7;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab-disabled a{
color: #fff !important;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover,
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus{
color: #3b82f6;
border-color: #3b82f6;
background: #22304a;
}
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):hover a,
:root[data-darkmode="true"] #tab-header-<%=self.config%>-<%=self.sectiontype%> ul li:not(.cbi-tab):focus a{
color: #60a5fa !important;
}
</style>
<!-- tblsection -->
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<% if self.title and #self.title > 0 then -%>
<legend><%=self.title%></legend>
<%- end %>
<%- if self.sortable then -%>
<input type="hidden" id="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.sts.<%=self.config%>.<%=self.sectiontype%>" value="" />
<%- end -%>
<div class="cbi-section-descr"><%=self.description%></div>
<%- local count = 0 -%>
<div id="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tabmenu">
<ul class="cbi-tabmenu">
<%- for i, tab in ipairs(e) do -%>
<%- if i == 1 then -%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab" data-group="<%=tab.group%>"><a><%=tab.title%></a></li>
<%- else -%>
<li name="tab-header-<%=self.config%>-<%=self.sectiontype%>" class="cbi-tab-disabled" data-group="<%=tab.group%>"><a><%=tab.title%></a></li>
<%- end -%>
<%- end -%>
</ul>
</div>
<div id="tab-content">
<%- for t,o in ipairs(e)do
if o.group == "nameserver" then
-%>
<div class="dom-<%=self.config%>-<%=self.sectiontype%>" style="display: block;" data-group="<%=o.group%>">
<%- else -%>
<div class="dom-<%=self.config%>-<%=self.sectiontype%>" data-group="<%=o.group%>">
<%- end -%>
<table class="cbi-section-table">
<tr class="cbi-section-table-titles">
<%- if not self.anonymous then -%>
<%- if self.sectionhead then -%>
<th class="cbi-section-table-cell"><%=self.sectionhead%></th>
<%- else -%>
<th>&#160;</th>
<%- end -%>
<%- end -%>
<%- for i, k in pairs(self.children) do if not k.optional then -%>
<%- if i == 1 then -%>
<th class="cbi-section-table-cell"><%:Serial Number%></th>
<%- end -%>
<th class="cbi-section-table-cell"<%=width(k)%>>
<%- if k.titleref then -%><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%>
<%-=k.title-%>
<%- if k.titleref then -%></a><%- end -%>
</th>
<%- count = count + 1; end; end; if self.sortable then -%>
<th class="cbi-section-table-cell"><%:Sort%></th>
<%- end; if self.extedit or self.addremove then -%>
<th class="cbi-section-table-cell"><%:Edit%></th>
<%- count = count + 1; end -%>
</tr>
<tr class="cbi-section-table-descr">
<%- if not self.anonymous then -%>
<%- if self.sectiondesc then -%>
<th class="cbi-section-table-cell"><%=self.sectiondesc%></th>
<%- else -%>
<th></th>
<%- end -%>
<%- end; if self.extedit or self.addremove then -%>
<th></th>
<%- end -%>
<%- for i, k in pairs(self.children) do if not k.optional then -%>
<th class="cbi-section-table-cell"<%=width(k)%>><%=k.description%></th>
<%- end; end; if self.sortable then -%>
<th class="cbi-section-table-cell"></th>
<%- end; if self.extedit or self.addremove then -%>
<th class="cbi-section-table-cell"></th>
<%- end -%>
</tr>
<%- local isempty = true
local num = 1
for i, k in ipairs(self:cfgsections()) do
section = k
local section_group = fs.uci_get_config(section, "group")
if section_group == o.group then
isempty = false
scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
-%>
<tr class="cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>">
<% if not self.anonymous then -%>
<th><h3><%=(type(self.sectiontitle) == "function") and self:sectiontitle(section) or k%></h3></th>
<%- end %>
<td class="cbi-section-table-cell">
<p><%=num%></p>
<% num = num + 1 -%>
</td>
<%-
for k, node in ipairs(self.children) do
if not node.optional then
node:render(section, scope or {})
end
end
-%>
<%- if self.sortable then -%>
<td class="cbi-section-table-cell">
<input class="cbi-button cbi-button-up" type="button" value="<%:∧%>" onclick="return cbi_row_swap(this, true, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt="<%:Move up%>" title="<%:Move up%>" />
<input class="cbi-button cbi-button-down" type="button" value="<%:∨%>" onclick="return cbi_row_swap(this, false, 'cbi.sts.<%=self.config%>.<%=self.sectiontype%>')" alt="<%:Move down%>" title="<%:Move down%>" />
</td>
<%- end -%>
<%- if self.extedit or self.addremove then -%>
<td class="cbi-section-table-cell">
<%- if self.extedit then -%>
<input class="btn cbi-button cbi-button-edit" type="button" value="<%:Edit%>"
<%- if type(self.extedit) == "string" then
%> onclick="location.href='<%=self.extedit:format(section)%>';return switch_to_tab<%=sectiontype%>()"
<%- elseif type(self.extedit) == "function" then
%> onclick="location.href='<%=self:extedit(section)%>';return switch_to_tab<%=sectiontype%>()"
<%- end
%> alt="<%:Edit%>" title="<%:Edit%>" />
<%- end; if self.addremove then %>
<input class="btn cbi-button cbi-button-remove" type="submit" value="<%:Delete%>" onclick="this.form.cbi_state='del-section';return switch_to_tab<%=sectiontype%>()" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" />
<%- end -%>
</td>
<%- end -%>
</tr>
<%- end -%>
<%- end -%>
<%- if isempty then -%>
<tr class="cbi-section-table-row">
<td colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></td>
</tr>
<%- end -%>
</table>
<% if self.error then %>
<div class="cbi-section-error">
<ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
<li><%=pcdata(e):gsub("\n","<br />")%></li>
<%- end end %></ul>
</div>
<% end %>
<%- if self.addremove then -%>
<% if self.template_addremove then include(self.template_addremove) else -%>
<div class="cbi-section-create cbi-tblsection-create">
<% if self.anonymous then %>
<input class="btn cbi-button cbi-button-add" type="submit" onclick="return switch_to_tab<%=sectiontype%>('create', '<%=o.group%>')" value="<%:Add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" title="<%:Add%>" />
<% else %>
<% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
<input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=o.group%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=o.group%>" data-type="uciname" data-optional="true" />
<input type="hidden" name="cbi.opt.<%=self.config%>.<%=self.sectiontype%>.group" value="<%=o.group%>" />
<input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
<% if self.invalid_cts then -%>
<br /><%:Invalid%></div>
<%- end %>
<% end %>
</div>
<%- end %>
<%- end -%>
</div>
<%- end -%>
</div>
</fieldset>
<!-- /tblsection -->
<script type="text/javascript">//<![CDATA[
window.addEventListener('load', onload<%=sectiontype%>, false);
var titles<%=sectiontype%> = document.getElementsByName('tab-header-<%=self.config%>-<%=self.sectiontype%>');
var divs<%=sectiontype%> = document.getElementsByClassName('dom-<%=self.config%>-<%=self.sectiontype%>');
function isDarkBackground(element) {
var cachedTheme = localStorage.getItem('oc-theme');
if (cachedTheme === 'dark') {
return true;
} else if (cachedTheme === 'light') {
return false;
}
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return true;
}
var style = window.getComputedStyle(element);
var bgColor = style.backgroundColor;
let r, g, b;
if (/rgb\(/.test(bgColor)) {
var rgb = bgColor.match(/\d+/g);
r = parseInt(rgb);
g = parseInt(rgb);
b = parseInt(rgb);
} else if (/#/.test(bgColor)) {
if (bgColor.length === 4) {
r = parseInt(bgColor + bgColor, 16);
g = parseInt(bgColor + bgColor, 16);
b = parseInt(bgColor + bgColor, 16);
} else {
r = parseInt(bgColor.slice(1, 3), 16);
g = parseInt(bgColor.slice(3, 5), 16);
b = parseInt(bgColor.slice(5, 7), 16);
}
} else {
return false;
}
var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
return luminance < 128;
};
function switch_to_tab<%=sectiontype%>(type){
if(titles<%=sectiontype%>.length != divs<%=sectiontype%>.length) return;
if ( type == 'create' ) {
localStorage.setItem("titles<%=sectiontype%>", 0);
} else {
for(var j=0; j < titles<%=sectiontype%>.length; j++){
if(titles<%=sectiontype%>[j].className === 'cbi-tab'){
localStorage.setItem("titles<%=sectiontype%>", j);
break;
}
}
}
localStorage.setItem("id<%=sectiontype%>",'cbi-<%=self.config%>-<%=self.sectiontype%>');
return true;
};
function onload<%=sectiontype%>() {
if (isDarkBackground(document.body)) {
document.documentElement.setAttribute('data-darkmode', 'true');
};
if(titles<%=sectiontype%>.length != divs<%=sectiontype%>.length) return;
if (localStorage.getItem("id<%=sectiontype%>")) {
if (document.getElementById(localStorage.getItem("id<%=sectiontype%>"))) {
document.getElementById(localStorage.getItem("id<%=sectiontype%>")).scrollIntoView();
};
localStorage.removeItem("id<%=sectiontype%>");
};
if (localStorage.getItem("titles<%=sectiontype%>")) {
if (titles<%=sectiontype%>[localStorage.getItem("titles<%=sectiontype%>")]) {
for(var j=0; j < titles<%=sectiontype%>.length; j++){
titles<%=sectiontype%>[j].className = 'cbi-tab-disabled';
divs<%=sectiontype%>[j].style.display = 'none';
};
titles<%=sectiontype%>[localStorage.getItem("titles<%=sectiontype%>")].className = 'cbi-tab';
divs<%=sectiontype%>[localStorage.getItem("titles<%=sectiontype%>")].style.display = 'block';
};
localStorage.removeItem("titles<%=sectiontype%>");
};
for(var i=0; i < titles<%=sectiontype%>.length; i++){
var li<%=sectiontype%> = titles<%=sectiontype%>[i];
li<%=sectiontype%>.id = i;
var a<%=sectiontype%> = li<%=sectiontype%>.querySelector('a');
if (a<%=sectiontype%>) {
if (a<%=sectiontype%>.scrollWidth > a<%=sectiontype%>.clientWidth) {
a<%=sectiontype%>.style.textAlign = 'left';
} else {
a<%=sectiontype%>.style.textAlign = 'center';
}
}
li<%=sectiontype%>.onclick = function(){
for(var j=0; j < titles<%=sectiontype%>.length; j++){
titles<%=sectiontype%>[j].className = 'cbi-tab-disabled';
divs<%=sectiontype%>[j].style.display = 'none';
};
this.className = 'cbi-tab';
divs<%=sectiontype%>[this.id].style.display = 'block';
localStorage.setItem("titles<%=sectiontype%>",this.id);
};
li<%=sectiontype%>.onTouchStart = function(){
for(var j=0; j < titles<%=sectiontype%>.length; j++){
titles<%=sectiontype%>[j].className = 'cbi-tab-disabled';
divs<%=sectiontype%>[j].style.display = 'none';
};
this.className = 'cbi-tab';
divs<%=sectiontype%>[this.id].style.display = 'block';
localStorage.setItem("titles<%=sectiontype%>",this.id);
};
};
};
//]]>
</script>
@@ -0,0 +1,173 @@
<head>
<style>
.tabs > li {
vertical-align: middle !important;;
}
.tool_label:hover {
border-color: rgba(0, 0, 0, 0) !important;;
background-color: unset !important;;
color: unset !important;;
cursor: unset !important;;
}
.tool_label::after {
border-color: rgba(0, 0, 0, 0) !important;;
background-color: unset !important;;
color: unset !important;;
cursor: unset !important;;
content: unset !important;;
}
.tool_label_span {
display: inline-block;
white-space: nowrap;
}
.tool_label_select {
width: auto;
}
</style>
</head>
<li id="tool_label" class="tool_label">
<span class="tool_label_span">
&nbsp;&nbsp;<%:Current Config File%>:&nbsp;
<select class="tool_label_select" id="cfg_name">
</select>&nbsp;&nbsp;
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:SwiTch%>" onclick="return switch_config(this)" />
&nbsp;
</span>
</li>
<script type="text/javascript">//<![CDATA[
var config_name = document.getElementById('cfg_name');
var tool_label = document.getElementById('tool_label');
var Commit = document.getElementById('cbi-table-1-Commit');
var Apply = document.getElementById('cbi-table-1-Apply');
var Back = document.getElementById('cbi-table-1-Back');
var Load_Config = document.getElementById('cbi-table-1-Load_Config');
var Delete_Unused_Servers = document.getElementById('cbi-table-1-Delete_Unused_Servers');
var Delete_Servers = document.getElementById('cbi-table-1-Delete_Servers');
var Delete_Proxy_Provider = document.getElementById('cbi-table-1-Delete_Proxy_Provider');
var Delete_Groups = document.getElementById('cbi-table-1-Delete_Groups');
var rule_mg = document.getElementById('cbi-table-1-rule_mg');
var pro_mg = document.getElementById('cbi-table-1-pro_mg');
setTimeout("get_header()",100);
if (Commit) {
Commit.style.textAlign="center";
}
if (Apply) {
Apply.style.textAlign="center";
}
if (Back) {
Back.style.textAlign="center";
}
if (Load_Config) {
Load_Config.style.textAlign="center";
Delete_Unused_Servers.style.textAlign="center";
Delete_Servers.style.textAlign="center";
Delete_Proxy_Provider.style.textAlign="center";
Delete_Groups.style.textAlign="center";
}
if (rule_mg) {
rule_mg.style.textAlign="center";
pro_mg.style.textAlign="center";
}
if (tool_label.style.display != "none") {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "config_name")%>', null, function(x, status) {
if (x && x.status == 200 && status.config_name != "") {
for(var i in status.config_name){
config_name.options.add(new Option(status.config_name[i].name,status.config_name[i].name));
}
if (status.config_path != "") {
config_name.value = status.config_path;
}
else
{
config_name.options.add(new Option("<%:Not Select%>",""));
config_name.value = "";
}
}
else if (x && x.status == 200 && status.config_path != "") {
config_name.options.add(new Option(status.config_path,status.config_path));
config_name.value = status.config_path;
}
else {
tool_label.style.display = "none";
}
});
};
function get_header() {
var header = document.getElementsByClassName("tabmenu-item-log ")[0];
if (header) {
insertAfter(tool_label,header);
}
else {
setTimeout("get_header()",100);
}
}
function insertAfter(newElement, targetElement) {
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement) {
parent.appendChild(newElement, targetElement);
}
else {
parent.insertBefore(newElement, targetElement.nextSibling);
};
};
function switch_config(btn)
{
if (config_name.value && config_name.value != "") {
btn.disabled = true;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "switch_config")%>', {config_name: config_name.value}, function(x, status) {
if (x && x.status == 200) {
btn.disabled = false;
alert(' <%:Config File%>: ' + config_name.value + ' <%:switching succeeded!%>')
window.location.href=location.pathname;
}
else {
alert(' <%:Config File%>: ' + config_name.value + ' <%:switching failed!%>')
}
});
return false;
}
}
function restore_config(btn)
{
btn.value = '<%:Restore Default Config%>';
btn.disabled = true;
var r = confirm("<%:Are you sure want to restore the default config?%>")
if (r == true) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "restore")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
alert('<%:Restore succeeded!%>')
window.location.href='<%="settings"%>';
}
else {
alert('<%:Restore failed!%>')
window.location.href='<%="settings"%>';
}
});
}
btn.disabled = false;
return false;
}
function winOpen(url)
{
var winOpen = window.open(url);
if(winOpen == null || typeof(winOpen) == 'undefined'){
window.location.href=url;
}
}
//]]></script>
@@ -0,0 +1,516 @@
<style>
.cbi-input-select {
width: auto !important;
}
</style>
<fieldset class="cbi-section">
<table width="100%">
<tr><td width="100%" colspan="6">
<p align="center" id="update_tip">
<b><%:Note: if the update fails, you can manually download and upload%></b>
</p>
</td></tr>
<tr><td width="16.6%" align="right"><%:Compiled Version%></td>
<td width="16.6%" align="left">
<select class="cbi-input-select" name="CORE_VERSION" id="CORE_VERSION">
<option value="linux-386"><%:linux-386%></option>
<option value="linux-amd64-v1"><%:linux-amd64-v1(x86-64)%></option>
<option value="linux-amd64-v2"><%:linux-amd64-v2(x86-64)%></option>
<option value="linux-amd64-v3"><%:linux-amd64-v3(x86-64)%></option>
<option value="linux-armv5"><%:linux-armv5%></option>
<option value="linux-armv6"><%:linux-armv6%></option>
<option value="linux-armv7"><%:linux-armv7%></option>
<option value="linux-arm64"><%:linux-arm64(armv8)%></option>
<option value="linux-loong64-abi1"><%:linux-loong64-abi1%></option>
<option value="linux-loong64-abi2"><%:linux-loong64-abi2%></option>
<option value="linux-riscv64"><%:linux-riscv64%></option>
<option value="linux-s390x"><%:linux-s390x%></option>
<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>
<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>
<option value="linux-mips64"><%:linux-mips64%></option>
<option value="linux-mips64le"><%:linux-mips64le%></option>
<option value="linux-mipsle-softfloat"><%:linux-mipsle-softfloat%></option>
<option value="linux-mipsle-hardfloat"><%:linux-mipsle-hardfloat%></option>
<option value="0"><%:Not Set%></option>
</select>
</td>
<td width="16.6%" align="right"><%:Release Branch%></td>
<td width="16.6%" align="left"><select class="cbi-input-select" name="RELEASE_BRANCH" id="RELEASE_BRANCH">
<option value="master">Master</option>
<option value="dev">Developer</option>
</select></td>
<td width="16.6%" align="right"><%:Smart Core%> <a href="javascript:void(0);" onclick="window.open('https://github.com/vernesong/mihomo/releases', '_blank');" style="color: #0066cc; text-decoration: none;" title="<%:View core infos that support smart group%>"> (?)</a></td>
<td width="16.6%" align="left"><select class="cbi-input-select" name="SMART_ENABLE" id="SMART_ENABLE">
<option value="0"><%:Disabled%></option>
<option value="1"><%:Enable%></option>
</select></td>
</tr>
</table>
</fieldset>
<fieldset class="cbi-section">
<table width="100%">
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Core Update%></b>
</p>
</td></tr>
<tr><td width="100%" colspan="4">
<tr>
<td width="25%"><%:CPU Architecture%></td><td width="25%" align="left" id="CPU_MODEL"><%:Collecting data...%></td>
<td width="25%"><%:Last Check Update%></td><td width="25%" align="left" id="CHECKTIME"><%:Collecting data...%></td>
</tr>
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Core path:%>/etc/openclash/core/clash_meta</b>
</p>
</td></tr>
<tr><td width="25%">[Meta] <%:Current Core%></td><td width="25%" align="left" id="CORE_META_CV"><%:Collecting data...%></td><td width="25%">[Meta] <%:Latest Core%></td><td width="25%" align="left" id="CORE_META_LV"><%:Collecting data...%></td></tr>
<tr><td width="25%"><%:Update Core%></td><td width="25%" align="left" id="core_meta_up"><%:Collecting data...%></td><td width="25%"><%:Download Latest Core%></td><td width="25%" align="left" id="ma_core_meta_up"><%:Collecting data...%></td></tr>
</table>
</fieldset>
<fieldset class="cbi-section">
<table width="100%">
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Client Update%></b>
</p>
</td></tr>
<tr><td width="25%"><%:Current Client%></td><td width="25%" align="left" id="OP_CV"><%:Collecting data...%></td><td width="25%"><%:Latest Client%></td><td width="25%" align="left" id="OP_LV"><%:Collecting data...%></td></tr>
<tr><td width="25%"><%:Update Client%></td><td width="25%" align="left" id="op_up"><%:Collecting data...%></td><td width="25%"><%:Download Latest Client%></td><td width="25%" align="left" id="ma_op_up"><%:Collecting data...%></td></tr>
</table>
</fieldset>
<fieldset class="cbi-section">
<table width="100%">
<tr>
<td width="33%">
<p align="center" id="restore">
<%:Collecting data...%>
</p>
</td>
<td width="33%">
<p align="center" id="remove_core">
<%:Collecting data...%>
</p>
</td>
<td width="33%">
<p align="center" id="one_key_update_cdn">
<%:Collecting data...%>
</p>
</td>
</tr>
</table>
</fieldset>
<fieldset class="cbi-section">
<table width="100%">
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Backup Section%></b>
</p>
</td></tr>
<tr>
<td width="25%">
<p align="center" id="backup">
<%:Collecting data...%>
</p>
</td>
<td width="25%">
<p align="center" id="backup_ex_core">
<%:Collecting data...%>
</p>
</td>
<td width="25%">
<p align="center" id="backup_core_only">
<%:Collecting data...%>
</p>
</td>
</tr>
<tr>
<td width="25%">
<p align="center" id="backup_config_only">
<%:Collecting data...%>
</p>
</td>
<td width="25%">
<p align="center" id="backup_rule_only">
<%:Collecting data...%>
</p>
</td>
<td width="25%">
<p align="center" id="backup_proxy_only">
<%:Collecting data...%>
</p>
</td>
</tr>
</table>
</fieldset>
<script type="text/javascript">//<![CDATA[
var core_version = document.getElementById('CORE_VERSION');
var checktime = document.getElementById('CHECKTIME');
var cpu_model = document.getElementById('CPU_MODEL');
var core_meta_cv = document.getElementById('CORE_META_CV');
var core_meta_lv = document.getElementById('CORE_META_LV');
var op_cv = document.getElementById('OP_CV');
var op_lv = document.getElementById('OP_LV');
var core_meta_up = document.getElementById('core_meta_up');
var op_up = document.getElementById('op_up');
var update_tip = document.getElementById('update_tip');
var ma_core_meta_up = document.getElementById('ma_core_meta_up');
var ma_op_up = document.getElementById('ma_op_up');
var restore = document.getElementById('restore');
var backup = document.getElementById('backup');
var backup_ex_core = document.getElementById('backup_ex_core');
var backup_core_only = document.getElementById('backup_core_only');
var backup_config_only = document.getElementById('backup_config_only');
var backup_rule_only = document.getElementById('backup_rule_only');
var backup_proxy_only = document.getElementById('backup_proxy_only');
var one_key_update_cdn = document.getElementById('one_key_update_cdn');
var remove_core = document.getElementById('remove_core');
var release_branch = document.getElementById('RELEASE_BRANCH');
var smart_enable = document.getElementById('SMART_ENABLE');
core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Meta\')"/>';
op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return op_update(this)"/>';
ma_core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'Meta\')"/>';
ma_op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_op_update(this)"/>';
restore.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Restore Default Config%>" onclick="return restore_config(this)"/>';
one_key_update_cdn.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Check Update%>" onclick="return all_one_key_update_cdn(this)"/>';
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
backup_ex_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Exclude Cores%>" onclick="return backup_no_core(this)"/>';
backup_core_only.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Core%>" onclick="return backup_only_core(this)"/>';
backup_config_only.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Config%>" onclick="return backup_only_config(this)"/>';
backup_rule_only.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Rule Provider%>" onclick="return backup_only_rule(this)"/>';
backup_proxy_only.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Proxy Provider%>" onclick="return backup_only_proxy(this)"/>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_info")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.corever && status.corever != "0" && status.corever != "" ) {
core_version.value = status.corever;
}
else {
core_version.value = "0";
}
if ( status.release_branch && status.release_branch != "" ) {
release_branch.value = status.release_branch;
}
else {
release_branch.value = "master";
}
if ( status.smart_enable && status.smart_enable != "" ) {
smart_enable.value = status.smart_enable;
}
else {
smart_enable.value = "0";
}
}
else {
core_version.value = "0";
release_branch.value = "master";
smart_enable.value = "0";
}
});
XHR.poll(300, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "get_last_version")%>', null, function(x, status) {
});
function updateStatus(x, status) {
if ( x && x.status == 200 ) {
cpu_model.innerHTML = status.coremodel ? "<b style=color:green>"+status.coremodel+"</b>" : "<b style=color:red><%:Model Not Found%></b>";
if ( status.upchecktime != "1" ) {
checktime.innerHTML = "<b style=color:green>"+status.upchecktime+"</b>";
}
else {
checktime.innerHTML = "<b style=color:red><%:Check Failed%></b>";
}
if ( status.coremetacv == "0" ) {
core_meta_cv.innerHTML = "<b style=color:red><%:Unknown%></b>";
}
else {
core_meta_cv.innerHTML = "<b style=color:green>"+status.coremetacv+"</b>";
}
var coremetalvis = status.corelv;
if (coremetalvis != status.coremetacv && coremetalvis != "" && coremetalvis != "loading...") {
core_meta_lv.innerHTML = "<b style=color:green>"+coremetalvis+" <%:<New>%></b>";
}
else if (coremetalvis != "" && coremetalvis == status.coremetacv && coremetalvis != "loading...") {
core_meta_lv.innerHTML = "<b style=color:green>"+coremetalvis+"</b>";
}
else if (coremetalvis == "loading...") {
core_meta_lv.innerHTML = "<b style=color:green><%:Getting Last Version...%></b>";
}
else {
core_meta_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
}
var oplv = status.oplv;
op_cv.innerHTML = status.opcv != "0" ? "<b style=color:green>"+status.opcv+"</b>" : "<b style=color:red><%:Unknown%></b>";
if (oplv != "" && oplv != "loading..." && status.opcv != "0") {
function compareVersions(v1, v2) {
var ver1 = v1.replace(/^v/, '').split('.');
var ver2 = v2.replace(/^v/, '').split('.');
var maxLen = Math.max(ver1.length, ver2.length);
while (ver1.length < maxLen) ver1.push('0');
while (ver2.length < maxLen) ver2.push('0');
for (var i = 0; i < maxLen; i++) {
var num1 = parseInt(ver1[i], 10);
var num2 = parseInt(ver2[i], 10);
if (num1 > num2) return 1;
if (num1 < num2) return -1;
}
return 0;
}
if (compareVersions(oplv, status.opcv) > 0) {
op_lv.innerHTML = "<b style=color:green>"+oplv+" <%:<New>%></b>";
} else {
op_lv.innerHTML = "<b style=color:green>"+oplv+"</b>";
}
}
else if (oplv != "" && oplv != "loading...") {
op_lv.innerHTML = "<b style=color:green>"+oplv+"</b>";
}
else if (oplv == "loading...") {
op_lv.innerHTML = "<b style=color:green><%:Getting Last Version...%></b>";
}
else {
op_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
}
}
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update")%>', null, updateStatus);
XHR.poll(10, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "update")%>', null, updateStatus);
function handleStartLog(x, status) {
if ( x && x.status == 200 ) {
if ( status.startlog == "\n" || status.startlog == "" || status.startlog == "##FINISH##\n" ) {
var rdmdl = Math.floor(Math.random()*3)+1;
if(rdmdl == 1) {
update_tip.innerHTML = '<b><font><%:Note: if the update fails, you can manually download and upload%></font></b>';
}
else if(rdmdl == 2) {
update_tip.innerHTML = '<b><font><%:Note: the client may not support update, because the firmware with squashfs format will not release flash space after updating%></font></b>';
}
else if(rdmdl == 3) {
update_tip.innerHTML = '<b><font><%:Note: options will auto-save when you click to update or download%></font></b>';
}
}
else if ( status.startlog.match("level=fatal") || status.startlog.indexOf("FTL [Config]") != "-1" ) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "del_start_log")%>', null, function(x) {});
if ( status.startlog.match("level=fatal") ) {
alert('<%:OpenClash Start Failed%> :\n\n' + status.startlog.split('msg=')[1]);
}
else {
alert('<%:OpenClash Start Failed%> :\n\n' + status.startlog.split('FTL [Config] ')[1]);
}
}
else if ( status.startlog != "\n" && status.startlog != "" && status.startlog != "##FINISH##\n" ) {
if ( status.startlog.match("Tip:") || status.startlog.match("提示:")) {
update_tip.innerHTML = '<b style=color:#ff6f00>'+status.startlog+'</b>';
}
else if ( status.startlog.match("Error:") || status.startlog.match("错误:")) {
update_tip.innerHTML = '<b style=color:#FF0000>'+status.startlog+'</b>';
}
else if ( status.startlog.match("Warning:") || status.startlog.match("警告:")) {
update_tip.innerHTML = '<b style=color:#ff00bb>'+status.startlog+'</b>';
}
else if ( status.startlog.match("Watchdog:") || status.startlog.match("守护程序:")) {
update_tip.innerHTML = '<b style=color:#b300ff>'+status.startlog+'</b>';
}
else {
update_tip.innerHTML = '<b style=color:green>'+status.startlog+'</b>';
}
}
}
}
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', null, handleStartLog);
function core_update(btn,type)
{
var v = core_version.value;
var r = release_branch.value;
var s = smart_enable.value;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "coreupdate")%>', {core_type: type}, function(x, status) {
btn.value = '<%:Check And Update%>';
btn.disabled = false;
return false;
});
}
});
}
function op_update(btn)
{
var v = core_version.value;
var r = release_branch.value;
var s = smart_enable.value;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "opupdate")%>', null, function(x, status) {
btn.value = '<%:Check And Update%>';
btn.disabled = false;
return false;
});
}
});
}
function ma_core_update(btn,type)
{
var v = core_version.value;
var r = release_branch.value;
var s = smart_enable.value;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
btn.value = '<%:Download%>';
btn.disabled = false;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_ma")%>', status.corever, function(x, status) {
if ( x && x.status == 200 ) {
if ( status.corever != "0" ) {
if (type == "Meta") {
if (s == "1") {
url4='https://raw.githubusercontent.com/vernesong/OpenClash/core/'+r+'/smart/clash-'+status.corever+'.tar.gz';
window.location.href=url4;
}
else {
url4='https://raw.githubusercontent.com/vernesong/OpenClash/core/'+r+'/meta/clash-'+status.corever+'.tar.gz';
window.location.href=url4;
}
}
}
else {
alert('<%:No Compiled Version is Selected, Please Select on The Top and Try Again!%>')
}
}
});
return false;
}
});
}
function ma_op_update(btn)
{
btn.value = '<%:Download%>';
btn.disabled = false;
var v = core_version.value;
var r = release_branch.value;
var s = smart_enable.value;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_ma")%>', status.oplv, function(x, status) {
if ( x && x.status == 200 ) {
var oplv = status.oplv.substring(status.oplv.indexOf("v") + 1);
if ( oplv != "" && oplv != "loading..." ) {
if (status.pkg_type == "apk") {
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash-'+oplv+'.apk';
}
else {
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash_'+oplv+'_all.ipk';
}
window.location.href=url2;
}
else {
alert('<%:Failed to get the latest version. Please try again later!%>')
}
}
});
}
});
return false;
}
function remove_all_core(btn)
{
btn.value = '<%:Remove Core%>';
btn.disabled = true;
var r = confirm("<%:Are you sure want to remove all core files?%>")
if (r == true) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "remove_all_core")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
alert('<%:Remove succeeded!%>')
}
else {
alert('<%:Remove failed!%>')
}
});
} else {
}
btn.disabled = false;
return false;
}
function backup_all_file(btn)
{
btn.value = '<%:Backup OpenClash%>';
btn.disabled = true;
window.location.href='<%="backup"%>';
btn.disabled = false;
return false;
}
function backup_no_core(btn)
{
btn.value = '<%:Backup Exclude Cores%>';
btn.disabled = true;
window.location.href='<%="backup_ex_core"%>';
btn.disabled = false;
return false;
}
function backup_only_core(btn)
{
btn.value = '<%:Backup Core%>';
btn.disabled = true;
window.location.href='<%="backup_only_core"%>';
btn.disabled = false;
return false;
}
function backup_only_config(btn)
{
btn.value = '<%:Backup Config%>';
btn.disabled = true;
window.location.href='<%="backup_only_config"%>';
btn.disabled = false;
return false;
}
function backup_only_rule(btn)
{
btn.value = '<%:Backup Rule Provider%>';
btn.disabled = true;
window.location.href='<%="backup_only_rule"%>';
btn.disabled = false;
return false;
}
function backup_only_proxy(btn)
{
btn.value = '<%:Backup Proxy Provider%>';
btn.disabled = true;
window.location.href='<%="backup_only_proxy"%>';
btn.disabled = false;
return false;
}
function all_one_key_update_cdn(btn)
{
var v = core_version.value;
var r = release_branch.value;
var s = smart_enable.value;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
if (x && x.status == 200) {
btn.value = '<%:Check Update%>';
btn.disabled = false;
return select_git_cdn("one_key_update");
}
});
}
//]]></script>
@@ -0,0 +1,27 @@
<%+cbi/valueheader%>
<%
local fs = require "luci.openclash"
local filename = fs.filename(self:cfgvalue(section)) or "config"
local display = self.display or ""
local idname = math.random(1000)..(string.match(filename, "[%w_]+") or "")
%>
<script type="text/javascript">//<![CDATA[
function act_update_config_<%=idname%>(btn)
{
btn.disabled = true;
btn.value = '<%:UpDate%>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","update_config")%>',{filename: "<%=filename%>"}, function(x,status){});
btn.disabled = false;
return false;
};
//]]></script>
<%
if display == "" then
%>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:UpDate%>" onclick="return act_update_config_<%=idname%>(this)" />
<%
end
%>
<%+cbi/valuefooter%>
@@ -0,0 +1,28 @@
<%+cbi/valueheader%>
<div style="text-align: center; margin:0 auto; display:block; white-space: nowrap;">
<label class="cbi-value" style="display:inline-block; width: 100%;" for="ulfiles"><%:Upload File Type%>&nbsp;<%:(Click to select)%>&nbsp;&nbsp;&nbsp;
<select name="file_type" style="width:auto">&nbsp;&nbsp;&nbsp;
<option value="config" selected="selected"><%:Config File%> (.yaml)</option>
<option value="proxy-provider"><%:Proxy Provider File%></option>
<option value="rule-provider"><%:Rule Provider File%></option>
<option value="clash_meta">[Meta] <%:Core File%> (.tar.gz)</option>
<option value="backup-file"><%:Backup File%> (.tar.gz)</option>
</select>
<input class="cbi-input-file" style="width: 30%" type="file" id="ulfile" name="ulfile" />
<input type="submit" class="btn cbi-button cbi-input-reload" name="upload" value="<%:Upload%>" />
<input type="submit" class="btn cbi-button cbi-button-reset" value="<%:Backup%>" onclick="return backup_all_file(this)"/>
</div>
<%+cbi/valuefooter%>
<script type="text/javascript">//<![CDATA[
function backup_all_file(btn)
{
btn.value = '<%:Backup%>';
btn.disabled = true;
window.location.href='<%="backup"%>';
btn.disabled = false;
return false;
};
//]]></script>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
zh-cn
@@ -0,0 +1,300 @@
config openclash 'config'
option proxy_port '7892'
option tproxy_port '7895'
option mixed_port '7893'
option socks_port '7891'
option http_port '7890'
option dns_port '7874'
option enable '0'
option update '0'
option en_mode '0'
option auto_update '0'
option auto_update_time '0'
option cn_port '9090'
option dashboard_forward_ssl '0'
option rule_source '0'
option enable_custom_dns '0'
option ipv6_enable '0'
option ipv6_dns '0'
option enable_custom_clash_rules '0'
option other_rule_auto_update '0'
option core_version '0'
option en_mode 'fake-ip'
option enable_redirect_dns '1'
option servers_if_update '0'
option disable_masq_cache '1'
option servers_update '0'
option log_level '0'
option proxy_mode 'rule'
option intranet_allowed '1'
option enable_udp_proxy '1'
option disable_udp_quic '1'
option lan_ac_mode '0'
option operation_mode 'fake-ip'
option enable_rule_proxy '0'
option redirect_dns '0'
option cachesize_dns '0'
option filter_aaaa_dns '0'
option small_flash_memory '0'
option interface_name '0'
option common_ports '0'
option log_size '1024'
option tolerance '0'
option store_fakeip '0'
option custom_fallback_filter '0'
option custom_fakeip_filter '0'
option custom_host '0'
option custom_name_policy '0'
option append_wan_dns '0'
option stream_auto_select '0'
option bypass_gateway_compatible '0'
option github_address_mod '0'
option urltest_address_mod '0'
option urltest_interval_mod '0'
option delay_start '0'
option router_self_proxy '1'
option release_branch 'master'
option smart_enable '0'
option dashboard_type 'Official'
option yacd_type 'Meta'
option append_default_dns '0'
option enable_respect_rules '0'
option geo_custom_url 'https://testingcf.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/lite/Country.mmdb'
option geosite_custom_url 'https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat'
option geoip_custom_url 'https://testingcf.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat'
option geoasn_custom_url 'https://testingcf.jsdelivr.net/gh/xishang0128/geoip@release/GeoLite2-ASN.mmdb'
option chnr_custom_url 'https://ispip.clang.cn/all_cn.txt'
option chnr6_custom_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
config dns_servers
option type 'udp'
option ip '114.114.114.114'
option enabled '1'
option group 'default'
config dns_servers
option type 'udp'
option ip '119.29.29.29'
option enabled '1'
option group 'default'
config dns_servers
option group 'nameserver'
option type 'udp'
option ip '114.114.114.114'
option enabled '1'
config dns_servers
option type 'udp'
option ip '223.5.5.5'
option enabled '1'
option group 'default'
config dns_servers
option group 'nameserver'
option type 'udp'
option ip '119.29.29.29'
option enabled '1'
config dns_servers
option group 'nameserver'
option type 'udp'
option ip '119.28.28.28'
option enabled '0'
config dns_servers
option group 'nameserver'
option type 'udp'
option ip '223.5.5.5'
option enabled '0'
config dns_servers
option type 'https'
option ip 'doh.pub/dns-query'
option group 'nameserver'
option enabled '1'
config dns_servers
option type 'https'
option ip 'dns.alidns.com/dns-query'
option group 'nameserver'
option enabled '1'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '9.9.9.9'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '149.112.112.112'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2620:fe::fe'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2620:fe::9'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '8.8.8.8'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '8.8.4.4'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2001:4860:4860::8888'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2001:4860:4860::8844'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '2001:da8::666'
option type 'udp'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.quad9.net'
option type 'tls'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.google'
option type 'tls'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '1.1.1.1'
option type 'tls'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'jp.tiar.app'
option type 'tls'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dot.tiar.app'
option type 'tls'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.quad9.net/dns-query'
option type 'https'
config dns_servers
option enabled '1'
option group 'fallback'
option ip 'dns.google/dns-query'
option type 'https'
config dns_servers
option enabled '1'
option group 'fallback'
option ip 'dns.cloudflare.com/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip '1.1.1.1/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'public.dns.iij.jp/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'jp.tiar.app/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'jp.tiarap.org/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option type 'https'
option ip 'doh.dnslify.com/dns-query'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.twnic.tw/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dns.oszx.co/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'doh.applied-privacy.net/query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'dnsforge.de/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'doh.ffmuc.net/dns-query'
option type 'https'
config dns_servers
option enabled '0'
option group 'fallback'
option ip 'doh.mullvad.net/dns-query'
option type 'https'
config config_overwrite
option name 'default'
option enable '0'
option url 'https://raw.githubusercontent.com/vernesong/OpenClash/refs/heads/dev/luci-app-openclash/root/etc/openclash/overwrite/default'
option update_days 'off'
option update_hour 'off'
option type 'http'
option order '1'
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,6 @@
#baidu.com
#2400:da00::dbf:0:100
##解决绕过大陆后谷歌商店无法更新
services.googleapis.cn
googleapis.cn
xn--ngstr-lra8j.com
@@ -0,0 +1,6 @@
#baidu.com
#114.114.114.114
##解决绕过大陆后谷歌商店无法更新
services.googleapis.cn
googleapis.cn
xn--ngstr-lra8j.com
@@ -0,0 +1 @@
#baidu.com
@@ -0,0 +1,6 @@
#'www.baidu.com': '114.114.114.114'
#'+.internal.crop.com': '10.0.0.1'
#"_vlmcs._tcp.lan": '127.0.0.1:53'
#"geosite:category-games@cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
#"geosite:google": [tls://8.8.4.4, https://1.0.0.1/dns-query]
#"geosite:cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
@@ -0,0 +1,180 @@
#LAN
*.lan
*.localdomain
*.example
*.invalid
*.localhost
*.test
*.local
*.home.arpa
*.direct
cable.auth.com
network-test.debian.org
detectportal.firefox.com
resolver1.opendns.com
global.turn.twilio.com
global.stun.twilio.com
app.yinxiang.com
injections.adguard.org
localhost.*.weixin.qq.com
*.blzstatic.cn
*.cmpassport.com
id6.me
open.e.189.cn
opencloud.wostore.cn
id.mail.wo.cn
mdn.open.wo.cn
hmrz.wo.cn
nishub1.10010.com
enrichgw.10010.com
*.wosms.cn
*.jegotrip.com.cn
*.icitymobile.mobi
*.pingan.com.cn
*.cmbchina.com
*.10099.com.cn
*.microdone.cn
PDC._msDCS.*.*
DC._msDCS.*.*
GC._msDCS.*.*
#放行NTP服务
time.*.com
time.*.gov
time.*.edu.cn
time.*.apple.com
time-ios.apple.com
time1.*.com
time2.*.com
time3.*.com
time4.*.com
time5.*.com
time6.*.com
time7.*.com
ntp.*.com
ntp1.*.com
ntp2.*.com
ntp3.*.com
ntp4.*.com
ntp5.*.com
ntp6.*.com
ntp7.*.com
*.time.edu.cn
*.ntp.org.cn
+.pool.ntp.org
time1.cloud.tencent.com
#放行网易云音乐
music.163.com
*.music.163.com
*.126.net
#百度音乐
musicapi.taihe.com
music.taihe.com
#酷狗音乐
songsearch.kugou.com
trackercdn.kugou.com
#酷我音乐
*.kuwo.cn
#JOOX音乐
api-jooxtt.sanook.com
api.joox.com
joox.com
#QQ音乐
y.qq.com
*.y.qq.com
streamoc.music.tc.qq.com
mobileoc.music.tc.qq.com
isure.stream.qqmusic.qq.com
dl.stream.qqmusic.qq.com
aqqmusic.tc.qq.com
amobile.music.tc.qq.com
#虾米音乐
*.xiami.com
#咪咕音乐
*.music.migu.cn
music.migu.cn
#win10本地连接检测
+.msftconnecttest.com
+.msftncsi.com
#QQ登录
localhost.ptlogin2.qq.com
localhost.sec.qq.com
+.qq.com
+.tencent.com
#Game
#Nintendo Switch
+.srv.nintendo.net
*.n.n.srv.nintendo.net
+.cdn.nintendo.net
#Sony PlayStation
+.stun.playstation.net
#Microsoft Xbox
xbox.*.*.microsoft.com
*.*.xboxlive.com
xbox.*.microsoft.com
xnotify.xboxlive.com
#Wotgame
+.battle.net
+.battlenet.com.cn
+.wotgame.cn
+.wggames.cn
+.wowsgame.cn
+.wargaming.net
#Golang
proxy.golang.org
#STUN
stun.*.*
stun.*.*.*
+.stun.*.*
+.stun.*.*.*
+.stun.*.*.*.*
+.stun.*.*.*.*.*
#Linksys Router
heartbeat.belkin.com
*.linksys.com
*.linksyssmartwifi.com
#ASUS Router
*.router.asus.com
#Apple Software Update Service
mesu.apple.com
swscan.apple.com
swquery.apple.com
swdownload.apple.com
swcdn.apple.com
swdist.apple.com
#Google
lens.l.google.com
stun.l.google.com
na.b.g-tun.com
#Netflix
+.nflxvideo.net
#FinalFantasy XIV Worldwide Server & CN Server
*.square-enix.com
*.finalfantasyxiv.com
*.ffxiv.com
*.ff14.sdo.com
ff.dorado.sdo.com
#Bilibili
*.mcdn.bilivideo.cn
#Disney Plus
+.media.dssott.com
#shark007 Codecs
shark007.net
#Mijia
Mijia Cloud
#招商银行
+.cmbchina.com
+.cmbimg.com
#AdGuard
local.adguard.org
#迅雷
+.sandai.net
+.n0808.com
#UU Plugin
+.uu.163.com
ps.res.netease.com
#Wifi Calling
+.pub.3gppnetwork.org
#GEOSITE(Meta core)
#geosite:category-games
#geosite:apple-cn
#geosite:google-cn
@@ -0,0 +1,43 @@
# If IP addresses resolved with servers in `nameservers` are in the specified
# subnets below, they are considered invalid and results from `fallback`
# servers are used instead.
#
# IP address resolved with servers in `nameserver` is used when
# `fallback-filter.geoip` is true and when GEOIP of the IP address is `CN`.
#
# If `fallback-filter.geoip` is false, results from `nameserver` nameservers
# are always used if not match `fallback-filter.ipcidr`.
#
# This is a countermeasure against DNS pollution attacks.
fallback-filter:
geoip: true
geoip-code: CN
ipcidr:
- ::/128
- ::1/128
- 2001::/32
- 0.0.0.0/8
- 10.0.0.0/8
- 100.64.0.0/10
- 127.0.0.0/8
- 169.254.0.0/16
- 172.16.0.0/12
- 192.0.0.0/24
- 192.0.2.0/24
- 192.88.99.0/24
- 192.168.0.0/16
- 198.18.0.0/15
- 198.51.100.0/24
- 203.0.113.0/24
- 224.0.0.0/4
- 240.0.0.0/4
- 255.255.255.255/32
domain:
- "+.google.com"
- "+.facebook.com"
- "+.youtube.com"
- "+.githubusercontent.com"
- "+.googlevideo.com"
- "+.msftconnecttest.com"
- "+.msftncsi.com"
@@ -0,0 +1,10 @@
#!/bin/sh
. /usr/share/openclash/log.sh
. /lib/functions.sh
# This script is called by /etc/init.d/openclash
# Add your custom firewall rules here, they will be added after the end of the OpenClash iptables rules
LOG_OUT "Tip: Start Add Custom Firewall Rules..."
exit 0
@@ -0,0 +1,10 @@
# Static hosts for DNS server and connection establishment (like /etc/hosts)
#
# Wildcard hostnames are supported (e.g. *.clash.dev, *.foo.*.example.com)
# Non-wildcard domain names have a higher priority than wildcard domain names
# e.g. foo.example.com > *.example.com > .example.com
# P.S. +.foo.com equals to .foo.com and foo.com
# '*.clash.dev': 127.0.0.1
# '.dev': 127.0.0.1
# 'alpha.clash.dev': '::1'
@@ -0,0 +1,9 @@
0.0.0.0/8
10.0.0.0/8
100.64.0.0/10
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.168.0.0/16
224.0.0.0/4
240.0.0.0/4
@@ -0,0 +1,12 @@
::/128
::1/128
::ffff:0:0/96
::ffff:0:0:0/96
64:ff9b::/96
100::/64
2001::/32
2001:20::/28
2001:db8::/32
2002::/16
fe80::/10
ff00::/8
@@ -0,0 +1,125 @@
#!/bin/sh
. /usr/share/openclash/ruby.sh
. /usr/share/openclash/log.sh
. /lib/functions.sh
# This script is called by /etc/init.d/openclash
# Add your custom overwrite scripts here, they will be take effict after the OpenClash own srcipts
LOG_OUT "Tip: Start Running Custom Overwrite Scripts..."
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
#Config Path
CONFIG_FILE="$1"
#Simple Demo:
#Key Overwrite Demo
#1--config path
#2--key name
#3--value
#ruby_edit "$CONFIG_FILE" "['redir-port']" "7892"
#ruby_edit "$CONFIG_FILE" "['secret']" "123456"
#ruby_edit "$CONFIG_FILE" "['dns']['enable']" "true"
#ruby_edit "$CONFIG_FILE" "['dns']['proxy-server-nameserver']" "['https://doh.pub/dns-query','https://223.5.5.5:443/dns-query']"
#Hash Overwrite Demo
#1--config path
#2--key name
#3--hash type value
#ruby_edit "$CONFIG_FILE" "['dns']['nameserver-policy']" "{'+.msftconnecttest.com'=>'114.114.114.114', '+.msftncsi.com'=>'114.114.114.114', 'geosite:gfw'=>['https://dns.cloudflare.com/dns-query', 'https://dns.google/dns-query#ecs=1.1.1.1/24&ecs-override=true'], 'geosite:cn'=>['114.114.114.114'], 'geosite:geolocation-!cn'=>['https://dns.cloudflare.com/dns-query', 'https://dns.google/dns-query#ecs=1.1.1.1/24&ecs-override=true']}"
#ruby_edit "$CONFIG_FILE" "['sniffer']" "{'enable'=>true, 'parse-pure-ip'=>true, 'force-domain'=>['+.netflix.com', '+.nflxvideo.net', '+.amazonaws.com', '+.media.dssott.com'], 'skip-domain'=>['+.apple.com', 'Mijia Cloud', 'dlg.io.mi.com', '+.oray.com', '+.sunlogin.net'], 'sniff'=>{'TLS'=>nil, 'HTTP'=>{'ports'=>[80, '8080-8880'], 'override-destination'=>true}}}"
#Map Edit Demo
#1--config path
#2--map name
#3--key name
#4--sub key name
#5--value
#ruby_map_edit "$CONFIG_FILE" "['proxy-providers']" "HK" "['url']" "http://test.com"
#Hash Merge Demo
#1--config path
#2--key name
#3--hash
#ruby_merge_hash "$CONFIG_FILE" "['proxy-providers']" "'TW'=>{'type'=>'http', 'path'=>'./proxy_provider/TW.yaml', 'url'=>'https://gist.githubusercontent.com/raw/tw_clash', 'interval'=>3600, 'health-check'=>{'enable'=>true, 'url'=>'http://cp.cloudflare.com/generate_204', 'interval'=>300}}"
#ruby_merge_hash "$CONFIG_FILE" "['rule-providers']" "'Reject'=>{'type'=>'http', 'behavior'=>'classical', 'url'=>'https://testingcf.jsdelivr.net/gh/dler-io/Rules@main/Clash/Provider/Reject.yaml', 'path'=>'./rule_provider/Reject', 'interval'=>86400}"
#Array Edit Demo
#1--config path
#2--key name
#3--match key name
#4--match key value
#5--target key name
#6--target key value
#ruby_arr_edit "$CONFIG_FILE" "['proxy-groups']" "['name']" "Proxy" "['type']" "Smart"
#ruby_arr_edit "$CONFIG_FILE" "['dns']['nameserver']" "" "114.114.114.114" "" "119.29.29.29"
#Array Insert Value Demo:
#1--config path
#2--key name
#3--position(start from 0, end with -1)
#4--value
#ruby_arr_insert "$CONFIG_FILE" "['dns']['nameserver']" "0" "114.114.114.114"
#Array Insert Hash Demo:
#1--config path
#2--key name
#3--position(start from 0, end with -1)
#4--hash
#ruby_arr_insert_hash "$CONFIG_FILE" "['proxy-groups']" "0" "{'name'=>'Disney', 'type'=>'select', 'disable-udp'=>false, 'use'=>['TW', 'SG', 'HK']}"
#ruby_arr_insert_hash "$CONFIG_FILE" "['proxies']" "0" "{'name'=>'HKG 01', 'type'=>'ss', 'server'=>'cc.hd.abc', 'port'=>'12345', 'cipher'=>'aes-128-gcm', 'password'=>'123456', 'udp'=>true, 'plugin'=>'obfs', 'plugin-opts'=>{'mode'=>'http', 'host'=>'microsoft.com'}}"
#ruby_arr_insert_hash "$CONFIG_FILE" "['listeners']" "0" "{'name'=>'name', 'type'=>'shadowsocks', 'port'=>'12345', 'listen'=>'0.0.0.0', 'rule'=>'sub-rule-1', 'proxy'=>'proxy'}"
#Array Insert Other Array Demo:
#1--config path
#2--key name
#3--position(start from 0, end with -1)
#4--array
#ruby_arr_insert_arr "$CONFIG_FILE" "['dns']['proxy-server-nameserver']" "0" "['https://doh.pub/dns-query','https://223.5.5.5:443/dns-query']"
#Array Insert From Yaml File Demo:
#1--config path
#2--key name
#3--position(start from 0, end with -1)
#4--value file path
#5--value key name in #4 file
#ruby_arr_add_file "$CONFIG_FILE" "['dns']['fallback-filter']['ipcidr']" "0" "/etc/openclash/custom/openclash_custom_fallback_filter.yaml" "['fallback-filter']['ipcidr']"
#Delete Array Value Demo:
#1--config path
#2--key name
#3--value
#ruby_delete "$CONFIG_FILE" "['dns']['nameserver']" "114.114.114.114"
#Delete Key Demo:
#1--config path
#2--key name
#3--key name
#ruby_delete "$CONFIG_FILE" "['dns']" "nameserver"
#ruby_delete "$CONFIG_FILE" "" "dns"
#Ruby Script Demo:
#ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
# begin
# Value = YAML.load_file('$CONFIG_FILE');
# rescue Exception => e
# puts '${LOGTIME} Error: Load File Failed,【' + e.message + '】';
# end;
#General
# begin
# Thread.new{
# Value['redir-port']=7892;
# Value['tproxy-port']=7895;
# Value['port']=7890;
# Value['socks-port']=7891;
# Value['mixed-port']=7893;
# }.join;
# rescue Exception => e
# puts '${LOGTIME} Error: Set General Failed,【' + e.message + '】';
# ensure
# File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)};
# end" 2>/dev/null >> $LOG_FILE
exit 0
@@ -0,0 +1,5 @@
#'www.yournode.com': '114.114.114.114'
#'+.yournode.com': '10.0.0.1'
#"yournode.com": '127.0.0.1:53'
#"geosite:cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
#"geosite:geolocation-!cn": [https://dns.cloudflare.com/dns-query#skip-cert-verify=true,https://dns.google/dns-query#ecs=1.1.1.1/24&ecs-override=true&skip-cert-verify=true]
@@ -0,0 +1,78 @@
rules:
##- PROCESS-NAME,curl,DIRECT #匹配路由自身进程(curl直连)
##- DOMAIN-SUFFIX,google.com,Proxy #匹配域名后缀(交由Proxy代理服务器组)
##- DOMAIN-KEYWORD,google,Proxy #匹配域名关键字(交由Proxy代理服务器组)
##- DOMAIN,google.com,Proxy #匹配域名(交由Proxy代理服务器组)
##- DOMAIN-SUFFIX,ad.com,REJECT #匹配域名后缀(拒绝)
##- IP-CIDR,127.0.0.0/8,DIRECT #匹配数据目标IP(直连)
##- SRC-IP-CIDR,192.168.1.201/32,DIRECT #匹配数据发起IP(直连)
##- DST-PORT,80,DIRECT #匹配数据目标端口(直连)
##- SRC-PORT,7777,DIRECT #匹配数据源端口(直连)
##- GEOSITE,category-public-tracker,DIRECT #匹配GEOSITE数据库规则(直连)
##- DOMAIN-REGEX,^abc.*com,PROXY #正则匹配域名
##- RULE-SET,providername,PROXY #匹配规则集
##- IP-CIDR6,2620:0:2d0:200::7/32,PROXY
##- IP-SUFFIX,8.8.8.8/24,PROXY
##- IP-ASN,13335,DIRECT
##- SRC-GEOIP,cn,DIRECT
##- SRC-IP-ASN,9808,DIRECT
##- SRC-IP-SUFFIX,192.168.1.201/8,DIRECT
##- IN-PORT,7890,PROXY
##- IN-TYPE,SOCKS/HTTP,PROXY
##- IN-USER,mihomo,PROXY
##- IN-NAME,ss,PROXY
##- PROCESS-NAME-REGEX,curl$,PROXY
##- PROCESS-NAME-REGEX,(?i)Telegram,PROXY
##- PROCESS-NAME-REGEX,.*telegram.*,PROXY
##- NETWORK,udp,DIRECT
##- DSCP,4,DIRECT
##- AND,((DOMAIN,baidu.com),(NETWORK,UDP)),DIRECT
##- OR,((NETWORK,UDP),(DOMAIN,baidu.com)),REJECT
##- NOT,((DOMAIN,baidu.com)),PROXY
##- SUB-RULE,(NETWORK,tcp),sub-rule
##排序在上的规则优先生效,如添加(去除规则前的#号):
##IP段:192.168.1.2-192.168.1.200 直连
##- SRC-IP-CIDR,192.168.1.2/31,DIRECT
##- SRC-IP-CIDR,192.168.1.4/30,DIRECT
##- SRC-IP-CIDR,192.168.1.8/29,DIRECT
##- SRC-IP-CIDR,192.168.1.16/28,DIRECT
##- SRC-IP-CIDR,192.168.1.32/27,DIRECT
##- SRC-IP-CIDR,192.168.1.64/26,DIRECT
##- SRC-IP-CIDR,192.168.1.128/26,DIRECT
##- SRC-IP-CIDR,192.168.1.192/29,DIRECT
##- SRC-IP-CIDR,192.168.1.200/32,DIRECT
##IP段:192.168.1.202-192.168.1.255 直连
##- SRC-IP-CIDR,192.168.1.202/31,DIRECT
##- SRC-IP-CIDR,192.168.1.204/30,DIRECT
##- SRC-IP-CIDR,192.168.1.208/28,DIRECT
##- SRC-IP-CIDR,192.168.1.224/27,DIRECT
##此时IP为192.168.1.1和192.168.1.201的客户端流量走代理(策略),其余客户端不走代理
##因为Fake-IP模式下,IP地址为192.168.1.1的路由器自身流量可走代理(策略),所以需要排除
##仅设置路由器自身直连:
##- SRC-IP-CIDR,192.168.1.1/32,DIRECT
##- SRC-IP-CIDR,198.18.0.1/32,DIRECT
##DDNS
##- DOMAIN-KEYWORD,synology,DIRECT
##- DOMAIN-KEYWORD,quickconnect,DIRECT
##- DOMAIN-SUFFIX,checkip.dyndns.org,DIRECT
##- DOMAIN-SUFFIX,checkipv6.dyndns.org,DIRECT
##- DOMAIN-SUFFIX,checkip.synology.com,DIRECT
##- DOMAIN-SUFFIX,ifconfig.co,DIRECT
##- DOMAIN-SUFFIX,api.myip.com,DIRECT
##- DOMAIN-SUFFIX,ip-api.com,DIRECT
##- DOMAIN-SUFFIX,ipapi.co,DIRECT
##- DOMAIN-SUFFIX,ip6.seeip.org,DIRECT
##- DOMAIN-SUFFIX,members.3322.org,DIRECT
##在线IP段转CIDR地址:http://ip2cidr.com
@@ -0,0 +1,9 @@
rules:
##- DOMAIN-SUFFIX,google.com,Proxy #匹配域名后缀(交由Proxy代理服务器组)
##- DOMAIN-KEYWORD,google,Proxy #匹配域名关键字(交由Proxy代理服务器组)
##- DOMAIN,google.com,Proxy #匹配域名(交由Proxy代理服务器组)
##- DOMAIN-SUFFIX,ad.com,REJECT #匹配域名后缀(拒绝)
##- IP-CIDR,127.0.0.0/8,DIRECT #匹配数据目标IP(直连)
##- SRC-IP-CIDR,192.168.1.201/32,DIRECT #匹配数据发起IP(直连)
##- DST-PORT,80,DIRECT #匹配数据目标端口(直连)
##- SRC-PORT,7777,DIRECT #匹配数据源端口(直连)
@@ -0,0 +1,40 @@
# 嗅探域名 可选配置
sniffer:
## 对 redir-host 类型识别的流量进行强制嗅探
## 如:Tun、Redir 和 TProxy 并 DNS 为 redir-host 皆属于
force-dns-mapping: true
## 对所有未获取到域名的流量进行强制嗅探
parse-pure-ip: true
# 是否使用嗅探结果作为实际访问,默认 true
# 全局配置,优先级低于 sniffer.sniff 实际配置
override-destination: true
sniff: # TLS 和 QUIC 默认如果不配置 ports 默认嗅探 443
QUIC:
ports: [ 443 ]
TLS:
ports: [443, 8443]
# 默认嗅探 80
HTTP:
ports: [80, 8080-8880]
# 是否使用嗅探结果作为实际访问
override-destination: true
force-domain:
# - '+' # Force all domain to use sniffer
- "+.netflix.com"
- "+.nflxvideo.net"
- "+.amazonaws.com"
- "+.media.dssott.com"
## 对嗅探结果进行跳过
skip-domain:
- Mijia Cloud
- dlg.io.mi.com
- +.oray.com
- +.sunlogin.net
- +.push.apple.com
#- geosite:cn
# skip-src-address: # 对于来源ip跳过嗅探
# - 192.168.0.3/32
# skip-dst-address: # 对于目标ip跳过嗅探
# - 192.168.0.3/32
@@ -0,0 +1,618 @@
payload:
- 1.165.84.0/24
- 1.165.85.0/24
- 1.165.90.0/24
- 5.8.200.0/24
- 5.9.123.0/24
- 13.73.0.0/16
- 13.73.1.0/24
- 13.75.114.0/24
- 13.126.76.0/24
- 14.18.251.72/32
- 18.214.26.0/24
- 24.105.28.0/24
- 27.64.93.0/24
- 34.235.169.0/24
- 35.185.157.0/24
- 35.198.200.0/24
- 36.232.23.0/24
- 36.232.28.0/24
- 36.232.29.0/24
- 37.21.10.0/24
- 37.230.228.0/24
- 42.113.94.0/24
- 42.114.229.0/24
- 43.225.199.0/24
- 43.239.136.0/24
- 43.241.50.0/24
- 43.249.36.0/24
- 45.113.137.0/24
- 45.113.191.0/24
- 45.119.240.0/24
- 45.121.184.0/24
- 45.121.185.0/24
- 45.121.186.0/24
- 45.121.187.0/24
- 47.52.16.0/24
- 47.52.17.0/24
- 47.52.18.0/24
- 47.52.19.0/24
- 47.52.20.0/24
- 47.52.21.0/24
- 47.52.22.0/24
- 47.52.23.0/24
- 47.52.24.0/24
- 47.52.25.0/24
- 47.52.26.0/24
- 47.52.27.0/24
- 47.52.28.0/24
- 47.52.29.0/24
- 47.52.30.0/24
- 47.52.31.0/24
- 47.52.40.0/24
- 47.52.41.0/24
- 47.52.42.0/24
- 47.52.43.0/24
- 47.52.44.0/24
- 47.52.45.0/24
- 47.52.46.0/24
- 47.52.47.0/24
- 47.52.56.0/24
- 47.52.57.0/24
- 47.52.58.0/24
- 47.52.59.0/24
- 47.52.60.0/24
- 47.52.61.0/24
- 47.52.62.0/24
- 47.52.63.0/24
- 47.52.64.0/24
- 47.52.65.0/24
- 47.52.66.0/24
- 47.52.67.0/24
- 47.52.68.0/24
- 47.52.69.0/24
- 47.52.70.0/24
- 47.52.71.0/24
- 47.52.72.0/24
- 47.52.73.0/24
- 47.52.74.0/24
- 47.52.75.0/24
- 47.52.76.0/24
- 47.52.77.0/24
- 47.52.78.0/24
- 47.52.79.0/24
- 47.52.88.0/24
- 47.52.89.0/24
- 47.52.90.0/24
- 47.52.91.0/24
- 47.52.92.0/24
- 47.52.93.0/24
- 47.52.94.0/24
- 47.52.95.0/24
- 47.52.96.0/24
- 47.52.97.0/24
- 47.52.98.0/24
- 47.52.99.0/24
- 47.52.100.0/24
- 47.52.101.0/24
- 47.52.102.0/24
- 47.52.103.0/24
- 47.52.104.0/24
- 47.52.105.0/24
- 47.52.106.0/24
- 47.52.107.0/24
- 47.52.108.0/24
- 47.52.109.0/24
- 47.52.110.0/24
- 47.52.111.0/24
- 47.52.112.0/24
- 47.52.113.0/24
- 47.52.114.0/24
- 47.52.115.0/24
- 47.52.116.0/24
- 47.52.117.0/24
- 47.52.118.0/24
- 47.52.119.0/24
- 47.52.128.0/24
- 47.52.129.0/24
- 47.52.130.0/24
- 47.52.131.0/24
- 47.52.132.0/24
- 47.52.133.0/24
- 47.52.134.0/24
- 47.52.135.0/24
- 47.52.136.0/24
- 47.52.137.0/24
- 47.52.138.0/24
- 47.52.139.0/24
- 47.52.140.0/24
- 47.52.141.0/24
- 47.52.142.0/24
- 47.52.143.0/24
- 47.52.144.0/24
- 47.52.145.0/24
- 47.52.146.0/24
- 47.52.147.0/24
- 47.52.148.0/24
- 47.52.149.0/24
- 47.52.150.0/24
- 47.52.151.0/24
- 47.52.152.0/24
- 47.52.153.0/24
- 47.52.154.0/24
- 47.52.155.0/24
- 47.52.156.0/24
- 47.52.157.0/24
- 47.52.158.0/24
- 47.52.159.0/24
- 47.52.160.0/24
- 47.52.161.0/24
- 47.52.162.0/24
- 47.52.163.0/24
- 47.52.164.0/24
- 47.52.165.0/24
- 47.52.166.0/24
- 47.52.167.0/24
- 47.52.168.0/24
- 47.52.169.0/24
- 47.52.170.0/24
- 47.52.171.0/24
- 47.52.172.0/24
- 47.52.173.0/24
- 47.52.174.0/24
- 47.52.175.0/24
- 47.52.188.0/24
- 47.52.190.0/24
- 47.52.191.0/24
- 47.52.192.0/24
- 47.52.193.0/24
- 47.52.194.0/24
- 47.52.195.0/24
- 47.52.196.0/24
- 47.52.197.0/24
- 47.52.198.0/24
- 47.52.199.0/24
- 47.52.200.0/24
- 47.52.201.0/24
- 47.52.202.0/24
- 47.52.203.0/24
- 47.52.204.0/24
- 47.52.205.0/24
- 47.52.206.0/24
- 47.52.207.0/24
- 47.52.208.0/24
- 47.52.209.0/24
- 47.52.224.0/24
- 47.52.225.0/24
- 47.52.226.0/24
- 47.52.228.0/24
- 47.52.230.0/24
- 47.52.231.0/24
- 47.52.232.0/24
- 47.52.234.0/24
- 47.52.235.0/24
- 47.52.236.0/24
- 47.52.241.0/24
- 47.52.242.0/24
- 47.52.244.0/24
- 47.52.246.0/24
- 47.52.247.0/24
- 47.52.248.0/24
- 47.52.249.0/24
- 47.52.250.0/24
- 47.52.251.0/24
- 47.52.252.0/24
- 47.52.253.0/24
- 47.52.254.0/24
- 47.52.255.0/24
- 47.74.1.0/24
- 47.75.3.0/24
- 47.75.5.0/24
- 47.75.94.0/24
- 47.75.98.0/24
- 47.75.143.0/24
- 47.75.194.0/24
- 47.75.207.0/24
- 47.75.219.0/24
- 47.89.8.0/24
- 47.89.9.0/24
- 47.89.10.0/24
- 47.89.11.0/24
- 47.89.12.0/24
- 47.89.13.0/24
- 47.89.14.0/24
- 47.89.15.0/24
- 47.89.16.0/24
- 47.89.17.0/24
- 47.89.18.0/24
- 47.89.19.0/24
- 47.89.20.0/24
- 47.89.21.0/24
- 47.89.22.0/24
- 47.89.23.0/24
- 47.90.8.0/24
- 47.90.90.0/24
- 47.90.96.0/24
- 47.90.97.0/24
- 47.90.98.0/24
- 47.90.99.0/24
- 47.90.100.0/24
- 47.90.101.0/24
- 47.90.102.0/24
- 47.90.103.0/24
- 47.90.120.0/24
- 47.90.121.0/24
- 47.90.122.0/24
- 47.90.123.0/24
- 47.90.124.0/24
- 47.90.125.0/24
- 47.90.126.0/24
- 47.90.127.0/24
- 47.90.214.0/24
- 47.91.152.0/24
- 47.91.153.0/24
- 47.91.154.0/24
- 47.91.155.0/24
- 47.91.156.0/24
- 47.91.157.0/24
- 47.91.158.0/24
- 47.91.159.0/24
- 47.91.207.0/24
- 47.91.208.0/24
- 47.91.209.0/24
- 47.91.210.0/24
- 47.91.211.0/24
- 47.91.212.0/24
- 47.91.213.0/24
- 47.91.214.0/24
- 47.91.215.0/24
- 47.91.216.0/24
- 47.91.217.0/24
- 47.91.218.0/24
- 47.91.219.0/24
- 47.91.220.0/24
- 47.91.221.0/24
- 47.91.224.0/24
- 47.91.225.0/24
- 47.91.226.0/24
- 47.91.227.0/24
- 47.91.228.0/24
- 47.91.229.0/24
- 47.91.230.0/24
- 47.91.231.0/24
- 47.91.232.0/24
- 47.91.233.0/24
- 47.91.234.0/24
- 47.91.235.0/24
- 47.91.236.0/24
- 47.91.237.0/24
- 47.91.238.0/24
- 47.91.239.0/24
- 47.91.240.0/24
- 47.91.241.0/24
- 47.91.242.0/24
- 47.91.243.0/24
- 47.91.244.0/24
- 47.91.245.0/24
- 47.91.246.0/24
- 47.91.247.0/24
- 47.91.248.0/24
- 47.91.249.0/24
- 47.91.250.0/24
- 47.91.251.0/24
- 47.91.252.0/24
- 47.91.253.0/24
- 47.91.254.0/24
- 47.91.255.0/24
- 47.96.0.0/16
- 47.96.2.0/24
- 47.96.3.0/24
- 47.96.5.0/24
- 47.96.6.0/24
- 47.96.7.0/24
- 47.96.8.0/24
- 47.96.9.0/24
- 47.96.10.0/24
- 47.96.12.0/24
- 47.96.13.0/24
- 47.96.14.0/24
- 47.99.33.0/24
- 47.99.38.0/24
- 47.99.44.0/24
- 47.99.62.0/24
- 47.99.73.0/24
- 47.99.75.0/24
- 47.99.76.0/24
- 47.99.81.0/24
- 47.99.84.0/24
- 47.99.89.0/24
- 47.99.90.0/24
- 47.99.93.0/24
- 47.99.95.0/24
- 47.99.98.0/24
- 47.99.99.0/24
- 47.99.101.0/24
- 47.99.103.0/24
- 47.99.104.0/24
- 47.99.107.0/24
- 47.99.111.0/24
- 47.99.120.0/24
- 47.99.128.0/24
- 47.99.159.0/24
- 47.99.161.0/24
- 47.99.164.0/24
- 47.99.166.0/24
- 47.99.169.0/24
- 47.110.42.0/24
- 47.244.1.0/24
- 47.244.2.0/24
- 47.244.3.0/24
- 47.244.5.0/24
- 47.244.7.0/24
- 47.244.10.0/24
- 47.244.11.0/24
- 47.244.12.0/24
- 47.244.13.0/24
- 47.244.14.0/24
- 47.244.15.0/24
- 47.244.16.0/24
- 47.244.17.0/24
- 47.244.18.0/24
- 47.244.19.0/24
- 47.244.21.0/24
- 47.244.22.0/24
- 47.244.24.0/24
- 47.244.25.0/24
- 47.244.26.0/24
- 47.244.33.0/24
- 47.244.35.0/24
- 47.244.36.0/24
- 47.244.37.0/24
- 47.244.43.0/24
- 47.244.44.0/24
- 47.244.48.0/24
- 47.244.51.0/24
- 47.244.56.0/24
- 52.53.89.0/24
- 52.63.114.0/24
- 52.64.199.0/24
- 52.90.185.0/24
- 52.175.16.0/24
- 52.175.31.0/24
- 52.207.236.0/24
- 52.229.154.0/24
- 52.229.160.0/24
- 52.229.161.0/24
- 54.66.223.0/24
- 54.158.198.0/24
- 54.164.19.0/24
- 54.169.27.0/24
- 54.209.147.0/24
- 58.153.0.0/16
- 58.153.19.0/24
- 58.153.171.0/24
- 58.153.208.0/24
- 58.153.209.0/24
- 58.153.221.0/24
- 58.176.80.0/24
- 58.177.181.0/24
- 58.215.54.0/24
- 58.221.252.0/24
- 59.16.249.0/24
- 59.127.115.0/24
- 59.149.239.0/24
- 60.248.89.0/24
- 61.80.89.0/24
- 61.84.148.0/24
- 61.155.210.0/24
- 61.216.2.0/24
- 61.216.34.0/24
- 61.216.146.0/24
- 61.238.35.0/24
- 61.239.213.0/24
- 61.239.223.0/24
- 74.91.112.0/24
- 74.201.99.0/24
- 87.98.228.0/24
- 88.82.185.0/24
- 90.188.238.0/24
- 94.245.155.0/24
- 95.154.88.0/24
- 95.154.113.0/24
- 95.172.92.0/24
- 95.183.13.0/24
- 103.9.89.0/24
- 103.10.124.0/24
- 103.10.125.0/24
- 103.16.27.0/24
- 103.28.54.0/24
- 103.28.55.0/24
- 103.36.208.0/24
- 103.44.160.0/24
- 103.57.72.0/24
- 103.58.149.0/24
- 103.60.126.0/24
- 103.62.48.0/24
- 103.89.90.0/24
- 103.207.36.0/24
- 103.222.20.0/24
- 103.231.163.0/24
- 103.232.85.0/24
- 103.241.165.0/24
- 103.244.2.0/24
- 103.254.153.0/24
- 104.199.166.0/24
- 104.236.115.0/24
- 107.21.14.0/24
- 110.42.10.0/24
- 110.173.58.0/24
- 111.91.236.0/24
- 111.231.11.0/24
- 111.253.47.0/24
- 111.253.49.0/24
- 111.253.50.0/24
- 111.253.52.0/24
- 111.253.55.0/24
- 112.118.44.0/24
- 112.118.193.0/24
- 113.160.204.0/24
- 113.190.242.0/24
- 114.46.16.0/24
- 114.46.20.0/24
- 114.46.21.0/24
- 114.46.22.0/24
- 114.46.24.0/24
- 114.46.30.0/24
- 114.167.236.0/24
- 115.230.127.0/24
- 115.231.221.0/24
- 115.231.223.0/24
- 116.31.123.0/24
- 116.49.214.0/24
- 116.122.109.0/24
- 116.251.223.0/24
- 118.107.76.0/24
- 119.28.222.0/24
- 119.197.57.0/24
- 119.236.132.0/24
- 119.237.11.0/24
- 120.72.85.0/24
- 123.31.20.0/24
- 123.194.52.0/24
- 124.158.10.0/24
- 124.228.91.0/24
- 125.212.211.0/24
- 125.212.226.0/24
- 125.226.128.0/24
- 125.253.124.0/24
- 128.199.81.0/24
- 132.232.7.0/24
- 132.232.9.0/24
- 132.232.12.0/24
- 132.232.29.0/24
- 132.232.51.0/24
- 132.232.55.0/24
- 132.232.57.0/24
- 132.232.61.0/24
- 132.232.62.0/24
- 132.232.75.0/24
- 132.232.91.0/24
- 132.232.94.0/24
- 132.232.99.0/24
- 132.232.104.0/24
- 133.130.123.0/24
- 138.19.63.0/24
- 139.99.9.0/24
- 139.99.104.0/24
- 139.99.119.0/24
- 139.162.55.0/24
- 146.66.152.0/24
- 146.66.153.0/24
- 146.66.154.0/24
- 146.66.155.0/24
- 146.66.156.0/24
- 146.66.157.0/24
- 146.66.158.0/24
- 146.66.159.0/24
- 150.109.40.0/24
- 151.80.60.0/24
- 151.80.145.0/24
- 152.111.192.0/24
- 153.160.25.0/24
- 153.254.86.0/24
- 155.133.227.0/24
- 155.133.230.0/24
- 155.133.232.0/24
- 155.133.233.0/24
- 155.133.235.0/24
- 155.133.238.0/24
- 155.133.239.0/24
- 155.133.242.0/24
- 155.133.244.0/24
- 155.133.245.0/24
- 155.133.246.0/24
- 155.133.247.0/24
- 155.133.248.0/24
- 155.133.249.0/24
- 155.133.252.0/24
- 155.133.253.0/24
- 155.133.254.0/24
- 159.28.159.0/24
- 161.202.44.0/24
- 162.254.192.0/24
- 162.254.193.0/24
- 162.254.194.0/24
- 162.254.195.0/24
- 162.254.196.0/24
- 162.254.197.0/24
- 162.254.198.0/24
- 162.254.199.0/24
- 163.53.149.0/24
- 169.254.0.0/16
- 169.254.125.95/32
- 169.254.10.218/32
- 175.210.83.0/24
- 176.215.255.0/24
- 180.149.95.0/24
- 180.177.178.0/24
- 182.171.230.0/24
- 182.176.65.0/24
- 183.60.111.0/24
- 183.179.66.0/24
- 185.25.60.0/24
- 185.25.180.0/24
- 185.25.181.0/24
- 185.25.182.0/24
- 185.25.183.0/24
- 185.37.216.0/24
- 185.62.205.0/24
- 185.113.141.0/24
- 190.217.33.0/24
- 192.69.96.0/24
- 192.69.97.0/24
- 193.33.176.0/24
- 195.14.118.0/24
- 195.201.246.0/24
- 196.38.180.0/24
- 197.80.200.0/24
- 198.27.83.0/24
- 202.21.115.0/24
- 203.175.163.0/24
- 203.175.164.0/24
- 203.175.165.0/24
- 203.175.166.0/24
- 203.218.101.0/24
- 205.185.194.0/24
- 205.196.6.0/24
- 208.64.200.0/24
- 208.64.203.0/24
- 208.78.164.0/24
- 208.78.165.0/24
- 208.78.166.0/24
- 209.58.164.0/24
- 209.58.168.0/24
- 209.58.178.0/24
- 209.58.188.0/24
- 210.211.124.0/24
- 211.21.37.0/24
- 211.48.69.0/24
- 211.75.181.0/24
- 212.64.32.0/24
- 216.52.148.0/24
- 217.150.77.0/24
- 218.250.12.0/24
- 218.250.15.0/24
- 218.250.113.0/24
- 218.255.3.0/24
- 220.80.129.0/24
- 220.134.154.0/24
- 220.135.180.0/24
- 220.169.242.0/24
- 220.170.89.0/24
- 221.6.100.0/24
- 222.102.95.0/24
- 222.112.242.0/24
- 222.186.50.0/24
- 222.187.224.0/24
- 224.0.0.0/4
- 240.0.0.0/4
@@ -0,0 +1,294 @@
payload:
- 2.16.0.0/16
- 2.17.0.0/16
- 2.18.0.0/16
- 2.19.0.0/16
- 2.20.0.0/16
- 2.21.0.0/16
- 2.22.0.0/16
- 2.23.0.0/16
- 8.7.0.0/16
- 14.21.0.0/16
- 23.0.0.0/4
- 23.1.0.0/16
- 23.2.0.0/16
- 23.3.0.0/16
- 23.4.0.0/16
- 23.5.0.0/16
- 23.7.0.0/16
- 23.8.0.0/16
- 23.9.0.0/16
- 23.11.0.0/16
- 23.12.0.0/16
- 23.13.0.0/16
- 23.14.0.0/16
- 23.15.0.0/16
- 23.32.0.0/16
- 23.33.0.0/16
- 23.34.0.0/16
- 23.35.0.0/16
- 23.36.0.0/16
- 23.37.0.0/16
- 23.38.0.0/16
- 23.39.0.0/16
- 23.40.0.0/16
- 23.41.0.0/16
- 23.42.0.0/16
- 23.44.0.0/16
- 23.45.0.0/16
- 23.46.0.0/16
- 23.48.0.0/16
- 23.49.0.0/16
- 23.50.0.0/16
- 23.51.0.0/16
- 23.52.0.0/16
- 23.53.0.0/16
- 23.54.0.0/16
- 23.55.0.0/16
- 23.56.0.0/16
- 23.57.0.0/16
- 23.58.0.0/16
- 23.59.0.0/16
- 23.60.0.0/16
- 23.61.0.0/16
- 23.62.0.0/16
- 23.63.0.0/16
- 23.64.0.0/16
- 23.65.0.0/16
- 23.67.0.0/16
- 23.72.0.0/16
- 23.73.0.0/16
- 23.74.0.0/16
- 23.75.0.0/16
- 23.76.0.0/16
- 23.77.0.0/16
- 23.78.0.0/16
- 23.79.0.0/16
- 23.192.0.0/16
- 23.193.0.0/16
- 23.194.0.0/16
- 23.196.0.0/16
- 23.197.0.0/16
- 23.198.0.0/16
- 23.199.0.0/16
- 23.200.0.0/16
- 23.201.0.0/16
- 23.202.0.0/16
- 23.203.0.0/16
- 23.204.0.0/16
- 23.205.0.0/16
- 23.206.0.0/16
- 23.207.0.0/16
- 23.208.0.0/16
- 23.209.0.0/16
- 23.210.0.0/16
- 23.211.0.0/16
- 23.212.0.0/16
- 23.213.0.0/16
- 23.214.0.0/16
- 23.215.0.0/16
- 23.216.0.0/16
- 23.217.0.0/16
- 23.218.0.0/16
- 23.219.0.0/16
- 23.220.0.0/16
- 23.221.0.0/16
- 23.222.0.0/16
- 23.223.0.0/16
- 31.0.0.0/4
- 31.13.0.0/16
- 37.10.0.0/16
- 45.121.0.0/16
- 45.121.184.0/24
- 45.121.186.0/24
- 46.0.0.0/4
- 59.0.0.0/4
- 60.254.0.0/16
- 61.213.0.0/16
- 63.146.0.0/16
- 63.219.0.0/16
- 63.243.0.0/16
- 64.0.0.0/4
- 64.124.0.0/16
- 65.152.0.0/16
- 65.158.0.0/16
- 66.0.0.0/4
- 67.0.0.0/4
- 67.131.0.0/16
- 69.0.0.0/4
- 69.16.0.0/16
- 69.63.0.0/16
- 69.171.0.0/16
- 69.192.0.0/16
- 72.165.0.0/16
- 72.246.0.0/16
- 72.247.0.0/16
- 74.0.0.0/4
- 74.86.0.0/16
- 74.201.0.0/16
- 75.0.0.0/4
- 75.126.0.0/16
- 78.16.0.0/16
- 84.53.0.0/16
- 85.190.0.0/16
- 88.0.0.0/4
- 88.221.0.0/16
- 92.122.0.0/16
- 92.123.0.0/16
- 95.100.0.0/16
- 95.101.0.0/16
- 96.0.0.0/4
- 96.6.0.0/16
- 96.16.0.0/16
- 96.17.0.0/16
- 103.10.124.0/24
- 103.28.0.0/16
- 103.28.54.0/24
- 103.74.0.0/16
- 104.0.0.0/4
- 104.65.0.0/16
- 104.66.0.0/16
- 104.67.0.0/16
- 104.68.0.0/16
- 104.70.0.0/16
- 104.71.0.0/16
- 104.72.0.0/16
- 104.73.0.0/16
- 104.75.0.0/16
- 104.76.0.0/16
- 104.77.0.0/16
- 104.79.0.0/16
- 104.80.0.0/16
- 104.81.0.0/16
- 104.82.0.0/16
- 104.83.0.0/16
- 104.84.0.0/16
- 104.85.0.0/16
- 104.86.0.0/16
- 104.87.0.0/16
- 104.89.0.0/16
- 104.90.0.0/16
- 104.91.0.0/16
- 104.92.0.0/16
- 104.94.0.0/16
- 104.95.0.0/16
- 104.97.0.0/16
- 104.98.0.0/16
- 104.100.0.0/16
- 104.101.0.0/16
- 104.102.0.0/16
- 104.103.0.0/16
- 104.104.0.0/16
- 104.105.0.0/16
- 104.106.0.0/16
- 104.107.0.0/16
- 104.108.0.0/16
- 104.109.0.0/16
- 104.110.0.0/16
- 104.111.0.0/16
- 104.112.0.0/16
- 104.113.0.0/16
- 104.115.0.0/16
- 104.116.0.0/16
- 104.117.0.0/16
- 104.118.0.0/16
- 104.119.0.0/16
- 104.120.0.0/16
- 104.121.0.0/16
- 104.122.0.0/16
- 104.123.0.0/16
- 104.124.0.0/16
- 104.126.0.0/16
- 104.127.0.0/16
- 106.15.0.0/16
- 110.45.0.0/16
- 115.223.0.0/16
- 117.103.0.0/16
- 118.155.0.0/16
- 118.214.0.0/16
- 118.215.0.0/16
- 120.24.184.25/32
- 121.156.0.0/16
- 122.252.0.0/16
- 125.56.0.0/16
- 125.252.0.0/16
- 128.241.0.0/16
- 139.175.0.0/16
- 141.0.0.0/4
- 146.66.0.0/16
- 152.199.0.0/16
- 153.254.0.0/16
- 153.254.86.0/24
- 155.133.0.0/16
- 155.133.232.0/24
- 155.133.233.0/24
- 155.133.234.0/24
- 155.133.235.0/24
- 155.133.239.0/24
- 155.133.244.0/24
- 155.133.253.0/24
- 155.133.254.0/24
- 162.254.0.0/16
- 162.254.192.0/24
- 162.254.193.0/24
- 162.254.194.0/24
- 162.254.199.0/24
- 165.254.0.0/16
- 172.0.0.0/4
- 172.224.0.0/16
- 172.226.0.0/16
- 172.227.0.0/16
- 172.228.0.0/16
- 172.229.0.0/16
- 172.230.0.0/16
- 172.231.0.0/16
- 173.0.0.0/4
- 173.197.0.0/16
- 173.205.0.0/16
- 173.222.0.0/16
- 173.223.0.0/16
- 173.252.0.0/16
- 174.36.0.0/16
- 175.99.0.0/16
- 175.139.0.0/16
- 180.101.192.0/24
- 182.162.0.0/16
- 184.0.0.0/4
- 184.24.0.0/16
- 184.25.0.0/16
- 184.26.0.0/16
- 184.29.0.0/16
- 184.30.0.0/16
- 184.31.0.0/16
- 184.50.0.0/16
- 184.51.0.0/16
- 184.84.0.0/16
- 184.85.0.0/16
- 184.87.0.0/16
- 185.25.0.0/16
- 185.27.0.0/16
- 185.88.0.0/16
- 192.69.96.0/24
- 192.81.0.0/16
- 198.87.0.0/16
- 198.172.0.0/16
- 199.0.0.0/4
- 199.239.0.0/16
- 203.69.0.0/16
- 203.80.149.0/24
- 205.186.0.0/16
- 205.196.6.0/24
- 205.197.0.0/16
- 208.0.0.0/4
- 208.64.0.0/16
- 208.64.200.0/24
- 208.78.0.0/16
- 208.78.164.0/24
- 208.78.166.0/24
- 208.78.167.0/24
- 209.170.0.0/16
- 210.61.0.0/16
- 210.201.0.0/16
- 216.3.0.0/16
- 216.156.0.0/16
- 223.119.0.0/16
@@ -0,0 +1,133 @@
payload:
- 96.7.54.0/24
- 96.17.68.0/24
- 95.101.58.0/24
- 92.123.234.0/24
- 72.249.197.0/24
- 72.247.118.0/24
- 75.126.208.0/20
- 69.192.4.0/24
- 61.213.189.0/24
- 61.213.168.0/24
- 23.9.186.0/24
- 23.9.179.0/24
- 23.9.117.0/24
- 23.77.27.0/24
- 23.77.18.0/24
- 23.76.210.0/24
- 23.75.104.0/24
- 23.67.53.0/24
- 23.67.189.0/24
- 23.66.135.0/24
- 23.62.226.0/24
- 23.61.244.0/24
- 23.61.195.0/24
- 23.57.66.0/24
- 23.56.108.0/24
- 23.55.56.0/24
- 23.55.47.0/24
- 23.55.37.0/24
- 23.52.74.0/24
- 23.52.171.0/24
- 23.50.232.0/24
- 23.5.229.0/24
- 23.48.201.0/24
- 23.47.143.0/24
- 23.46.16.0/24
- 23.46.147.0/24
- 23.45.51.0/24
- 23.45.127.0/24
- 23.44.51.0/24
- 23.44.172.0/24
- 23.44.17.0/24
- 23.43.49.0/24
- 23.42.74.0/24
- 23.37.126.0/24
- 23.36.111.0/24
- 23.34.96.0/24
- 23.33.178.0/24
- 23.33.151.0/24
- 23.32.255.0/24
- 23.32.248.0/24
- 23.32.241.0/24
- 23.219.172.0/24
- 23.218.94.0/24
- 23.218.5.0/24
- 23.218.24.0/24
- 23.215.188.0/24
- 23.211.136.0/24
- 23.211.117.0/24
- 23.211.108.0/24
- 23.210.215.0/24
- 23.204.57.0/24
- 23.204.147.0/24
- 23.200.74.0/24
- 23.2.16.0/24
- 23.199.34.0/24
- 23.198.137.0/24
- 23.198.136.0/24
- 23.198.103.0/24
- 23.192.168.0/24
- 23.192.119.0/24
- 23.15.4.0/24
- 23.12.40.0/24
- 23.1.237.0/24
- 23.1.236.0/24
- 23.1.234.0/24
- 23.7.208.0/20
- 223.119.50.0/24
- 223.119.248.0/24
- 220.90.198.0/24
- 219.76.10.0/24
- 203.74.140.0/24
- 203.69.141.0/24
- 202.4.185.0/24
- 2.21.98.0/24
- 2.20.27.0/24
- 189.6.45.0/24
- 184.87.133.0/24
- 184.86.250.0/24
- 184.51.198.0/24
- 184.51.183.0/24
- 184.50.26.0/24
- 184.31.165.0/24
- 184.28.223.0/24
- 184.28.218.0/24
- 184.27.20.0/24
- 184.26.194.0/24
- 184.24.58.0/24
- 184.150.58.0/24
- 184.150.154.0/24
- 175.207.14.0/24
- 172.217.0.0/16
- 172.232.19.0/24
- 139.175.236.0/24
- 125.56.201.0/24
- 125.252.224.0/24
- 119.56.4.0/24
- 119.207.66.0/24
- 119.207.64.0/24
- 104.88.23.0/24
- 104.84.150.0/24
- 104.84.160.0/19
- 104.81.21.0/24
- 104.76.86.0/24
- 104.76.172.0/24
- 104.75.169.0/24
- 104.74.47.0/24
- 104.74.30.0/24
- 104.74.214.0/24
- 104.74.209.0/24
- 104.71.139.0/24
- 104.64.155.0/24
- 104.250.32.0/23
- 104.254.123.0/24
- 104.127.4.0/24
- 104.124.248.0/24
- 104.124.233.0/24
- 104.124.232.0/24
- 104.122.6.0/24
- 104.120.11.0/24
- 104.116.243.0/24
- 104.110.72.0/24
- 153.254.86.0/24
@@ -0,0 +1,287 @@
# ==========================================================
# ==== 以下为可设置的插件配置参数 ====
# ==========================================================
# CONFIG_FILE (原始配置文件路径)
# CORE_TYPE (核心类型 Smart or Meta)
# --- 网络与接口 ---
# LAN_INTERFACE_NAME (LAN 接口名称)
# INTERFACE_NAME (绑定 wan 接口的名称)
# --- 控制面板相关 ---
# CN_PORT (控制面板端口)
# DA_PASSWORD (控制面板访问密码)
# --- 端口相关 ---
# PROXY_PORT (Redir代理端口)
# TPROXY_PORT (TPROXY代理端口)
# HTTP_PORT (HTTP 代理端口)
# SOCKS_PORT (SOCKS 代理端口)
# MIXED_PORT (混合代理端口)
# DNS_PORT (DNS 监听端口)
# --- DNS 相关 ---
# ENABLE_REDIRECT_DNS (DNS 重定向模式,0:禁用,1:Dnsmasq Redirect, 2:Firewall Redirect)
# ENABLE_CUSTOM_DNS (自定义 DNS, 0: 插件不覆写, 1: 启用,使用插件内置规则)
# APPEND_DEFAULT_DNS (自动追加 default-nameserver DNS, 0: 插件不覆写, 1: 启用)
# APPEND_WAN_DNS (追加上游分配 DNS, 0: 插件不覆写, 1: 启用)
# STORE_FAKEIP (启用 fake-ip 缓存, 0: 插件不覆写, 1: 启用)
# CUSTOM_FAKEIP_FILTER (启用 Fake-IP-Filter, 0: 插件不覆写, 1: 启用,使用插件内置规则)
# CUSTOM_FAKEIP_FILTER_MODE (Fake-IP 过滤模式, blacklist/whitelist)
# FAKEIP_RANGE (自定义 Fake-IP 地址段, 如 198.18.0.1/16)
# ENABLE_RESPECT_RULES (DNS 查询是否遵循规则, 0: 插件不覆写, 1: 启用)
# CUSTOM_NAME_POLICY (自定义 Nameserver-Policy, 0: 插件不覆写, 1: 启用,使用插件内置规则)
# CUSTOM_HOST (自定义 Hosts, 0: 插件不覆写, 1: 启用,使用插件内置规则)
# CUSTOM_FALLBACK_FILTER (自定义 Fallback-Filter, 0: 插件不覆写, 1: 启用,使用插件内置规则)
# --- IPv6 相关 ---
# IPV6_ENABLE (启用 IPv6,0: 禁用, 1: 启用)
# IPV6_DNS (启用 IPv6 DNS,0: 禁用, 1: 启用)
# IPV6_MODE (IPv6 代理模式, 0: TProxy Mode, 1: Redirect Mode, 2: TUN Mode, 3: Mix Mode)
# ENABLE_V6_UDP_PROXY (启用 IPv6 UDP 代理,0: 禁用, 1: 启用, only for Redirect Mode and Redirect Mode)
# --- 代理与模式 ---
# EN_MODE (插件运行模式:fake-ip/fake-ip-tun/fake-ip-mix or redir-host/redir-host-tun/redir-host-mix)
# ENABLE_UDP_PROXY (启用 UDP 代理, 0: 禁用, 1: 启用, only for EN_MODE_TUN is nil)
# DISABLE_UDP_QUIC (禁用 UDP QUIC, 0: 启用, 1: 禁用)
# ROUTER_SELF_PROXY (路由器自身代理, 0: 禁用, 1: 启用)
# STACK_TYPE (TUN 网络栈类型, system/gvisor/mixed, default is system)
# PROXY_MODE (代理模式, rule/global/direct, default is rule)
# --- 防火墙与访问控制 ---
# INTRANET_ALLOWED (仅允许内网访问, 0: 禁用, 1: 启用)
# INTRANET_ALLOWED_WAN_NAME (仅允许内网时 WAN 接口列表名称)
# BYPASS_GATEWAY_COMPATIBLE (旁路网关兼容模式, 0: 禁用, 1: 启用)
# COMMON_PORTS (绕过常用端口的端口列表, 0: 禁用 or "21 22 23 53 80 123 143 194 443 465 587 853 993 995 998 2052 2053 2082 2083 2086 2095 2096 5222 5228 5229 5230 8080 8443 8880 8888 8889")
# --- 分流相关 ---
# CHINA_IP_ROUTE (IPv4 绕过 IP 模式, 0: 禁用, 1: 绕过大陆, 2: 回国)
# CHINA_IP6_ROUTE (IPv6 绕过 IP 模式, 0: 禁用, 1: 绕过大陆, 2: 回国)
# CHNR_AUTO_UPDATE (大陆IP自动更新, 0: 禁用, 1: 启用)
# CHNR_UPDATE_WEEK_TIME (大陆IP更新星期, 0-6 or *, 0代表星期天, *代表每天, default 0)
# CHNR_UPDATE_DAY_TIME (大陆IP更新小时, 0-23 or *, default 1)
# CHNR_CUSTOM_URL (大陆IP列表自定义更新地址, URL or default)
# CHNR6_CUSTOM_URL (大陆IPv6列表自定义更新地址, URL or default)
# CHINA_IP_ROUTE_PASS (绕过大陆 IP 时排除类别, 域名、IP or 插件内置规则, eg: services.googleapis.cn googleapis.cn 114.114.114.114)
# CHINA_IP6_ROUTE_PASS (绕过大陆 IPv6 时排除类别, 域名、IP or 插件内置规则)
# ENABLE_META_SNIFFER (启用域名嗅探, 0: 插件不覆写, 1: 启用)
# ENABLE_META_SNIFFER_CUSTOM (启用自定义嗅探规则, 0: 插件不覆写, 1: 启用,使用插件内置规则)
# ENABLE_META_SNIFFER_PURE_IP (强制嗅探纯 IP 连接, 0: 插件不覆写, 1: 启用)
# ENABLE_TCP_CONCURRENT (启用 TCP 并发, 0: 插件不覆写, 1: 启用)
# FIND_PROCESS_MODE (进程查找模式, 0: 插件不覆写, off: 关闭, always, strict)
# GLOBAL_CLIENT_FINGERPRINT (全局客户端指纹, none/random/chrome/firefox/safari/ios/android/edge/360/qq/0: 插件不覆写)
# ENABLE_UNIFIED_DELAY (启用统一延迟计算, 0: 插件不覆写, 1: 启用)
# ENABLE_RULE_PROXY (仅代理命中规则流量, 0: 禁用, 1: 启用)
# ENABLE_CUSTOM_CLASH_RULES (启用用户自定义规则, 0: 禁用, 1: 启用,使用插件规则)
# TOLERANCE (URL-Test 策略组切换灵敏度, 毫秒数 or default 0 不覆写)
# URLTEST_INTERVAL_MOD (测速(连通性)间隔修改, 秒数 or default 0 不覆写)
# URLTEST_ADDRESS_MOD (测速(连通性)地址修改, URL or default 0 不覆写)
# GITHUB_ADDRESS_MOD (GitHub 地址修改, URL or default 0 不覆写)
# --- Smart 相关 ---
# AUTO_SMART_SWITCH (启用 Smart 自动切换, 0: 插件不覆写, 1: 启用)
# SMART_ENABLE_LGBM (启用 LightGBM 模型, 0: 插件不覆写, 1: 启用)
# SMART_POLICY_PRIORITY (节点权重加成, 正则或字符,格式:Premium:0.9;SG:1.3)
# SMART_PREFER_ASN (强制查找并使用 ASN 信息, 0: 插件不覆写, 1: 启用)
# SMART_COLLECT (模型训练数据收集, 0: 插件不覆写, 1: 启用)
# SMART_COLLECT_SIZE (模型训练数据收集的文件大小, MB, 数值 or default 100)
# SMART_COLLECT_RATE (模型训练数据收集的采样率, 0-1 or default 1)
# LGBM_AUTO_UPDATE (LGBM 模型自动更新, 0: 插件不覆写, 1: 启用)
# LGBM_UPDATE_INTERVAL (LGBM 模型更新间隔, 小时数 or default 72)
# LGBM_CUSTOM_URL (LGBM 模型自定义下载 URL (URL 地址 or default)
# --- 数据库加载相关 ---
# ENABLE_GEOIP_DAT (启用 GEOIP DAT 数据库, 0: 插件不覆写, 1: 启用)
# GEODATA_LOADER (Geo 数据加载模式, memconservative/standard/0: 插件不覆写)
# GEO_AUTO_UPDATE (GeoIP MMDB 数据自动更新, 0: 禁用, 1: 启用)
# GEO_UPDATE_WEEK_TIME (GeoIP MMDB 数据更新日, 0-6 or *, 0代表星期天, *代表每天, default 0)
# GEO_UPDATE_DAY_TIME (GeoIP MMDB 数据更新小时, 0-23 or *, default 1)
# GEO_CUSTOM_URL (GeoIP MMDB 数据自定义更新地址, URL or default)
# GEOIP_AUTO_UPDATE (GeoIP Dat 数据自动更新, 0: 禁用, 1: 启用)
# GEOIP_UPDATE_WEEK_TIME (GeoIP Dat 数据更新日, 0-6 or *, 0代表星期天, *代表每天, default 0)
# GEOIP_UPDATE_DAY_TIME (GeoIP Dat 数据更新小时, 0-23 or *, default 1)
# GEOIP_CUSTOM_URL (GeoIP Dat 数据自定义更新地址, URL or default)
# GEOSITE_AUTO_UPDATE (GeoSite 数据自动更新, 0: 禁用, 1: 启用)
# GEOSITE_UPDATE_WEEK_TIME (GeoSite 数据更新日, 0-6 or *, 0代表星期天, *代表每天, default 0)
# GEOSITE_UPDATE_DAY_TIME (GeoSite 数据更新小时, 0-23 or *, default 1)
# GEOSITE_CUSTOM_URL (GeoSite 数据自定义更新地址, URL or default)
# GEOASN_AUTO_UPDATE (GeoASN 数据自动更新, 0: 禁用, 1: 启用)
# GEOASN_UPDATE_WEEK_TIME (GeoASN 数据更新日, 0-6 or *, 0代表星期天, *代表每天, default 0)
# GEOASN_UPDATE_DAY_TIME (GeoASN 数据更新小时, 0-23 or *, default 1)
# GEOASN_CUSTOM_URL (GeoASN 数据自定义更新地址, URL or default)
# --- 其它功能 ---
# SMALL_FLASH_MEMORY (小闪存模式, 0: 禁用, 1: 启用)
# DISABLE_QUIC_GO_GSO (禁用 QUIC GO GSO, 0: 插件不覆写, 1: 启用)
# DELAY_START (延时启动, 0: 禁用 or 秒数)
# SKIP_PROXY_ADDRESS (跳过代理地址, 0: 禁用, 1: 启用)
# SUB_INFO_URL (订阅信息 URL)
# DOWNLOAD_FILE (下载外部文件到指定路径, need URL and path)
# RESTART (模块更新后重启插件, true: 启用, false: 禁用)
# =========================
# ==========================================================
# ==== 以下为调用外部第三方模板作为配置文件示例,用户需在添加模块时设置指定环境变量,可以不再需要进行大部分插件设置 ====
# ==========================================================
#[General]
#EN_MODE = fake-ip-mix
#DISABLE_UDP_QUIC = 1
#ROUTER_SELF_PROXY = 1
#CHINA_IP_ROUTE = 1
#DISABLE_QUIC_GO_GSO = 1
#CORE_TYPE = Smart
#ENABLE_REDIRECT_DNS = 1
#IPV6_ENABLE = 0
#IPV6_DNS = 0
#CHINA_IP6_ROUTE = 0
#restart: true 代表更新后重启插件,false 代表不重启插件
#force: true 代表强制下载,false 代表不强制下载(当文件不存在时会自动下载)
#ua: 下载时使用的User-Agent,默认不设置
#cron: 定时下载时间,格式为标准的 cron 表达式,0 代表不启用定时下载
#示例:每天凌晨6点下载一次
#cron=0 6 * * *
#示例:每周一凌晨6点下载一次
#cron=0 6 * * 1
#DOWNLOAD_FILE = url=https://git.imee.me/https://github.com/666OS/YYDS/raw/main/mihomo/config/OneSmartPro.yaml, path=/etc/openclash/config/OneSmartPro.yaml, cron=0 6 * * *, force=false
#将模板作为默认配置文件
#CONFIG_FILE = /etc/openclash/config/OneSmartPro.yaml
#指定展示订阅信息的 URL 地址
#SUB_INFO_URL = $EN_KEY1
#[Overwrite]
#EN_KEY 为对应模块需要用户指定的环境变量值, EN_KEY1=URL1;EN_KEY2=URL2;EN_KEY3=URL3
#其他 Ruby 编辑函数请参考 openclash_custom_overwrite.sh
#ruby_map_edit "$CONFIG_FILE" "['proxy-providers']" "优质服务商" "['url']" "$EN_KEY1"
#ruby_map_edit "$CONFIG_FILE" "['proxy-providers']" "备用服务商" "['url']" "$EN_KEY2"
#ruby_map_edit "$CONFIG_FILE" "['proxy-providers']" "落地服务商" "['url']" "$EN_KEY3"
# ==========================================================
# ==== 以下为向下游客户端下发配置时使用conf形式的示例,直接使用包含节点信息的配置,用户可以不再需要进行大部分插件设置 ====
# ==========================================================
#[General]
#CORE_TYPE = Meta
# --- DNS 相关 ---
#ENABLE_REDIRECT_DNS = 1
#ENABLE_CUSTOM_DNS = 1
#APPEND_DEFAULT_DNS = 1
#APPEND_WAN_DNS = 0
#STORE_FAKEIP = 1
#CUSTOM_FAKEIP_FILTER = 1
#CUSTOM_FAKEIP_FILTER_MODE = blacklist
#FAKEIP_RANGE = 198.18.0.1/16
#ENABLE_RESPECT_RULES = 1
#CUSTOM_NAME_POLICY = 1
#CUSTOM_HOST = 1
#CUSTOM_FALLBACK_FILTER = 1
# --- IPv6 相关 ---
#IPV6_ENABLE = 0
#IPV6_DNS = 0
# --- 代理与模式 ---
#EN_MODE = fake-ip-mix
#DISABLE_UDP_QUIC = 1
#ROUTER_SELF_PROXY = 1
#PROXY_MODE = rule
#STACK_TYPE = system
# --- 模块更新后重启 ---
#RESTART = true
# --- 下载包含代理节点信息的配置文件 ---
#DOWNLOAD_FILE = url=https://default-demo.yaml, path=/etc/openclash/config/default-demo.yaml, cron=0 6 * * *, force=true, restart=false
#将配置作为默认配置文件
#ONFIG_FILE = /etc/openclash/config/default-demo.yaml
#指定展示订阅信息的 URL 地址
#SUB_INFO_URL = https://default-demo.yaml
# ==========================================================
# ==== 以下为仅修改插件设置示例 ====
# ==========================================================
[General]
CORE_TYPE = Meta
# --- DNS 相关 ---
ENABLE_REDIRECT_DNS = 1
ENABLE_CUSTOM_DNS = 1
APPEND_DEFAULT_DNS = 1
APPEND_WAN_DNS = 0
STORE_FAKEIP = 1
CUSTOM_FAKEIP_FILTER = 1
CUSTOM_FAKEIP_FILTER_MODE = blacklist
FAKEIP_RANGE = 198.18.0.1/16
ENABLE_RESPECT_RULES = 1
CUSTOM_NAME_POLICY = 1
CUSTOM_HOST = 1
CUSTOM_FALLBACK_FILTER = 1
# --- IPv6 相关 ---
IPV6_ENABLE = 0
IPV6_DNS = 0
# --- 代理与模式 ---
EN_MODE = fake-ip-mix
DISABLE_UDP_QUIC = 1
ROUTER_SELF_PROXY = 1
PROXY_MODE = rule
STACK_TYPE = system
# --- 防火墙与访问控制 ---
INTRANET_ALLOWED = 1
BYPASS_GATEWAY_COMPATIBLE = 0
# --- 分流相关 ---
CHINA_IP_ROUTE = 1
CHINA_IP6_ROUTE = 0
CHNR_AUTO_UPDATE = 1
CHNR_UPDATE_WEEK_TIME = *
CHNR_UPDATE_DAY_TIME = 6
ENABLE_META_SNIFFER = 1
ENABLE_META_SNIFFER_CUSTOM = 1
ENABLE_META_SNIFFER_PURE_IP = 1
ENABLE_TCP_CONCURRENT = 1
FIND_PROCESS_MODE = off
GLOBAL_CLIENT_FINGERPRINT = random
ENABLE_RULE_PROXY = 0
ENABLE_CUSTOM_CLASH_RULES = 1
# --- Smart 相关 ---
AUTO_SMART_SWITCH = 0
LGBM_AUTO_UPDATE = 1
LGBM_UPDATE_INTERVAL = 72
LGBM_CUSTOM_URL = https://github.com/vernesong/mihomo/releases/download/LightGBM-Model/Model.bin
# --- 数据库加载相关 ---
ENABLE_GEOIP_DAT = 1
GEODATA_LOADER = standard
GEOIP_AUTO_UPDATE = 1
GEOIP_UPDATE_WEEK_TIME = *
GEOIP_UPDATE_DAY_TIME = 5
GEOSITE_AUTO_UPDATE = 1
GEOSITE_UPDATE_WEEK_TIME = *
GEOSITE_UPDATE_DAY_TIME = 5
# --- 其它功能 ---
SMALL_FLASH_MEMORY = 0
DISABLE_QUIC_GO_GSO = 1
DELAY_START = 0
SKIP_PROXY_ADDRESS = 1
RESTART = false
@@ -0,0 +1,4 @@
payload:
# > ABC
- DOMAIN-SUFFIX,edgedatg.com
- DOMAIN-SUFFIX,go.com
@@ -0,0 +1,40 @@
payload:
# > ChatGPT
- DOMAIN-SUFFIX,ai.com
- DOMAIN-SUFFIX,chatgpt.com
- DOMAIN-SUFFIX,openai.com
# > Chat GPT API & CDN
- DOMAIN-SUFFIX,cdn.oaistatic.com
- DOMAIN,chat.openai.com.cdn.cloudflare.net
- DOMAIN,openaiapi-site.azureedge.net
- DOMAIN,openaicom-api-bdcpf8c6d2e9atf6.z01.azurefd.net
- DOMAIN,openaicomproductionae4b.blob.core.windows.net
- DOMAIN,production-openaicom-storage.azureedge.net
- DOMAIN-SUFFIX,oaistatic.com
- DOMAIN-SUFFIX,oaiusercontent.com
- DOMAIN-SUFFIX,o33249.ingest.sentry.io
# > Claude
- DOMAIN-SUFFIX,anthropic.com
- DOMAIN-SUFFIX,claude.ai
# > Copilot
- DOMAIN-SUFFIX,copilot.microsoft.com
# > Gemini
- DOMAIN-SUFFIX,gemini.google.com
- DOMAIN-SUFFIX,generativelanguage.googleapis.com
- DOMAIN-SUFFIX,proactivebackend-pa.googleapis.com
# > Meta AI
- DOMAIN-SUFFIX,meta.ai
# > Perplexity AI
- DOMAIN-SUFFIX,perplexity.ai
# > Siri
- DOMAIN-SUFFIX,apple-relay.apple.com
- DOMAIN,guzzoni.smoot.apple.com
@@ -0,0 +1,10 @@
payload:
# > AbemaTV
# - USER-AGENT,AbemaTV*
- PROCESS-NAME,tv.abema
- DOMAIN-SUFFIX,abema.io
- DOMAIN-SUFFIX,abema.tv
- DOMAIN-SUFFIX,akamaized.net
- DOMAIN-SUFFIX,ameba.jp
- DOMAIN-SUFFIX,hayabusa.io
- DOMAIN-KEYWORD,abematv.akamaized.net
@@ -0,0 +1,45 @@
payload:
# > Amazon Prime Video
# - USER-AGENT,InstantVideo.US*
# - USER-AGENT,Prime%20Video*
- DOMAIN-KEYWORD,avoddashs
- DOMAIN-SUFFIX,aiv-cdn.net
- DOMAIN-SUFFIX,aiv-delivery.net
- DOMAIN-SUFFIX,amazonprimevideos.com
- DOMAIN-SUFFIX,amazonvideo.cc
- DOMAIN-SUFFIX,amazonvideo.com
- DOMAIN-SUFFIX,amazonvideodirect.cc
- DOMAIN-SUFFIX,atv-ext.amazon.com
- DOMAIN-SUFFIX,atv-ext-eu.amazon.com
- DOMAIN-SUFFIX,atv-ext-fe.amazon.com
- DOMAIN-SUFFIX,atv-ps.amazon.com
- DOMAIN-SUFFIX,atv-ps-eu.amazon.co.uk
- DOMAIN-SUFFIX,atv-ps-eu.amazon.com
- DOMAIN-SUFFIX,atv-ps-fe.amazon.co.jp
- DOMAIN-SUFFIX,atv-ps-fe.amazon.com
- DOMAIN-SUFFIX,fls-na.amazon.com
- DOMAIN-SUFFIX,media-amazon.com
- DOMAIN-SUFFIX,primevideo.cc
- DOMAIN-SUFFIX,primevideo.com
- DOMAIN-SUFFIX,prime-video.com
- DOMAIN-SUFFIX,primevideo.info
- DOMAIN-SUFFIX,primevideo.org
- DOMAIN-SUFFIX,primevideo.tv
- DOMAIN-SUFFIX,pv-cdn.net
- DOMAIN-SUFFIX,video.a2z.com
- DOMAIN,avodmp4s3ww-a.akamaihd.net
- DOMAIN,d1v5ir2lpwr8os.cloudfront.net
- DOMAIN,d1y002tclu9djj.cloudfront.net
- DOMAIN,d22qjgkvxw22r6.cloudfront.net
- DOMAIN,d25xi40x97liuc.cloudfront.net
- DOMAIN,dmqdd6hw24ucf.cloudfront.net
- DOMAIN,d27xxe7juh1us6.cloudfront.net
- DOMAIN,dualstack.pefs-alb-266603904.eu-west-1.elb.amazonaws.com
# // 美区网页版需二选一走代理,如 URL-REGEX 则需 MITM www.amazon.com
# // DOMAIN,www.amazon.com
# URL-REGEX,^https?:\/\/www\.amazon\.com\/(Amazon-Video|gp\/video)\/
@@ -0,0 +1,33 @@
payload:
# > Apple API
- DOMAIN-KEYWORD,apple.com.akadns.net
- DOMAIN-KEYWORD,icloud.com.akadns.net
- DOMAIN-SUFFIX,aaplimg.com
- DOMAIN-SUFFIX,apple.co
- DOMAIN-SUFFIX,apple.com
- DOMAIN-SUFFIX,apple-cloudkit.com
- DOMAIN-SUFFIX,apple-mapkit.com
- DOMAIN-SUFFIX,appsto.re
- DOMAIN-SUFFIX,cdn-apple.com
- DOMAIN-SUFFIX,icloud.com
- DOMAIN-SUFFIX,icloud-content.com
- DOMAIN-SUFFIX,itunes.com
- DOMAIN-SUFFIX,me.com
- DOMAIN-SUFFIX,mzstatic.com
- IP-CIDR,17.0.0.0/8,no-resolve
- IP-CIDR,63.92.224.0/19,no-resolve
- IP-CIDR,65.199.22.0/23,no-resolve
- IP-CIDR,139.178.128.0/18,no-resolve
- IP-CIDR,144.178.0.0/19,no-resolve
- IP-CIDR,144.178.36.0/22,no-resolve
- IP-CIDR,144.178.48.0/20,no-resolve
- IP-CIDR,192.35.50.0/24,no-resolve
- IP-CIDR,198.183.17.0/24,no-resolve
- IP-CIDR,205.180.175.0/24,no-resolve
# > Apple News
- DOMAIN-SUFFIX,apple.comscoreresearch.com
- DOMAIN-SUFFIX,apple.news
# > Apple Maps
- PROCESS-NAME,com.apple.geod
@@ -0,0 +1,16 @@
payload:
# > Apple Music
# - USER-AGENT,Music*
- PROCESS-NAME,music
- DOMAIN-SUFFIX,applemusic.com
- DOMAIN-SUFFIX,blobstore.apple.com
- DOMAIN-SUFFIX,music.apple.com
- DOMAIN,aod.itunes.apple.com
- DOMAIN,aod-ssl.itunes.apple.com
- DOMAIN,audio.itunes.apple.com
- DOMAIN,audio-ssl.itunes.apple.com
- DOMAIN,mvod.itunes.apple.com
- DOMAIN,streamingaudio.itunes.apple.com
# iCloud Music Library
- DOMAIN-SUFFIX,blobstore.apple.com
@@ -0,0 +1,12 @@
payload:
# > Apple News and Apple Map TOMTOM Version
# - USER-AGENT,AppleNews*
# - USER-AGENT,com.apple.news*
- DOMAIN,gspe1-ssl.ls.apple.com
# - USER-AGENT,News*
# - DOMAIN,apple.comscoreresearch.com
# - DOMAIN,gateway.icloud.com
# - DOMAIN,news-client.apple.com
# - DOMAIN,news-edge.apple.com
# - DOMAIN,news-events.apple.com
# - DOMAIN-SUFFIX,apple.news
@@ -0,0 +1,5 @@
payload:
# > Apple TV
- DOMAIN,np-edge.itunes.apple.com
- DOMAIN,play-edge.itunes.apple.com
- DOMAIN-SUFFIX,tv.apple.com
@@ -0,0 +1,15 @@
payload:
# > BBC iPlayer
- PROCESS-NAME,bbc.iplayer.android
- DOMAIN-KEYWORD,bbcfmt
- DOMAIN,aod-dash-uk-live.akamaized.net
- DOMAIN,aod-hls-uk-live.akamaized.net
- DOMAIN,vod-dash-uk-live.akamaized.net
- DOMAIN,vod-thumb-uk-live.akamaized.net
- DOMAIN-SUFFIX,bbc.co
- DOMAIN-SUFFIX,bbc.co.uk
- DOMAIN-SUFFIX,bbc.com
- DOMAIN-SUFFIX,bbcfmt.hs.llnwd.net
- DOMAIN-SUFFIX,bbci.co
- DOMAIN-SUFFIX,bbci.co.uk
- DOMAIN-SUFFIX,bidi.net.uk
@@ -0,0 +1,8 @@
payload:
# > Bahamut
# - USER-AGENT,Anime*
- PROCESS-NAME,tw.com.gamer.android.animad
- DOMAIN-SUFFIX,bahamut.com.tw
- DOMAIN-SUFFIX,gamer.com.tw
- DOMAIN,gamer-cds.cdn.hinet.net
- DOMAIN,gamer2-cds.cdn.hinet.net
@@ -0,0 +1,16 @@
payload:
# > Bilibili
# - USER-AGENT,bili*
- DOMAIN-SUFFIX,acg.tv
- DOMAIN-SUFFIX,acgvideo.com
- DOMAIN-SUFFIX,b23.tv
- DOMAIN-SUFFIX,bilibili.com
- DOMAIN-SUFFIX,bilibili.tv
- DOMAIN-SUFFIX,biliapi.net
- DOMAIN-SUFFIX,biliapi.com
- DOMAIN-SUFFIX,bilivideo.com
- DOMAIN-SUFFIX,hdslb.com
- DOMAIN,upos-hz-mirrorakam.akamaized.net
# Hong Kong, Macau, Taiwan
# - USER-AGENT,bili-inter*
- DOMAIN,apiintl.biliapi.net
@@ -0,0 +1,300 @@
payload:
# > Forum
- DOMAIN-SUFFIX,bitcointalk.org
# > Exchange
- DOMAIN-SUFFIX,aex.com
- DOMAIN-SUFFIX,bibox.com
- DOMAIN-SUFFIX,bitfinex.com
- DOMAIN-SUFFIX,bithumb.com
- DOMAIN-SUFFIX,bitmex.com
- DOMAIN-SUFFIX,bitstamp.net
- DOMAIN-SUFFIX,bittrex.com
- DOMAIN-SUFFIX,bybit.com
- DOMAIN-SUFFIX,coinbase.com
- DOMAIN-SUFFIX,coincheck.com
- DOMAIN-SUFFIX,coinone.co.kr
- DOMAIN-SUFFIX,gemini.com
- DOMAIN-SUFFIX,korbit.co.kr
- DOMAIN-SUFFIX,kraken.com
- DOMAIN-SUFFIX,kucoin.com
- DOMAIN-SUFFIX,liquid.com
- DOMAIN-SUFFIX,poloniex.com
- DOMAIN-SUFFIX,bitbank.cc
- DOMAIN-SUFFIX,bitcoin.org
- DOMAIN-SUFFIX,bitquick.co
- DOMAIN-SUFFIX,btcbox.co.jp
- DOMAIN-SUFFIX,cex.io
- DOMAIN-SUFFIX,dogecoin.com
- DOMAIN-SUFFIX,paxful.com
- DOMAIN-SUFFIX,tether.to
- DOMAIN-SUFFIX,dydx.exchange
- DOMAIN-SUFFIX,solana.com
- DOMAIN-SUFFIX,avax.network
- DOMAIN-SUFFIX,optimism.io
- DOMAIN-SUFFIX,arbitrum.io
- DOMAIN-SUFFIX,poly.network
- DOMAIN-SUFFIX,zkscan.io
- DOMAIN-SUFFIX,zksync.io
- DOMAIN-SUFFIX,boba.network
# > Binance
- DOMAIN-SUFFIX,binance.cc
- DOMAIN-SUFFIX,binance.cloud
- DOMAIN-SUFFIX,binance.com
- DOMAIN-SUFFIX,binance.im
- DOMAIN-SUFFIX,binance.me
- DOMAIN-SUFFIX,binance.us
- DOMAIN-SUFFIX,bnappzh.co
- DOMAIN-SUFFIX,bnappzh.com
- DOMAIN-SUFFIX,bnbstatic.com
- DOMAIN-SUFFIX,bntrace.com
- DOMAIN-SUFFIX,binance.charity
- DOMAIN-SUFFIX,binance.co
- DOMAIN-SUFFIX,binance.info
- DOMAIN-SUFFIX,binance.net
- DOMAIN-SUFFIX,binance.org
- DOMAIN-SUFFIX,binance.vision
- DOMAIN-SUFFIX,binanceapi.com
- DOMAIN-SUFFIX,binancezh.be
- DOMAIN-SUFFIX,binancezh.biz
- DOMAIN-SUFFIX,binancezh.cc
- DOMAIN-SUFFIX,binancezh.co
- DOMAIN-SUFFIX,binancezh.com
- DOMAIN-SUFFIX,binancezh.info
- DOMAIN-SUFFIX,binancezh.ink
- DOMAIN-SUFFIX,binancezh.kim
- DOMAIN-SUFFIX,binancezh.link
- DOMAIN-SUFFIX,binancezh.live
- DOMAIN-SUFFIX,binancezh.mobi
- DOMAIN-SUFFIX,binancezh.net
- DOMAIN-SUFFIX,binancezh.pro
- DOMAIN-SUFFIX,binancezh.sh
- DOMAIN-SUFFIX,binancezh.top
- DOMAIN-SUFFIX,bnappzh.mobi
- DOMAIN-SUFFIX,bsc.getblock.io
- DOMAIN-SUFFIX,bscscan.com
- PROCESS-NAME,Binance.exe
- DOMAIN-KEYWORD,binance
# > Huobi
- DOMAIN-SUFFIX,hbabit.com
- DOMAIN-SUFFIX,hbfile.net
- DOMAIN-SUFFIX,huobi.com
- DOMAIN-SUFFIX,huobi.me
- DOMAIN-SUFFIX,huobi.pro
- DOMAIN-SUFFIX,huobi.sc
- DOMAIN-SUFFIX,huobiasia.vip
- DOMAIN-SUFFIX,huobigroup.com
- DOMAIN-SUFFIX,huobitoken.com
- DOMAIN-SUFFIX,heco-scan.com
- DOMAIN-SUFFIX,hecoview.com
- DOMAIN-SUFFIX,hbfile.net
- DOMAIN-SUFFIX,huobi.br.com
- DOMAIN-SUFFIX,bitderiv.com
- DOMAIN-SUFFIX,hecochain.com
- DOMAIN-SUFFIX,huobi.ws
- DOMAIN-SUFFIX,huobi.ug
- DOMAIN-SUFFIX,huobi.co.ma
- DOMAIN-SUFFIX,huobi.br.com
- PROCESS-NAME,Huobi.exe
- DOMAIN-KEYWORD,huobi
# > OKX
- DOMAIN-SUFFIX,okex.com
- DOMAIN-SUFFIX,okx.com
- PROCESS-NAME,OKX.exe
- DOMAIN-KEYWORD,okx
# > asproex
- DOMAIN-SUFFIX,asproex.com
- DOMAIN-SUFFIX,asproexapi.com
# > bitflyer
- DOMAIN-SUFFIX,bitflyer.com
- DOMAIN-SUFFIX,bitflyer.jp
# > bitsquare
- DOMAIN-SUFFIX,bisq.io
- DOMAIN-SUFFIX,bisq.network
- DOMAIN-SUFFIX,bitsquare.io
# > coinone
- DOMAIN-SUFFIX,coinone.co.kr
- DOMAIN-SUFFIX,coinonecore.com
- DOMAIN-SUFFIX,coinonecorp.com
# > ethereum
- DOMAIN-SUFFIX,devcon.org
- DOMAIN-SUFFIX,ethereum.foundation
- DOMAIN-SUFFIX,ethereum.org
- DOMAIN-SUFFIX,etherscan.io
- DOMAIN-SUFFIX,nansen.ai
- DOMAIN-SUFFIX,ethgasstation.info
- DOMAIN-SUFFIX,watchtheburn.com
- DOMAIN-SUFFIX,flashbots.net
- DOMAIN-SUFFIX,cryptofees.info
- DOMAIN-SUFFIX,etherscan.io
- DOMAIN-SUFFIX,ethereum-magicians.org
- DOMAIN-SUFFIX,vitalik.ca
- DOMAIN-SUFFIX,ethfans.org
- DOMAIN-SUFFIX,ethereum.cn
- DOMAIN-SUFFIX,ethereum.stackexchange.com
- DOMAIN-SUFFIX,etherscan.com
- DOMAIN-SUFFIX,parity.io
- DOMAIN-SUFFIX,ethernodes.org
# > localbitcoins
- DOMAIN-SUFFIX,localbitcoins.com
- DOMAIN-SUFFIX,localbitcoinschain.com
# > zb
- DOMAIN-SUFFIX,zb.app
- DOMAIN-SUFFIX,zb.com
- DOMAIN-SUFFIX,zb.io
- DOMAIN-SUFFIX,zb.live
# > Analysis
- DOMAIN-SUFFIX,aicoin.com
- DOMAIN-SUFFIX,aimoon.com
- DOMAIN-SUFFIX,coingecko.com
- DOMAIN-SUFFIX,coinmarketcap.com
- DOMAIN-SUFFIX,glassnode.com
- DOMAIN-SUFFIX,coinmetrics.io
- DOMAIN-SUFFIX,tokenview.com
- DOMAIN-SUFFIX,oklink.com
- DOMAIN-SUFFIX,blockchair.com
- DOMAIN-SUFFIX,intotheblock.com
- DOMAIN-SUFFIX,bytetree.com
- DOMAIN-SUFFIX,coin.dance
- DOMAIN-SUFFIX,defieye.io
- DOMAIN-SUFFIX,duneanalytics.com
- DOMAIN-SUFFIX,tokenterminal.com
- DOMAIN-SUFFIX,dapp.review
- DOMAIN-SUFFIX,dappradar.com
- DOMAIN-SUFFIX,stateofthedapps.com
- DOMAIN-SUFFIX,thegraph.com
- DOMAIN-SUFFIX,debank.com
- DOMAIN-SUFFIX,vfat.tools
- DOMAIN-SUFFIX,loanscan.io
- DOMAIN-SUFFIX,defirate.com
- DOMAIN-SUFFIX,defipulse.com
- DOMAIN-SUFFIX,apy999.com
- DOMAIN-SUFFIX,defieye.io
- DOMAIN-SUFFIX,dextools.io
- DOMAIN-SUFFIX,tradingview.com
- DOMAIN-SUFFIX,dcabtc.com
- DOMAIN-SUFFIX,chainalysis.com
- DOMAIN-SUFFIX,cryptoquant.com
- DOMAIN-SUFFIX,viewbase.com
- DOMAIN-SUFFIX,bitcoinity.org
- DOMAIN-SUFFIX,cryptocompare.com
- DOMAIN-SUFFIX,coincodex.com
- DOMAIN-SUFFIX,cointrendz.com
- DOMAIN-SUFFIX,coincheckup.com
- DOMAIN-SUFFIX,thetie.io
- DOMAIN-SUFFIX,cryptorank.io
- DOMAIN-SUFFIX,tradeblock.com
- DOMAIN-SUFFIX,nyctale.io
- DOMAIN-SUFFIX,dovemetrics.com
- DOMAIN-SUFFIX,cryptorank.io
- DOMAIN-SUFFIX,icodrops.com
- DOMAIN-SUFFIX,chainbroker.io
- DOMAIN-SUFFIX,crunchbase.com
- DOMAIN-SUFFIX,defillama.com
- DOMAIN-SUFFIX,coinowo.com
- DOMAIN-SUFFIX,earni.fi
- DOMAIN-SUFFIX,dropsearn.com
- DOMAIN-SUFFIX,bitcoin.it
- DOMAIN-SUFFIX,bitcoinmagazine.com
- DOMAIN-SUFFIX,blockchain.com
- DOMAIN-SUFFIX,tronscan.org
# > POOL
- DOMAIN-SUFFIX,btc.com
- DOMAIN-SUFFIX,f2pool.com
- DOMAIN-SUFFIX,cbeci.org
- DOMAIN-SUFFIX,digiconomist.net
- DOMAIN-SUFFIX,1ml.com
- DOMAIN-SUFFIX,bitcoinvisuals.com
- DOMAIN-SUFFIX,crypto51.app
- DOMAIN-SUFFIX,masternodes.online
- DOMAIN-SUFFIX,bitnodes.earn.com
- DOMAIN-SUFFIX,poolin.com
- DOMAIN-SUFFIX,ethermine.org
- DOMAIN-SUFFIX,ewapool.net
# > FTX
- DOMAIN-SUFFIX,ftx.com
# > Metamask
- DOMAIN-KEYWORD,metamask
- DOMAIN,token-api.metaswap.codefi.network
- DOMAIN,min-api.cryptocompare.com
# > NFT
- DOMAIN-SUFFIX,opensea.io
- DOMAIN-SUFFIX,nftscan.com
- DOMAIN-SUFFIX,makersplace.com
- DOMAIN-SUFFIX,nonfungible.com
- DOMAIN-SUFFIX,cryptoslam.io
- DOMAIN-SUFFIX,cryptoart.io
- DOMAIN-SUFFIX,nftcalendar.io
- DOMAIN-SUFFIX,nftgo.io
# > IPFS
- DOMAIN-SUFFIX,filecoin.io
- DOMAIN-SUFFIX,docs.lotu.sh
- DOMAIN-SUFFIX,ipfs.io
- DOMAIN-SUFFIX,docs.ipfs.io
- DOMAIN-SUFFIX,discuss.ipfs.io
# > EOS
- DOMAIN-SUFFIX,eos.io
- DOMAIN-SUFFIX,developers.eos.io
- DOMAIN-SUFFIX,block.one
- DOMAIN-SUFFIX,eostracker.io
- DOMAIN-SUFFIX,eosflare.io
- DOMAIN-SUFFIX,eospark.com
- DOMAIN-SUFFIX,bloks.io
# > Lightning
- DOMAIN-SUFFIX,lightning.engineering
- DOMAIN-SUFFIX,lightning.community
- DOMAIN-SUFFIX,acinq.co
- DOMAIN-SUFFIX,1ml.com
# > Token
- DOMAIN-SUFFIX,tokenpocket.pro
- DOMAIN-SUFFIX,token.im
- DOMAIN-SUFFIX,phantom.app
- DOMAIN-SUFFIX,tronlink.org
- DOMAIN-SUFFIX,myetherwallet.com
- DOMAIN-SUFFIX,jaxx.io
- DOMAIN-SUFFIX,trustwalletapp.com
# > Gate
- DOMAIN-SUFFIX,gate.ac
- DOMAIN-SUFFIX,gate.io
# > Mexc
- DOMAIN-SUFFIX,mexc.com
# > Dapp
- DOMAIN-SUFFIX,sushi.com
- DOMAIN-SUFFIX,uniswap.org
- DOMAIN-SUFFIX,sunswap.com
- DOMAIN-SUFFIX,traderjoexyz.com
- DOMAIN-SUFFIX,raydium.io
- DOMAIN-SUFFIX,synthetix.io
- DOMAIN-SUFFIX,aave.com
- DOMAIN-SUFFIX,compound.finance
- DOMAIN-SUFFIX,makerdao.com
- DOMAIN-SUFFIX,wbtc.network
- DOMAIN-SUFFIX,pancakeswap.finance
- DOMAIN-SUFFIX,pancakeswap.com
- DOMAIN-SUFFIX,mdex.co
- DOMAIN-SUFFIX,mdex.one
- DOMAIN-SUFFIX,mdex.com
- DOMAIN-SUFFIX,mdex.me
- DOMAIN-SUFFIX,1inch.io
@@ -0,0 +1,25 @@
payload:
# > DAZN
# - USER-AGENT,DAZN*
- PROCESS-NAME,com.dazn
- DOMAIN-KEYWORD,voddazn
- DOMAIN-SUFFIX,dazn.com
- DOMAIN-SUFFIX,dazn-api.com
- DOMAIN-SUFFIX,dazndn.com
- DOMAIN-SUFFIX,daznedge.net
- DOMAIN-SUFFIX,daznfeeds.com
- DOMAIN-SUFFIX,daznservices.com
- DOMAIN-SUFFIX,indazn.com
- DOMAIN-SUFFIX,indaznlab.com
- DOMAIN,daznfeeds.com.edgekey.net
- DOMAIN,dca-lm-livedazn.secure.footprint.net
- DOMAIN,h-dazn.online-metrix.net
- DOMAIN,images-daznservices-com.cdn.ampproject.org
- DOMAIN,d151l6v8er5bdm.cloudfront.net
- IP-CIDR,185.42.236.0/24,no-resolve
- IP-CIDR,185.42.238.0/24,no-resolve
@@ -0,0 +1,8 @@
payload:
# > Discord
- DOMAIN-SUFFIX,discord.com
- DOMAIN-SUFFIX,discord.gg
- DOMAIN-SUFFIX,discord.media
- DOMAIN-SUFFIX,discordapp.com
- DOMAIN-SUFFIX,discordapp.net
- DOMAIN-SUFFIX,discordstatus.com
@@ -0,0 +1,11 @@
payload:
# > Discovery Plus
- PROCESS-NAME,com.discovery.discoveryplus.mobile
- DOMAIN-SUFFIX,content-ause1-ur-discovery1.uplynk.com
- DOMAIN-SUFFIX,disco-api.com
- DOMAIN-SUFFIX,discoveryplus.com
- DOMAIN-SUFFIX,fwmrm.net
- DOMAIN-SUFFIX,getblueshift.com
- DOMAIN-SUFFIX,litix.io
- DOMAIN-SUFFIX,mobile-collector.newrelic.com
- DOMAIN-SUFFIX,uplynk.com
@@ -0,0 +1,21 @@
payload:
# > Disney Plus
# - USER-AGENT,Disney*
- PROCESS-NAME,com.disney.disneyplus
- DOMAIN-SUFFIX,adobedtm.com
- DOMAIN-SUFFIX,bam.nr-date.net
- DOMAIN-SUFFIX,bamgrid.com
- DOMAIN-SUFFIX,braze.com
- DOMAIN-SUFFIX,cdn.optimizely.com
- DOMAIN-SUFFIX,d9.flashtalking.com
- DOMAIN-SUFFIX,disney.demdex.net
- DOMAIN-SUFFIX,disney.my.sentry.io
- DOMAIN-SUFFIX,disneyplus.bn5x.net
- DOMAIN-SUFFIX,disneyplus.com
- DOMAIN-SUFFIX,disneyplus.com.ssl.sc.omtrdc.net
- DOMAIN-SUFFIX,disney-plus.net
- DOMAIN-SUFFIX,disney-portal.my.onetrust.com
- DOMAIN-SUFFIX,dssott.com
- DOMAIN-SUFFIX,registerdisney.go.com
@@ -0,0 +1,335 @@
payload:
# China Banks
# > Agricultural Bank of China
- DOMAIN-SUFFIX,abchina.com
- DOMAIN-SUFFIX,abchina.com.cn
# > Bank of China
- DOMAIN-SUFFIX,boc.cn
# > China Citic Bank
- DOMAIN-SUFFIX,citicbank.com
- DOMAIN-SUFFIX,ecitic.com
- DOMAIN-SUFFIX,ecitic.net
# > China Construction Bank
- DOMAIN-SUFFIX,ccb.com
- DOMAIN-SUFFIX,ccb.com.cn
# > China Everbright Bank
- DOMAIN-SUFFIX,cebbank.com
# > China Merchants Bank
# - USER-AGENT,cmb*
- DOMAIN-SUFFIX,cmbchina.com
- DOMAIN-SUFFIX,cmbimg.com
- DOMAIN-SUFFIX,cmbt.cn
- DOMAIN-SUFFIX,mbcloud.com
# > Industrial and Commercial Bank of China
# - USER-AGENT,%E4%B8%AD%E5%9B%BD%E5%B7%A5%E5%95%86%E9%93%B6%E8%A1%8C*
- DOMAIN-SUFFIX,icbc.com.cn
# > Ping An Bank
- DOMAIN-SUFFIX,pingan.com
- DOMAIN-SUFFIX,pingan.com.cn
# Type
# > Beplay
- DOMAIN-KEYWORD,beplay
# > Blizzard
# - USER-AGENT,hearthstone*
- DOMAIN,cdp.cloud.unity3d.com
- DOMAIN-SUFFIX,battle.net
- DOMAIN-SUFFIX,battlenet.com
- DOMAIN-SUFFIX,blizzard.com
# > Prior
- DOMAIN,client.amplifi.com
- DOMAIN,ip.bjango.com
- DOMAIN-SUFFIX,alphassl.com
- DOMAIN-SUFFIX,edu.cn
# > RRYS
- DOMAIN-SUFFIX,p4pfile.com
- DOMAIN-SUFFIX,zmzfile.com
# > Sony
# - USER-AGENT,RemotePlay*
- DOMAIN-SUFFIX,playstation.com
- DOMAIN-SUFFIX,playstation.net
- DOMAIN-SUFFIX,playstationnetwork.com
- DOMAIN-SUFFIX,sony.com
- DOMAIN-SUFFIX,sonyentertainmentnetwork.com
# > TeamViewer
- IP-CIDR,185.188.32.0/24,no-resolve
- IP-CIDR,185.188.33.0/24,no-resolve
- IP-CIDR,185.188.34.0/24,no-resolve
- IP-CIDR,185.188.35.0/24,no-resolve
- IP-CIDR6,2a0b:b580::/48,no-resolve
- IP-CIDR6,2a0b:b581::/48,no-resolve
- IP-CIDR6,2a0b:b582::/48,no-resolve
- IP-CIDR6,2a0b:b583::/48,no-resolve
# > Tencent
- IP-CIDR,182.254.116.0/24,no-resolve
# > Tencent WeChat (International)
- IP-CIDR,101.32.104.0/21,DIRECT,no-resolve
- IP-CIDR,101.32.118.0/23,DIRECT,no-resolve
- IP-CIDR,101.32.96.0/20,DIRECT,no-resolve
- IP-CIDR,129.226.0.0/16,DIRECT,no-resolve
- IP-CIDR,183.128.0.0/11,DIRECT,no-resolve
- IP-CIDR,183.131.48.0/20,DIRECT,no-resolve
- DOMAIN-SUFFIX,10010.com
- DOMAIN-SUFFIX,10086.cn
- DOMAIN-SUFFIX,12306.cn
- DOMAIN-SUFFIX,12306.com
- DOMAIN-SUFFIX,126.net
- DOMAIN-SUFFIX,163.com
- DOMAIN-SUFFIX,189.cn
- DOMAIN-SUFFIX,360.cn
- DOMAIN-SUFFIX,360.com
- DOMAIN-SUFFIX,360buy.com
- DOMAIN-SUFFIX,360buyimg.com
- DOMAIN-SUFFIX,36kr.com
- DOMAIN-SUFFIX,51ym.me
- DOMAIN-SUFFIX,58.com
- DOMAIN-SUFFIX,8686c.com
- DOMAIN-SUFFIX,95516.com
- DOMAIN-SUFFIX,abercrombie.com
- DOMAIN-SUFFIX,acfun.tv
- DOMAIN-SUFFIX,adobesc.com
- DOMAIN-SUFFIX,air-matters.com
- DOMAIN-SUFFIX,air-matters.io
- DOMAIN-SUFFIX,aixifan.com
- DOMAIN-SUFFIX,akadns.net
- DOMAIN-SUFFIX,alibaba.com
- DOMAIN-SUFFIX,alibabacloud.com
- DOMAIN-SUFFIX,alicdn.com
- DOMAIN-SUFFIX,alipay.com
- DOMAIN-SUFFIX,alipayobjects.com
- DOMAIN-SUFFIX,aliyun.com
- DOMAIN-SUFFIX,aliyuncs.com
- DOMAIN-SUFFIX,amap.com
- DOMAIN-SUFFIX,appshike.com
- DOMAIN-SUFFIX,appstore.com
- DOMAIN-SUFFIX,autonavi.com
- DOMAIN-SUFFIX,bababian.com
- DOMAIN-SUFFIX,baidu.com
- DOMAIN-SUFFIX,baidupcs.com
- DOMAIN-SUFFIX,bdimg.com
- DOMAIN-SUFFIX,bdstatic.com
- DOMAIN-SUFFIX,beatsbydre.com
- DOMAIN-SUFFIX,broadcasthe.net
- DOMAIN-SUFFIX,caiyunapp.com
- DOMAIN-SUFFIX,ccgslb.com
- DOMAIN-SUFFIX,ccgslb.net
- DOMAIN-SUFFIX,chinacache.net
- DOMAIN-SUFFIX,chunbo.com
- DOMAIN-SUFFIX,chunboimg.com
- DOMAIN-SUFFIX,clashroyaleapp.com
- DOMAIN-SUFFIX,clouddn.com
- DOMAIN-SUFFIX,cloudsigma.com
- DOMAIN-SUFFIX,cloudxns.net
- DOMAIN-SUFFIX,cmct.tv
- DOMAIN-SUFFIX,cmfu.com
- DOMAIN-SUFFIX,cnbeta.com
- DOMAIN-SUFFIX,cnbetacdn.com
- DOMAIN-SUFFIX,chdbits.co
- DOMAIN-SUFFIX,cnlang.org
- DOMAIN-SUFFIX,coolapk.com
- DOMAIN-SUFFIX,cn88.net
- DOMAIN-SUFFIX,dct-cloud.com
- DOMAIN-SUFFIX,didialift.com
- DOMAIN-SUFFIX,digicert.com
- DOMAIN-SUFFIX,douban.com
- DOMAIN-SUFFIX,doubanio.com
- DOMAIN-SUFFIX,douyin.com
- DOMAIN-SUFFIX,douyu.com
- DOMAIN-SUFFIX,douyu.tv
- DOMAIN-SUFFIX,douyutv.com
- DOMAIN-SUFFIX,duokan.com
- DOMAIN-SUFFIX,duoshuo.com
- DOMAIN-SUFFIX,dytt8.net
- DOMAIN-SUFFIX,easou.com
- DOMAIN-SUFFIX,eudic.net
- DOMAIN-SUFFIX,ewqcxz.com
- DOMAIN-SUFFIX,feng.com
- DOMAIN-SUFFIX,fir.im
- DOMAIN-SUFFIX,firefox.com
- DOMAIN-SUFFIX,frdic.com
- DOMAIN-SUFFIX,fresh-ideas.cc
- DOMAIN-SUFFIX,gameloft.com
- DOMAIN-SUFFIX,garmin.com
- DOMAIN-SUFFIX,geetest.com
- DOMAIN-SUFFIX,godic.net
- DOMAIN-SUFFIX,goodread.com
- DOMAIN-SUFFIX,goofish.com
- DOMAIN-SUFFIX,gtimg.com
- DOMAIN-SUFFIX,haibian.com
- DOMAIN-SUFFIX,hao123.com
- DOMAIN-SUFFIX,haosou.com
- DOMAIN-SUFFIX,hdchina.org
- DOMAIN-SUFFIX,hdcmct.org
- DOMAIN-SUFFIX,hjfile.cn
- DOMAIN-SUFFIX,hkserversolution.com
- DOMAIN-SUFFIX,hollisterco.com
- DOMAIN-SUFFIX,hongxiu.com
- DOMAIN-SUFFIX,hujiang.com
- DOMAIN-SUFFIX,hxcdn.net
- DOMAIN-SUFFIX,icedropper.com
- DOMAIN-SUFFIX,iciba.com
- DOMAIN-SUFFIX,ifeng.com
- DOMAIN-SUFFIX,ifengimg.com
- DOMAIN-SUFFIX,images-amazon.com
- DOMAIN-SUFFIX,img4me.com
- DOMAIN-SUFFIX,ithome.com
- DOMAIN-SUFFIX,ixdzs.com
- DOMAIN-SUFFIX,jd.com
- DOMAIN-SUFFIX,jd.hk
- DOMAIN-SUFFIX,jianshu.com
- DOMAIN-SUFFIX,jianshu.io
- DOMAIN-SUFFIX,jianshuapi.com
- DOMAIN-SUFFIX,jiathis.com
- DOMAIN-SUFFIX,jomodns.com
- DOMAIN-SUFFIX,jsboxbbs.com
- DOMAIN-SUFFIX,knewone.com
- DOMAIN-SUFFIX,kuaidi100.com
- DOMAIN-SUFFIX,kugou.com
- DOMAIN-SUFFIX,lecloud.com
- DOMAIN-SUFFIX,lemicp.com
- DOMAIN-SUFFIX,letv.com
- DOMAIN-SUFFIX,letvcloud.com
- DOMAIN-SUFFIX,liyuans.com
- DOMAIN-SUFFIX,lizhi.io
- DOMAIN-SUFFIX,localizecdn.com
- DOMAIN-SUFFIX,lucifr.com
- DOMAIN-SUFFIX,luoo.net
- DOMAIN-SUFFIX,lxdns.com
- DOMAIN-SUFFIX,mai.tn
- DOMAIN-SUFFIX,meizu.com
- DOMAIN-SUFFIX,metatrader4.com
- DOMAIN-SUFFIX,metatrader5.com
- DOMAIN-SUFFIX,mi.com
- DOMAIN-SUFFIX,miaopai.com
- DOMAIN-SUFFIX,miui.com
- DOMAIN-SUFFIX,miwifi.com
- DOMAIN-SUFFIX,mob.com
- DOMAIN-SUFFIX,moji.com
- DOMAIN-SUFFIX,moke.com
- DOMAIN-SUFFIX,mxhichina.com
- DOMAIN-SUFFIX,myqcloud.com
- DOMAIN-SUFFIX,myunlu.com
- DOMAIN-SUFFIX,ngabbs.com
- DOMAIN-SUFFIX,netease.com
- DOMAIN-SUFFIX,nfoservers.com
- DOMAIN-SUFFIX,nssurge.com
- DOMAIN-SUFFIX,nuomi.com
- DOMAIN-SUFFIX,ourbits.club
- DOMAIN-SUFFIX,ourdvs.com
- DOMAIN-SUFFIX,passthepopcorn.me
- DOMAIN-SUFFIX,pgyer.com
- DOMAIN-SUFFIX,pniao.com
- DOMAIN-SUFFIX,privatehd.to
- DOMAIN-SUFFIX,qbox.me
- DOMAIN-SUFFIX,qcloud.com
- DOMAIN-SUFFIX,qdaily.com
- DOMAIN-SUFFIX,qdmm.com
- DOMAIN-SUFFIX,qhimg.com
- DOMAIN-SUFFIX,qidian.com
- DOMAIN-SUFFIX,qihucdn.com
- DOMAIN-SUFFIX,qin.io
- DOMAIN-SUFFIX,qingmang.me
- DOMAIN-SUFFIX,qingmang.mobi
- DOMAIN-SUFFIX,qiniucdn.com
- DOMAIN-SUFFIX,qiniudn.com
- DOMAIN-SUFFIX,qq.com
- DOMAIN-SUFFIX,qqurl.com
- DOMAIN-SUFFIX,rarbg.to
- DOMAIN-SUFFIX,redacted.ch
- DOMAIN-SUFFIX,rrmj.tv
- DOMAIN-SUFFIX,ruguoapp.com
- DOMAIN-SUFFIX,sandai.net
- DOMAIN-SUFFIX,sf-express.com
- DOMAIN-SUFFIX,sinaapp.com
- DOMAIN-SUFFIX,sinaimg.cn
- DOMAIN-SUFFIX,sinaimg.com
- DOMAIN-SUFFIX,sm.ms
- DOMAIN-SUFFIX,smzdm.com
- DOMAIN-SUFFIX,snwx.com
- DOMAIN-SUFFIX,so.com
- DOMAIN-SUFFIX,sogou.com
- DOMAIN-SUFFIX,sogoucdn.com
- DOMAIN-SUFFIX,sohu.com
- DOMAIN-SUFFIX,soku.com
- DOMAIN-SUFFIX,soso.com
- DOMAIN-SUFFIX,sspai.com
- DOMAIN-SUFFIX,startssl.com
- DOMAIN-SUFFIX,suning.com
- DOMAIN-SUFFIX,symcd.com
- DOMAIN-SUFFIX,taobao.com
- DOMAIN-SUFFIX,tawk.link
- DOMAIN-SUFFIX,tawk.to
- DOMAIN-SUFFIX,tenpay.com
- DOMAIN-SUFFIX,tietuku.com
- DOMAIN-SUFFIX,tmall.com
- DOMAIN-SUFFIX,tmzvps.com
- DOMAIN-SUFFIX,trello.com
- DOMAIN-SUFFIX,trellocdn.com
- DOMAIN-SUFFIX,totheglory.im
- DOMAIN-SUFFIX,ttmeiju.com
- DOMAIN-SUFFIX,tudou.com
- DOMAIN-SUFFIX,udache.com
- DOMAIN-SUFFIX,umengcloud.com
- DOMAIN-SUFFIX,upaiyun.com
- DOMAIN-SUFFIX,upyun.com
- DOMAIN-SUFFIX,uxengine.net
- DOMAIN-SUFFIX,wandoujia.com
- DOMAIN-SUFFIX,weather.bjango.com
- DOMAIN-SUFFIX,weather.com
- DOMAIN-SUFFIX,webqxs.com
- DOMAIN-SUFFIX,weibo.cn
- DOMAIN-SUFFIX,weibo.com
- DOMAIN-SUFFIX,weico.cc
- DOMAIN-SUFFIX,weiphone.com
- DOMAIN-SUFFIX,weiphone.net
- DOMAIN-SUFFIX,wenku8.net
- DOMAIN-SUFFIX,werewolf.53site.com
- DOMAIN-SUFFIX,wkcdn.com
- DOMAIN-SUFFIX,xdrig.com
- DOMAIN-SUFFIX,xhostfire.com
- DOMAIN-SUFFIX,xhscdn.com
- DOMAIN-SUFFIX,xiaohongshu.com
- DOMAIN-SUFFIX,xiaojukeji.com
- DOMAIN-SUFFIX,xiaomi.com
- DOMAIN-SUFFIX,xiaomi.net
- DOMAIN-SUFFIX,xiaomicp.com
- DOMAIN-SUFFIX,ximalaya.com
- DOMAIN-SUFFIX,xitek.com
- DOMAIN-SUFFIX,xmcdn.com
- DOMAIN-SUFFIX,xslb.net
- DOMAIN-SUFFIX,yach.me
- DOMAIN-SUFFIX,yeepay.com
- DOMAIN-SUFFIX,yhd.com
- DOMAIN-SUFFIX,yinxiang.com
- DOMAIN-SUFFIX,yixia.com
- DOMAIN-SUFFIX,ykimg.com
- DOMAIN-SUFFIX,youdao.com
- DOMAIN-SUFFIX,youku.com
- DOMAIN-SUFFIX,yunjiasu-cdn.net
- DOMAIN-SUFFIX,zealer.com
- DOMAIN-SUFFIX,zgslb.net
- DOMAIN-SUFFIX,zhihu.com
- DOMAIN-SUFFIX,zhimg.com
- DOMAIN-SUFFIX,zimuzu.tv
- DOMAIN-SUFFIX,zmz002.com
- IP-CIDR,1.255.62.0/24,no-resolve
# > CN
- DOMAIN-SUFFIX,gov.cn
- DOMAIN-SUFFIX,cn
File diff suppressed because it is too large. Load diff
Loaded 100 of 14253 files, more files were not shown because too many files have changed in this diff. Show more