diff --git a/luci-app-openclash/Makefile b/luci-app-openclash/Makefile index 8878aabe..17315fe2 100644 --- a/luci-app-openclash/Makefile +++ b/luci-app-openclash/Makefile @@ -1,8 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-openclash -PKG_VERSION:=0.46.050 -PKG_RELEASE:=beta +PKG_VERSION:=0.46.064 PKG_MAINTAINER:=vernesong PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -57,7 +56,7 @@ define Build/Prepare $(CP) $(CURDIR)/luasrc $(PKG_BUILD_DIR) $(foreach po,$(wildcard ${CURDIR}/po/zh-cn/*.po), \ po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));) - sed -i "s/v0.00.00-beta/v$(PKG_VERSION)-beta/g" $(PKG_BUILD_DIR)/root/www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1 + sed -i "s/v0.00.00/v$(PKG_VERSION)/g" $(PKG_BUILD_DIR)/root/www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1 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 @@ -105,7 +104,7 @@ endef define Package/$(PKG_NAME)/postinst #!/bin/sh - sed -i "s/v0.00.00-beta/v$(PKG_VERSION)-beta/g" /www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1 + sed -i "s/v0.00.00/v$(PKG_VERSION)/g" /www/luci-static/resources/openclash/img/version.svg >/dev/null 2>&1 exit 0 endef @@ -113,6 +112,7 @@ 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 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/yacd" "/tmp/openclash_yacd" >/dev/null 2>&1 @@ -122,9 +122,15 @@ endef define Package/$(PKG_NAME)/postrm #!/bin/sh - dnsmasqconfdir="$(uci -q get dhcp.@dnsmasq[0].confdir || echo '/tmp/dnsmasq.d')" - dnsmasqconfdir="${dnsmasqconfdir%*/}" + DEFAULT_DNSMASQ_CFGID="$$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')" + 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")" + 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 @@ -135,9 +141,9 @@ define Package/$(PKG_NAME)/postrm 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/backup >/dev/null 2>&1 - rm -rf ${dnsmasqconfdir}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1 - rm -rf ${dnsmasqconfdir}/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1 - rm -rf ${dnsmasqconfdir}/dnsmasq_openclash_chnroute6_pass.conf >/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 @@ -146,8 +152,10 @@ define Package/$(PKG_NAME)/postrm 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 diff --git a/luci-app-openclash/luasrc/controller/openclash.lua b/luci-app-openclash/luasrc/controller/openclash.lua index d65ad4a4..533ce172 100644 --- a/luci-app-openclash/luasrc/controller/openclash.lua +++ b/luci-app-openclash/luasrc/controller/openclash.lua @@ -104,6 +104,8 @@ local device_arh = luci.sys.exec("uname -m |tr -d '\n'") if pcall(require, "luci.model.ipkg") then opkg = require "luci.model.ipkg" +else + opkg = nil end local core_path_mode = uci:get("openclash", "config", "small_flash_memory") @@ -158,19 +160,8 @@ local function chnroutev6() end local function daip() - local daip, lan_int_name - lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0" - if lan_int_name == "0" then - daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'") - else - daip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name)) - end - if not daip or daip == "" then - daip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'") - end - if not daip or daip == "" then - daip = luci.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 + local daip + daip = fs.lanip() return daip end @@ -212,11 +203,23 @@ local function startlog() return line_trans end +local function pkg_type() + if fs.access("/usr/bin/apk") then + return "apk" + else + return "opkg" + end +end + local function coremodel() if opkg and opkg.info("libc") and opkg.info("libc")["libc"] then return opkg.info("libc")["libc"]["Architecture"] else - return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null") + if fs.access("/bin/opkg") then + return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null") + elseif fs.access("/usr/bin/apk") then + return luci.sys.exec("apk list libc 2>/dev/null |awk '{print $2}'") + end end end @@ -246,7 +249,11 @@ local function opcv() if opkg and opkg.info("luci-app-openclash") and opkg.info("luci-app-openclash")["luci-app-openclash"] then return "v" .. opkg.info("luci-app-openclash")["luci-app-openclash"]["Version"] else - return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'") + if fs.access("/bin/opkg") then + return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'") + elseif fs.access("/usr/bin/apk") then + return "v" .. luci.sys.exec("apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1") + end end end @@ -614,10 +621,18 @@ function set_subinfo_url() end function sub_info_get() - local filepath, filename, sub_url, sub_info, info, upload, download, total, expire, http_code, len, percent, day_left, day_expire, surplus, used + local sub_ua, filepath, filename, sub_url, sub_info, info, upload, download, total, expire, http_code, len, percent, day_left, day_expire, surplus, used local info_tb = {} filename = luci.http.formvalue("filename") sub_info = "" + sub_ua = "Clash" + uci:foreach("openclash", "config_subscribe", + function(s) + if s.name == filename and s.sub_ua then + sub_ua = s.sub_ua + end + end + ) if filename and not is_start() then uci:foreach("openclash", "subscribe_info", function(s) @@ -640,7 +655,7 @@ function sub_info_get() if not sub_url then sub_info = "No Sub Info Found" else - info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 -w 'http_code='%%{http_code} -H 'User-Agent: Clash' '%s'", sub_url)) + info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 -w 'http_code='%%{http_code} -H 'User-Agent: %s' '%s'", sub_ua, sub_url)) if not info or tonumber(string.sub(string.match(info, "http_code=%d+"), 11, -1)) ~= 200 then info = luci.sys.exec(string.format("curl -sLI -X GET -m 10 -w 'http_code='%%{http_code} -H 'User-Agent: Quantumultx' '%s'", sub_url)) end @@ -660,20 +675,34 @@ function sub_info_get() expire = os.date("%Y-%m-%d", day_expire) or "null" if day_expire and os.time() <= day_expire then day_left = math.ceil((day_expire - os.time()) / (3600*24)) + if math.ceil(day_left / 365) > 50 then + day_left = "∞" + end elseif day_expire == nil then day_left = "null" else day_left = 0 end - if used and total and used < total then + if used and total and used <= total then percent = string.format("%.1f",((total-used)/total)*100) or nil - elseif used == nil or total == nil or total == 0 then + surplus = fs.filesize(total - used) or "null" + elseif used == nil and total and total > 0.0 then percent = 100 + surplus = total + elseif total and total == 0.0 then + percent = 100 + surplus = "∞" else percent = 0 + surplus = "null" + end + if total and total > 0.0 then + total = fs.filesize(total) or "null" + elseif total and total == 0.0 then + total = "∞" + else + total = "null" end - surplus = fs.filesize(total - used) or "null" - total = fs.filesize(total) or "null" used = fs.filesize(used) or "null" sub_info = "Successful" else @@ -816,7 +845,7 @@ end local function s(e) local t=0 -local a={' B/S',' KB/S',' MB/S',' GB/S',' TB/S'} +local a={' B/S',' KB/S',' MB/S',' GB/S',' TB/S',' PB/S'} if (e<=1024) then return e..a[1] else @@ -1080,6 +1109,7 @@ function action_update_ma() luci.http.prepare_content("application/json") luci.http.write_json({ oplv = oplv(), + pkg_type = pkg_type(), corelv = corelv(), corever = corever(); }) diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/client.lua b/luci-app-openclash/luasrc/model/cbi/openclash/client.lua index 1893ddf4..76ff70a3 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/client.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/client.lua @@ -75,7 +75,7 @@ if a then ck.template="openclash/cfg_check" sb.template="openclash/sub_info_show" - btnis=tb:option(Button,"switch",translate("Switch")) + 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 diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua b/luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua index 72b13a91..4bbf0a71 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua @@ -17,20 +17,7 @@ bold_off = [[]] 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_int_name = 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 |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'") -else - lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name)) -end -if not lan_ip or lan_ip == "" then - lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'") -end -if not lan_ip or lan_ip == "" then - lan_ip = luci.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 +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:").." http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore".. @@ -82,11 +69,10 @@ 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:").." ".."https://mirror.ghproxy.com/" +o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."https://ghp.ci/" o:value("0", translate("Disable")) o:value("https://fastly.jsdelivr.net/") o:value("https://testingcf.jsdelivr.net/") -o:value("https://raw.fastgit.org/") o:value("https://cdn.jsdelivr.net/") o.default = "0" diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua b/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua index fb834b84..8f2488e0 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua @@ -86,9 +86,10 @@ 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") o:value("clash.meta") -o.default = "Clash" +o:value("clash-verge/v1.5.1") +o:value("Clash") +o.default = "clash.meta" o.rmempty = true ---- subconverter diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/config.lua b/luci-app-openclash/luasrc/model/cbi/openclash/config.lua index 0a682018..7bd29227 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/config.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/config.lua @@ -201,7 +201,7 @@ st.template="openclash/cfg_check" ck.template="openclash/cfg_check" sb.template="openclash/sub_info_show" -btnis=tb:option(Button,"switch",translate("Switch")) +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 diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua b/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua index 0de1378e..fde0859c 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua @@ -95,6 +95,17 @@ end o:value("DIRECT") o:value("REJECT") +o = s:option(ListValue, "MainlandTV", translate("CN Mainland TV")) +o:depends("rule_name", "lhie1") +o.rmempty = true +for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do + if groupname ~= nil and groupname ~= "" then + o:value(groupname) + end +end +o:value("DIRECT") +o:value("REJECT") + o = s:option(ListValue, "Proxy", translate("Proxy")) o:depends("rule_name", "lhie1") o.rmempty = true @@ -150,17 +161,6 @@ end o:value("DIRECT") o:value("REJECT") -o = s:option(ListValue, "HBOGo", translate("HBO Go")) -o:depends("rule_name", "lhie1") -o.rmempty = true -for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do - if groupname ~= nil and groupname ~= "" then - o:value(groupname) - end -end -o:value("DIRECT") -o:value("REJECT") - o = s:option(ListValue, "Pornhub", translate("Pornhub")) o:depends("rule_name", "lhie1") o.rmempty = true @@ -381,6 +381,17 @@ end o:value("DIRECT") o:value("REJECT") +o = s:option(ListValue, "HTTPDNS", translate("HTTPDNS")) +o:depends("rule_name", "lhie1") +o.rmempty = true +for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do + if groupname ~= nil and groupname ~= "" then + o:value(groupname) + end +end +o:value("DIRECT") +o:value("REJECT") + o = s:option(ListValue, "Domestic", translate("Domestic")) o:depends("rule_name", "lhie1") o.rmempty = true diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua b/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua index 3e28e08f..1962f602 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua @@ -29,8 +29,6 @@ o = s:option(ListValue, "rule_sources", translate("Choose Template For Create Co o.description = translate("Use Other Rules To Create Config") o:depends("create_config", 1) o:value("lhie1", translate("lhie1 Rules")) -o:value("ConnersHua", translate("ConnersHua(Provider-type) Rules")) -o:value("ConnersHua_return", translate("ConnersHua Return 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 @@ -255,24 +253,27 @@ o = a:option(Button,"Load_Config", " ") o.inputtitle = translate("Read Config") o.inputstyle = "apply" o.write = function() - luci.sys.call("/usr/share/openclash/yml_groups_get.sh 2>/dev/null &") - luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash")) + 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") + 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() - 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")) + 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")) diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua b/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua index 675d9914..52df2871 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua @@ -16,19 +16,7 @@ bold_off = [[]] 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_int_name = 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 |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'") -else - lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name)) -end -if not lan_ip or lan_ip == "" then - lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'") -end -if not lan_ip or lan_ip == "" then - lan_ip = luci.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 +local lan_ip = fs.lanip() m = Map("openclash", translate("Plugin Settings")) m.pageaction = false m.description = translate("Note: To restore the default configuration, try accessing:").." http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore".. @@ -204,10 +192,63 @@ mac_w.datatype = "list(macaddr)" mac_w.rmempty = true mac_w:depends("lan_ac_mode", "1") +o = s:taboption("lan_ac", DynamicList, "wan_ac_black_ips", translate("WAN Bypassed Host List")) +o.datatype = "ipmask" +o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported") + +s2 = m:section(TypedSection, "lan_ac_traffic", translate("Lan Traffic Access List"), + "1."..translate("The Traffic From The Local Specified Port Will Not Pass The Core, Try To Set When The Bypass Gateway Forwarding Fails").."; ".."2."..translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported")) + +s2.template = "cbi/tblsection" +s2.sortable = true +s2.anonymous = true +s2.addremove = true +s2.rmempty = false + +o = s2:option(Value, "comment", translate("Comment")) +o.rmempty = true + +o = s2:option(Flag, "enabled", translate("Enable")) +o.rmempty = false +o.default = o.enabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "1" +end + +ip_ac = s2:option(Value, "src_ip", translate("Internal addresses")) +ip_ac.datatype = "ipmask" +ip_ac.placeholder = "0.0.0.0/0" +ip_ac.rmempty = false + +o = s2:option(Value, "src_port", translate("Internal ports")) +o.datatype = "or(port, portrange)" +o.placeholder = translate("5000 or 1234-2345") +o.rmempty = false + +o = s2:option(ListValue, "proto", translate("Proto")) +o:value("udp", translate("UDP")) +o:value("tcp", translate("TCP")) +o:value("both", translate("Both")) +o.default = "tcp" +o.rmempty = false + +o = s2:option(ListValue, "family", translate("Family")) +o:value("ipv4", translate("IPv4")) +o:value("ipv6", translate("IPv6")) +o:value("both", translate("Both")) +o.default = "tcp" +o.rmempty = false + +o = s2:option(ListValue, "target", translate("Target")) +o:value("return", translate("Return")) +o:value("accept", translate("Accept")) +o.rmempty = false + luci.ip.neighbors({ family = 4 }, function(n) if n.mac and n.dest then ip_b:value(n.dest:string()) ip_w:value(n.dest:string()) + ip_ac:value(n.dest:string()) mac_b:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() }) mac_w:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() }) end @@ -218,22 +259,13 @@ luci.ip.neighbors({ family = 6 }, function(n) if n.mac and n.dest then ip_b:value(n.dest:string()) ip_w:value(n.dest:string()) + ip_ac:value(n.dest:string()) mac_b:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() }) mac_w:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() }) end end) end -o = s:taboption("lan_ac", DynamicList, "wan_ac_black_ips", translate("WAN Bypassed Host List")) -o.datatype = "ipmask" -o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported") - -o = s:taboption("lan_ac", DynamicList, "lan_ac_black_ports", translate("Lan Bypassed Port List")) -o.datatype = "or(port, portrange)" -o.placeholder = translate("5000 or 1234-2345") -o:value("5000", translate("5000(NAS)")) -o.description = "1."..translate("The Traffic From The Local Specified Port Will Not Pass The Core, Try To Set When The Bypass Gateway Forwarding Fails").."
".."2."..translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported") - ---- Traffic Control o = s:taboption("traffic_control", Flag, "router_self_proxy", font_red..bold_on..translate("Router-Self Proxy")..bold_off..font_off) o.description = translate("Only Supported for Rule Mode")..", "..font_red..bold_on..translate("ALL Functions In Stream Enhance Tag Will Not Work After Disable")..bold_off..font_off @@ -496,28 +528,6 @@ o.template = "openclash/other_stream_option" o.value = "Amazon Prime Video" o:depends("stream_auto_select_prime_video", "1") ---HBO Now -o = s:taboption("stream_enhance", Flag, "stream_auto_select_hbo_now", font_red..translate("HBO Now")..font_off) -o.default = 0 -o:depends("stream_auto_select", "1") - -o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_hbo_now", translate("Group Filter")) -o.default = "HBO|HBONow|HBO Now" -o.placeholder = "HBO|HBONow|HBO Now" -o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails") -o:depends("stream_auto_select_hbo_now", "1") - -o = s:taboption("stream_enhance", Value, "stream_auto_select_node_key_hbo_now", translate("Unlock Nodes Filter")) -o.default = "" -o.description = translate("It Will Be Selected Nodes According To The Regex") -o:depends("stream_auto_select_hbo_now", "1") - -o = s:taboption("stream_enhance", DummyValue, "HBO Now", translate("Manual Test")) -o.rawhtml = true -o.template = "openclash/other_stream_option" -o.value = "HBO Now" -o:depends("stream_auto_select_hbo_now", "1") - --HBO Max o = s:taboption("stream_enhance", Flag, "stream_auto_select_hbo_max", font_red..translate("HBO Max")..font_off) o.default = 0 @@ -552,40 +562,6 @@ o.template = "openclash/other_stream_option" o.value = "HBO Max" o:depends("stream_auto_select_hbo_max", "1") ---HBO GO Asia -o = s:taboption("stream_enhance", Flag, "stream_auto_select_hbo_go_asia", font_red..translate("HBO GO Asia")..font_off) -o.default = 0 -o:depends("stream_auto_select", "1") - -o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_hbo_go_asia", translate("Group Filter")) -o.default = "HBO|HBOGO|HBO GO" -o.placeholder = "HBO|HBOGO|HBO GO" -o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails") -o:depends("stream_auto_select_hbo_go_asia", "1") - -o = s:taboption("stream_enhance", Value, "stream_auto_select_region_key_hbo_go_asia", translate("Unlock Region Filter")) -o.default = "" -o.placeholder = "HK|SG|TW" -o.description = translate("It Will Be Selected Region(Country Shortcode) According To The Regex") -o:depends("stream_auto_select_hbo_go_asia", "1") -function o.validate(self, value) - if value ~= m.uci:get("openclash", "config", "stream_auto_select_region_key_hbo_go_asia") then - fs.unlink("/tmp/openclash_HBO GO Asia_region") - end - return value -end - -o = s:taboption("stream_enhance", Value, "stream_auto_select_node_key_hbo_go_asia", translate("Unlock Nodes Filter")) -o.default = "" -o.description = translate("It Will Be Selected Nodes According To The Regex") -o:depends("stream_auto_select_hbo_go_asia", "1") - -o = s:taboption("stream_enhance", DummyValue, "HBO GO Asia", translate("Manual Test")) -o.rawhtml = true -o.template = "openclash/other_stream_option" -o.value = "HBO GO Asia" -o:depends("stream_auto_select_hbo_go_asia", "1") - --TVB Anywhere+ o = s:taboption("stream_enhance", Flag, "stream_auto_select_tvb_anywhere", font_red..translate("TVB Anywhere+")..font_off) o.default = 0 @@ -787,7 +763,7 @@ o:depends("stream_auto_select", "1") o = s:taboption("stream_enhance", Value, "stream_auto_select_group_key_openai", translate("Group Filter")) o.default = "OpenAI|ChatGPT" -o.placeholder = "OpenAI|ChatGPT" +o.placeholder = "OpenAI|ChatGPT|AI" o.description = translate("It Will Be Searched According To The Regex When Auto Search Group Fails") o:depends("stream_auto_select_openai", "1") diff --git a/luci-app-openclash/luasrc/openclash.lua b/luci-app-openclash/luasrc/openclash.lua index 5142a86e..dd863804 100644 --- a/luci-app-openclash/luasrc/openclash.lua +++ b/luci-app-openclash/luasrc/openclash.lua @@ -29,6 +29,8 @@ 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 @@ -255,10 +257,27 @@ end function filesize(e) local t=0 - local a={' KB',' MB',' GB',' TB'} + local a={' KB',' MB',' GB',' TB',' PB'} repeat e=e/1024 t=t+1 until(e<=1024) return string.format("%.1f",e)..a[t] +end + +function lanip() + local lan_int_name = 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 |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'") + else + lan_ip = SYS.exec(string.format("ip address show %s | 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.ifname || 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 \ No newline at end of file diff --git a/luci-app-openclash/luasrc/view/openclash/dlercloud.htm b/luci-app-openclash/luasrc/view/openclash/dlercloud.htm index f3af937c..830c404c 100644 --- a/luci-app-openclash/luasrc/view/openclash/dlercloud.htm +++ b/luci-app-openclash/luasrc/view/openclash/dlercloud.htm @@ -111,6 +111,7 @@ padding-top: 5px; margin: 0 0 0 -12%; line-height: 35px; + color: black; } .card .general .dler-info { @@ -177,8 +178,9 @@ .card .general .btn { color: #fff; - border-color: #337ab7; + border-color: #337ab7 !important; background: #1473e6; + background-color: #1473e6 !important; box-shadow: 0 8px 16px -8px rgba(0,0,0,0.4); border-radius: 6px; width: 90px; diff --git a/luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm b/luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm index 3acbaf9e..d1432eaa 100644 --- a/luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm +++ b/luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm @@ -82,10 +82,9 @@
https://fastly.jsdelivr.net/
https://testingcf.jsdelivr.net/
-
https://raw.fastgit.org/
https://cdn.jsdelivr.net/
<%:Custom Your CDN URL%>
- +
diff --git a/luci-app-openclash/luasrc/view/openclash/status.htm b/luci-app-openclash/luasrc/view/openclash/status.htm index 07fad125..921be556 100644 --- a/luci-app-openclash/luasrc/view/openclash/status.htm +++ b/luci-app-openclash/luasrc/view/openclash/status.htm @@ -176,7 +176,7 @@
- +

<%:Please ensure that all items are displayed normally before running. If you need to update, please go to the global settings page%> @@ -678,7 +678,7 @@ function ws_mmessage(event) { var data = JSON.parse(event.data) if (data.inuse) { - document.getElementById("mem_t").innerHTML = ""+bytesToSize(data.inuse)+"/S"; + document.getElementById("mem_t").innerHTML = ""+bytesToSize(data.inuse)+""; } else { document.getElementById("mem_t").innerHTML = "0 KB"; @@ -687,7 +687,7 @@ }; function bytesToSize(bytes) { - var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; if (bytes == 0) return '0 B'; var i = Math.floor(Math.log(bytes) / Math.log(1024)); return i == 0 ? (bytes / Math.pow(1024, i)) + ' ' + sizes[i] : (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; diff --git a/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm b/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm index deab3901..8738f170 100644 --- a/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm +++ b/luci-app-openclash/luasrc/view/openclash/sub_info_show.htm @@ -12,7 +12,6 @@ .sub_tab_show{ display: inline-block; white-space: nowrap; - color: var(--gray-dark); font-size: 12px; margin: 0 auto; -webkit-transition: all 1.5s; @@ -36,6 +35,18 @@ white-space: nowrap; } +:root[data-darkmode="true"] { + + #icon_wrench { + -webkit-filter: invert(1); + filter: invert(1); + } + #icon_arrow { + -webkit-filter: invert(1); + filter: invert(1); + } +} + <% @@ -44,7 +55,7 @@ local filename = fs.filename(val) local idname = math.random(1000)..(string.match(filename, "[%w_]+") or "") %> -

   <%:Refresh%> <%:Specify URL%>
+
   <%:Refresh%> <%:Specify URL%>
- + + + diff --git a/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/manifest.webmanifest b/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/manifest.webmanifest index cef9c8ad..8120df4e 100644 --- a/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/manifest.webmanifest +++ b/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/manifest.webmanifest @@ -1 +1 @@ -{"name":"metacubexd","short_name":"metacubexd","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./","icons":[{"src":"pwa-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/pwa-512x512.png","sizes":"512x512","type":"image/png"},{"src":"pwa-512x512.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}]} +{"name":"MetaCubeXD","short_name":"MetaCubeXD","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./","description":"Mihomo Dashboard, The Official One, XD","theme_color":"#000000","icons":[{"src":"pwa-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/pwa-512x512.png","sizes":"512x512","type":"image/png"},{"src":"pwa-512x512.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}]} diff --git a/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/sw.js b/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/sw.js index d4fc40e0..80c6406d 100644 --- a/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/sw.js +++ b/luci-app-openclash/root/usr/share/openclash/ui/metacubexd/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const i=(i,n)=>(i=new URL(i+".js",n).href,e[i]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()})).then((()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s})));self.define=(n,r)=>{const l=s||("document"in self?document.currentScript.src:"")||location.href;if(e[l])return;let o={};const t=s=>i(s,l),u={module:{uri:l},exports:o,require:t};e[l]=Promise.all(n.map((s=>u[s]||t(s)))).then((s=>(r(...s),o)))}}define(["./workbox-e1498109"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/Config-CcYWVyqe.js",revision:null},{url:"assets/Connections-CVJiJJwm.js",revision:null},{url:"assets/global-Cq-x4U7Q.js",revision:null},{url:"assets/IconReload-C5Iuvpd-.js",revision:null},{url:"assets/index-D_QrDGkm.css",revision:null},{url:"assets/index-DACeLBg-.js",revision:null},{url:"assets/index-GtOz1sEE.js",revision:null},{url:"assets/Logs-LisT8FTz.js",revision:null},{url:"assets/Overview-DiEjGL5X.js",revision:null},{url:"assets/Proxies-A8q5R6Aj.js",revision:null},{url:"assets/Rules-BskxbInP.js",revision:null},{url:"assets/Setup-e28eI3Pt.js",revision:null},{url:"index.html",revision:"4b5142ca4adf9805cc0d4cecaf0ff1cc"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"favicon.svg",revision:"f5b3372f312fbbe60a6ed8c03741ff80"},{url:"pwa-192x192.png",revision:"c45f48fc59b5bf47e6cbf1626aff51fc"},{url:"pwa-512x512.png",revision:"a311504ae6a46bd29b5678a410aaafc6"},{url:"manifest.webmanifest",revision:"4d78c8bc6207146065400ff644fe5a13"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))})); +if(!self.define){let s,e={};const i=(i,n)=>(i=new URL(i+".js",n).href,e[i]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()})).then((()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s})));self.define=(n,l)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let o={};const t=s=>i(s,r),u={module:{uri:r},exports:o,require:t};e[r]=Promise.all(n.map((s=>u[s]||t(s)))).then((s=>(l(...s),o)))}}define(["./workbox-e1498109"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/Config-9NNS9COU.js",revision:null},{url:"assets/Connections-N_Z6THP_.js",revision:null},{url:"assets/DocumentTitle-DG90V81t.js",revision:null},{url:"assets/IconReload--QlVe2wP.js",revision:null},{url:"assets/index-CBBLUqwt.js",revision:null},{url:"assets/index-Csmv4Fkv.js",revision:null},{url:"assets/index-M06kPDrB.css",revision:null},{url:"assets/Logs-uIQcQmXC.js",revision:null},{url:"assets/Overview-B99qGorf.js",revision:null},{url:"assets/Proxies-Lk5uJ4LX.js",revision:null},{url:"assets/Rules-C4_l0aqo.js",revision:null},{url:"assets/Setup-CdphtcBj.js",revision:null},{url:"assets/time-CHbJgbks.js",revision:null},{url:"index.html",revision:"0ee677309471325e9389528536c80875"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"favicon.svg",revision:"f5b3372f312fbbe60a6ed8c03741ff80"},{url:"pwa-192x192.png",revision:"c45f48fc59b5bf47e6cbf1626aff51fc"},{url:"pwa-512x512.png",revision:"a311504ae6a46bd29b5678a410aaafc6"},{url:"manifest.webmanifest",revision:"f0952d333375ba4273b4372ffa349b8b"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))})); diff --git a/luci-app-openclash/root/usr/share/openclash/yml_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_change.sh index 4bca0bef..233c4364 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_change.sh @@ -341,11 +341,12 @@ threads << Thread.new { Value['log-level']='$9'; end; Value['allow-lan']=true; - Value['disable-keep-alive']=true; Value['external-controller']='0.0.0.0:$3'; Value['secret']='$2'; Value['bind-address']='*'; Value['external-ui']='/usr/share/openclash/ui'; + Value['keep-alive-interval']=15; + Value['keep-alive-idle']=600; if $6 == 1 then Value['ipv6']=true; else @@ -421,10 +422,7 @@ threads << Thread.new { Value['tun']['device']='utun'; Value_2={'dns-hijack'=>['tcp://any:53']}; Value['tun'].merge!(Value_2); - if '$stack_type' != 'mixed' then - Value['tun']['gso']=true; - Value['tun']['gso-max-size']=65536; - end; + Value['tun']['endpoint-independent-nat']=true; Value['tun']['auto-route']=false; Value['tun']['auto-detect-interface']=false; Value['tun']['auto-redirect']=false; @@ -452,7 +450,7 @@ threads << Thread.new { Value.delete('ebpf'); end; - if '${37}' == '0' then + if '${35}' == '0' then Value['routing-mark']=6666; else if Value.key?('routing-mark') then @@ -789,6 +787,8 @@ begin YAML.LOG('Tip: Respect-rules Option Need Proxy-server-nameserver Option Must Be Setted, Auto Set to【114.114.114.114, 119.29.29.29, 8.8.8.8, 1.1.1.1】'); end; end; +rescue Exception => e + YAML.LOG('Error: Config File Overwrite Failed,【' + e.message + '】'); ensure File.open('$5','w') {|f| YAML.dump(Value, f)}; end" 2>/dev/null >> $LOG_FILE \ No newline at end of file diff --git a/luci-app-openclash/root/usr/share/openclash/yml_groups_get.sh b/luci-app-openclash/root/usr/share/openclash/yml_groups_get.sh index 07cb7437..d19545f2 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_groups_get.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_groups_get.sh @@ -242,7 +242,8 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " x['proxies'].each{ |y| if Value_1.include?(y) then - uci_commands << uci_add + 'other_group=\"^' + y.to_s + '$\"' + commands = uci_add + 'other_group=\"^' + y.to_s + '$\"' + system(commands) end } end diff --git a/luci-app-openclash/root/usr/share/openclash/yml_groups_name_ch.sh b/luci-app-openclash/root/usr/share/openclash/yml_groups_name_ch.sh index b12b54c9..33080ab8 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_groups_name_ch.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_groups_name_ch.sh @@ -47,7 +47,7 @@ cfg_groups_set() sed -i "s/new_servers_group \'${convert_old_name_cfg}\'/new_servers_group \'${convert_name}\'/g" $CFG_FILE 2>/dev/null sed -i "s/relay_groups \'${convert_old_name_cfg}\'/relay_groups \'${convert_name}\'/g" $CFG_FILE 2>/dev/null #第三方规则处理 - OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOGo" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others" "miHoYo" "AI Suite" "AppleTV" "Crypto" "Discord") + OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "MainlandTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others" "miHoYo" "AI_Suite" "AppleTV" "Crypto" "Discord" "HTTPDNS") for i in ${OTHER_RULE_NAMES[@]}; do sed -i "s/option ${i} \'${convert_old_name_cfg}\'/option ${i} \'${convert_name}\'/g" $CFG_FILE 2>/dev/null done 2>/dev/null diff --git a/luci-app-openclash/root/usr/share/openclash/yml_proxys_get.sh b/luci-app-openclash/root/usr/share/openclash/yml_proxys_get.sh index aa9b44ca..6fd9bbf9 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_proxys_get.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_proxys_get.sh @@ -171,8 +171,8 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " begin YAML.LOG('Start Getting【${CONFIG_NAME} - ' + y['type'].to_s + ' - ' + x.to_s + '】Proxy-provider Setting...'); #代理集存在时获取代理集编号 - cmd = 'grep -E \'\.' + x + '$\' ${match_provider} 2>/dev/null|awk -F \".\" \'{print \$1}\''; - provider_nums=%x(#{cmd}).chomp; + cmd = 'grep -F \'.' + x + '\' ${match_provider} 2>/dev/null |awk -F \".\" \'{print \$1}\''; + provider_nums = %x(#{cmd}).chomp; if not provider_nums.empty? then cmd = 'sed -i \"/^' + provider_nums + '\./c\\#match#\" $match_provider 2>/dev/null'; system(cmd); @@ -181,7 +181,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " uci_add='uci -q add_list openclash.@proxy-provider[' + provider_nums + '].'; uci_del='uci -q delete openclash.@proxy-provider[' + provider_nums + '].'; cmd = uci_get + 'manual'; - if not %x(#{cmd}).chomp then + if not provider_nums then uci_commands << uci_set + 'manual=0'; end; uci_commands << uci_set + 'type=\"' + y['type'].to_s + '\"'; @@ -269,7 +269,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " #新代理集且设置默认策略组时加入指定策略组 new_provider_groups = %x{uci get openclash.config.new_servers_group}.chomp.split(\"'\").map { |x| x.strip }.reject { |x| x.empty? }; new_provider_groups.each do |x| - uci_commands << uci_add + 'groups=\"' + x + '\"' + uci_commands << uci_add + 'groups=\"^' + x + '$\"' end elsif '$servers_if_update' != '1' then threads_agr = []; @@ -304,8 +304,8 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " begin YAML.LOG('Start Getting【${CONFIG_NAME} - ' + x['type'].to_s + ' - ' + x['name'].to_s + '】Proxy Setting...'); #节点存在时获取节点编号 - cmd = 'grep -E \'\.' + x['name'].to_s + '$\' ${match_servers} 2>/dev/null|awk -F \".\" \'{print \$1}\''; - server_num=%x(#{cmd}).chomp; + cmd = 'grep -F \'.' + x['name'].to_s + '\' ${match_servers} 2>/dev/null |awk -F \".\" \'{print \$1}\''; + server_num = %x(#{cmd}).chomp; if not server_num.empty? then #更新已有节点 cmd = 'sed -i \"/^' + server_num + '\./c\\#match#\" $match_servers 2>/dev/null'; @@ -315,7 +315,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " uci_add='uci -q add_list openclash.@servers[' + server_num + '].'; uci_del='uci -q delete openclash.@servers[' + server_num + '].'; cmd = uci_get + 'manual'; - if not %x(#{cmd}).chomp then + if not server_num then uci_commands << uci_set + 'manual=0'; end; else @@ -1329,10 +1329,10 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " threads << Thread.new{ #加入策略组 if '$servers_if_update' == '1' and '$config_group_exist' == '1' and '$servers_update' == '1' and server_num.empty? then - #新代理集且设置默认策略组时加入指定策略组 + #新代理且设置默认策略组时加入指定策略组 new_provider_groups = %x{uci get openclash.config.new_servers_group}.chomp.split(\"'\").map { |x| x.strip }.reject { |x| x.empty? }; new_provider_groups.each do |x| - uci_commands << uci_add + 'groups=\"' + x + '\"' + uci_commands << uci_add + 'groups=\"^' + x + '$\"' end elsif '$servers_if_update' != '1' then threads_gr = []; @@ -1345,7 +1345,7 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " z['proxies'].each{ |v| if v == x['name'] then - uci_commands << uci_add + 'groups=^\"' + z['name'] + '$\"' + uci_commands << uci_add + 'groups=\"^' + z['name'] + '$\"' break end } diff --git a/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh b/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh index f39cd882..184ff626 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh @@ -1577,7 +1577,7 @@ cat >> "$SERVER_FILE" <<-EOF - name: Bilibili type: select proxies: - - Asian TV + - CN Mainland TV - DIRECT EOF cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null @@ -1615,20 +1615,6 @@ cat >> "$SERVER_FILE" <<-EOF EOF fi cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null -cat >> "$SERVER_FILE" <<-EOF - - name: HBO Go - type: select - proxies: - - Global TV - - DIRECT -EOF -cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null -if [ -f "/tmp/Proxy_Provider" ]; then -cat >> "$SERVER_FILE" <<-EOF - use: -EOF -fi -cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null cat >> "$SERVER_FILE" <<-EOF - name: Pornhub type: select @@ -1763,6 +1749,26 @@ cat >> "$SERVER_FILE" <<-EOF - REJECT - DIRECT - Proxy + - name: HTTPDNS + type: select + proxies: + - REJECT + - DIRECT + - Proxy +EOF +cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null +if [ -f "/tmp/Proxy_Provider" ]; then +cat >> "$SERVER_FILE" <<-EOF + use: +EOF +fi +cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null +cat >> "$SERVER_FILE" <<-EOF + - name: CN Mainland TV + type: select + proxies: + - DIRECT + - Proxy EOF cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null if [ -f "/tmp/Proxy_Provider" ]; then @@ -1775,8 +1781,8 @@ cat >> "$SERVER_FILE" <<-EOF - name: Asian TV type: select proxies: - - DIRECT - Proxy + - DIRECT EOF cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null if [ -f "/tmp/Proxy_Provider" ]; then @@ -1879,12 +1885,12 @@ ${uci_set}rule_name="lhie1" ${uci_set}config="$CONFIG_NAME" ${uci_set}GlobalTV="Global TV" ${uci_set}AsianTV="Asian TV" +${uci_set}MainlandTV="CN Mainland TV" ${uci_set}Proxy="Proxy" ${uci_set}Youtube="Youtube" ${uci_set}Bilibili="Bilibili" ${uci_set}Bahamut="Bahamut" ${uci_set}HBOMax="HBO Max" -${uci_set}HBOGo="HBO Go" ${uci_set}Pornhub="Pornhub" ${uci_set}Apple="Apple" ${uci_set}AppleTV="Apple TV" @@ -1900,6 +1906,7 @@ ${uci_set}Spotify="Spotify" ${uci_set}Steam="Steam" ${uci_set}miHoYo="miHoYo" ${uci_set}AdBlock="AdBlock" +${uci_set}HTTPDNS="HTTPDNS" ${uci_set}Speedtest="Speedtest" ${uci_set}Telegram="Telegram" ${uci_set}Crypto="Crypto" @@ -1917,9 +1924,9 @@ ${uci_set}Others="Others" ${UCI_DEL_LIST}="Bilibili" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bilibili" >/dev/null 2>&1 ${UCI_DEL_LIST}="Bahamut" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Bahamut" >/dev/null 2>&1 ${UCI_DEL_LIST}="HBO Max" >/dev/null 2>&1 && ${UCI_ADD_LIST}="HBO Max" >/dev/null 2>&1 - ${UCI_DEL_LIST}="HBO Go" >/dev/null 2>&1 && ${UCI_ADD_LIST}="HBO Go" >/dev/null 2>&1 ${UCI_DEL_LIST}="Pornhub" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Pornhub" >/dev/null 2>&1 ${UCI_DEL_LIST}="Asian TV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Asian TV" >/dev/null 2>&1 + ${UCI_DEL_LIST}="CN Mainland TV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="CN Mainland TV" >/dev/null 2>&1 ${UCI_DEL_LIST}="Global TV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Global TV" >/dev/null 2>&1 ${UCI_DEL_LIST}="Netflix" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netflix" >/dev/null 2>&1 ${UCI_DEL_LIST}="Discovery Plus" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Discovery Plus" >/dev/null 2>&1 diff --git a/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh b/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh index 45aafced..e498e160 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_rules_change.sh @@ -133,8 +133,6 @@ yml_gen_rule_provider_file() else if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then RULE_PROVIDER_FILE_URL="${github_address_mod}gh/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"@master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')"" - elif [ "$github_address_mod" == "https://raw.fastgit.org/" ]; then - RULE_PROVIDER_FILE_URL="https://raw.fastgit.org/"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F '/master' '{print $1}' 2>/dev/null)"/master"$(echo "$RULE_PROVIDER_FILE_URL_PATH" |awk -F 'master' '{print $2}')"" else RULE_PROVIDER_FILE_URL="${github_address_mod}https://raw.githubusercontent.com/${RULE_PROVIDER_FILE_URL_PATH}" fi @@ -288,7 +286,6 @@ yml_other_set() config_foreach yml_rule_group_get "rule_provider_config" "$3" config_foreach yml_rule_group_get "rule_providers" "$3" config_foreach yml_rule_group_get "game_config" "$3" - local fake_ip="$(echo "${11}" |awk -F '/' '{print $1}')" ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e " begin Value = YAML.load_file('$3'); @@ -312,73 +309,41 @@ yml_other_set() Value['rule-providers']=Value_1['rule-providers'] end end; - Value['script']=Value_1['script']; Value['rules']=Value_1['rules']; Value['rules'].to_a.collect!{|x| - x.to_s.gsub(/,[\s]?Bilibili,[\s]?Asian TV$/, ', Bilibili, $Bilibili#delete_') - .gsub(/,[\s]?Bahamut,[\s]?Global TV$/, ', Bahamut, $Bahamut#delete_') - .gsub(/,[\s]?HBO Max,[\s]?Global TV$/, ', HBO Max, $HBOMax#delete_') - .gsub(/,[\s]?HBO Go,[\s]?Global TV$/, ', HBO Go, $HBOGo#delete_') - .gsub(/,[\s]?Discovery Plus,[\s]?Global TV$/, ', Discovery Plus, $Discovery#delete_') - .gsub(/,[\s]?DAZN,[\s]?Global TV$/, ', DAZN, $DAZN#delete_') - .gsub(/,[\s]?Pornhub,[\s]?Global TV$/, ', Pornhub, $Pornhub#delete_') - .gsub(/,[\s]?Global TV$/, ', $GlobalTV#delete_') - .gsub(/,[\s]?Asian TV$/, ', $AsianTV#delete_') - .gsub(/,[\s]?Proxy$/, ', $Proxy#delete_') - .gsub(/,[\s]?YouTube$/, ', $Youtube#delete_') - .gsub(/,[\s]?Apple$/, ', $Apple#delete_') - .gsub(/,[\s]?Apple TV$/, ', $AppleTV#delete_') - .gsub(/,[\s]?Scholar$/, ', $Scholar#delete_') - .gsub(/,[\s]?Netflix$/, ', $Netflix#delete_') - .gsub(/,[\s]?Disney$/, ', $Disney#delete_') - .gsub(/,[\s]?Spotify$/, ', $Spotify#delete_') - .gsub(/,[\s]?AI Suite$/, ', $AI_Suite#delete_') - .gsub(/,[\s]?Steam$/, ', $Steam#delete_') - .gsub(/,[\s]?miHoYo$/, ', $miHoYo#delete_') - .gsub(/,[\s]?AdBlock$/, ', $AdBlock#delete_') - .gsub(/,[\s]?Speedtest$/, ', $Speedtest#delete_') - .gsub(/,[\s]?Telegram$/, ', $Telegram#delete_') - .gsub(/,[\s]?Crypto$/, ', $Crypto#delete_') - .gsub(/,[\s]?Discord$/, ', $Discord#delete_') - .gsub(/,[\s]?Microsoft$/, ', $Microsoft#delete_') - .to_s.gsub(/,[\s]?PayPal$/, ', $PayPal#delete_') - .gsub(/,[\s]?Domestic$/, ', $Domestic#delete_') - .gsub(/,[\s]?Others$/, ', $Others#delete_') - .gsub(/,[\s]?Google FCM$/, ', $GoogleFCM#delete_') + x.to_s.gsub(/,[\s]?Bilibili,[\s]?CN Mainland TV$/, ',Bilibili,$Bilibili#delete_') + .gsub(/,[\s]?Bahamut,[\s]?Asian TV$/, ',Bahamut,$Bahamut#delete_') + .gsub(/,[\s]?Max,[\s]?Max$/, ',Max,$HBOMax#delete_') + .gsub(/,[\s]?Discovery Plus,[\s]?Global TV$/, ',Discovery Plus,$Discovery#delete_') + .gsub(/,[\s]?DAZN,[\s]?Global TV$/, ',DAZN,$DAZN#delete_') + .gsub(/,[\s]?Pornhub,[\s]?Global TV$/, ',Pornhub,$Pornhub#delete_') + .gsub(/,[\s]?Global TV$/, ',$GlobalTV#delete_') + .gsub(/,[\s]?Asian TV$/, ',$AsianTV#delete_') + .gsub(/,[\s]?CN Mainland TV$/, ',$MainlandTV#delete_') + .gsub(/,[\s]?Proxy$/, ',$Proxy#delete_') + .gsub(/,[\s]?YouTube$/, ',$Youtube#delete_') + .gsub(/,[\s]?Apple$/, ',$Apple#delete_') + .gsub(/,[\s]?Apple TV$/, ',$AppleTV#delete_') + .gsub(/,[\s]?Scholar$/, ',$Scholar#delete_') + .gsub(/,[\s]?Netflix$/, ',$Netflix#delete_') + .gsub(/,[\s]?Disney$/, ',$Disney#delete_') + .gsub(/,[\s]?Spotify$/, ',$Spotify#delete_') + .gsub(/,[\s]?AI Suite$/, ',$AI_Suite#delete_') + .gsub(/,[\s]?Steam$/, ',$Steam#delete_') + .gsub(/,[\s]?miHoYo$/, ',$miHoYo#delete_') + .gsub(/,[\s]?AdBlock$/, ',$AdBlock#delete_') + .gsub(/,[\s]?HTTPDNS$/, ',$HTTPDNS#delete_') + .gsub(/,[\s]?Speedtest$/, ',$Speedtest#delete_') + .gsub(/,[\s]?Telegram$/, ',$Telegram#delete_') + .gsub(/,[\s]?Crypto$/, ',$Crypto#delete_') + .gsub(/,[\s]?Discord$/, ',$Discord#delete_') + .gsub(/,[\s]?Microsoft$/, ',$Microsoft#delete_') + .to_s.gsub(/,[\s]?PayPal$/, ',$PayPal#delete_') + .gsub(/,[\s]?Domestic$/, ',$Domestic#delete_') + .gsub(/,[\s]?Others$/, ',$Others#delete_') + .gsub(/,[\s]?Google FCM$/, ',$GoogleFCM#delete_') .gsub(/#delete_/, '') }; - Value['script']['code'].to_s.gsub!(/\'Bilibili\': \'Asian TV\'/,'\'Bilibili\': \'$Bilibili#delete_\'') - .gsub!(/\'Bahamut\': \'Global TV\'/,'\'Bahamut\': \'$Bahamut#delete_\'') - .gsub!(/\'HBO Max\': \'Global TV\'/,'\'HBO Max\': \'$HBOMax#delete_\'') - .gsub!(/\'HBO Go\': \'Global TV\'/,'\'HBO Go\': \'$HBOGo#delete_\'') - .gsub!(/\'Discovery Plus\': \'Global TV\'/,'\'Discovery Plus\': \'$Discovery#delete_\'') - .gsub!(/\'DAZN\': \'Global TV\'/,'\'DAZN\': \'$DAZN#delete_\'') - .gsub!(/\'Pornhub\': \'Global TV\'/,'\'Pornhub\': \'$Pornhub#delete_\'') - .gsub!(/: \'Global TV\'/,': \'$GlobalTV#delete_\'') - .gsub!(/: \'Asian TV\'/,': \'$AsianTV#delete_\'') - .gsub!(/: \'Proxy\'/,': \'$Proxy#delete_\'') - .gsub!(/: \'YouTube\'/,': \'$Youtube#delete_\'') - .gsub!(/: \'Apple\'/,': \'$Apple#delete_\'') - .gsub!(/: \'Apple TV\'/,': \'$AppleTV#delete_\'') - .gsub!(/: \'Scholar\'/,': \'$Scholar#delete_\'') - .gsub!(/: \'Netflix\'/,': \'$Netflix#delete_\'') - .gsub!(/: \'Disney\'/,': \'$Disney#delete_\'') - .gsub!(/: \'Spotify\'/,': \'$Spotify#delete_\'') - .gsub!(/: \'AI Suite\'/,': \'$AI_Suite#delete_\'') - .gsub!(/: \'Steam\'/,': \'$Steam#delete_\'') - .gsub!(/: \'miHoYo\'/,': \'$miHoYo#delete_\'') - .gsub!(/: \'AdBlock\'/,': \'$AdBlock#delete_\'') - .gsub!(/: \'Speedtest\'/,': \'$Speedtest#delete_\'') - .gsub!(/: \'Telegram\'/,': \'$Telegram#delete_\'') - .gsub!(/: \'Crypto\'/,': \'$Crypto#delete_\'') - .gsub!(/: \'Discord\'/,': \'$Discord#delete_\'') - .gsub!(/: \'Microsoft\'/,': \'$Microsoft#delete_\'') - .gsub!(/: \'PayPal\'/,': \'$PayPal#delete_\'') - .gsub!(/: \'Domestic\'/,': \'$Domestic#delete_\'') - .gsub!(/: \'Google FCM\'/,': \'$GoogleFCM#delete_\'') - .gsub!(/return \'Domestic\'$/, 'return \'$Domestic#delete_\'') - .gsub!(/return \'Others\'$/, 'return \'$Others#delete_\'') - .gsub!(/#delete_/, ''); end; rescue Exception => e YAML.LOG('Error: Set lhie1 Rules Failed,【' + e.message + '】'); @@ -436,19 +401,15 @@ yml_other_set() #Router Self Proxy Rule begin - if $6 == 0 and ${10} != 2 and '${12}' == 'fake-ip' then + if $6 == 0 and $8 != 2 and '$9' == 'fake-ip' then if Value.has_key?('rules') and not Value['rules'].to_a.empty? then - if Value['rules'].to_a.grep(/(?=.*SRC-IP-CIDR,'${fake_ip}')/).empty? then - Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,${11},DIRECT'); - end if Value['rules'].to_a.grep(/(?=.*SRC-IP-CIDR,'$7')/).empty? and not '$7'.empty? then Value['rules']=Value['rules'].to_a.insert(0,'SRC-IP-CIDR,$7/32,DIRECT'); end; else - Value['rules']=['SRC-IP-CIDR,${11},DIRECT','SRC-IP-CIDR,$7/32,DIRECT']; + Value['rules']=['SRC-IP-CIDR,$7/32,DIRECT']; end; elsif Value.has_key?('rules') and not Value['rules'].to_a.empty? then - Value['rules'].delete('SRC-IP-CIDR,${11},DIRECT'); Value['rules'].delete('SRC-IP-CIDR,$7/32,DIRECT'); end; rescue Exception => e @@ -479,12 +440,7 @@ yml_other_set() end; if File::exist?('/tmp/yaml_rule_set_top_custom.yaml') then Value_1 = YAML.load_file('/tmp/yaml_rule_set_top_custom.yaml'); - if Value['rules'].to_a.grep(/(?=.*'${fake_ip}')(?=.*REJECT)/).empty? then - Value_1['rules'].uniq.reverse.each{|x| Value['rules'].insert(0,x)}; - else - ruby_add_index = Value['rules'].index(Value['rules'].grep(/(?=.*'${fake_ip}')(?=.*REJECT)/).first); - Value_1['rules'].uniq.reverse.each{|x| Value['rules'].insert(ruby_add_index + 1,x)}; - end; + Value_1['rules'].uniq.reverse.each{|x| Value['rules'].insert(0,x)}; end; else if File::exist?('/tmp/yaml_rule_set_top_custom.yaml') then @@ -658,25 +614,6 @@ yml_other_set() rescue Exception => e YAML.LOG('Error: Set Custom Rules Failed,【' + e.message + '】'); end; - - #loop prevent - begin - if Value.has_key?('rules') and not Value['rules'].to_a.empty? then - if Value['rules'].to_a.grep(/(?=.*'${fake_ip}')(?=.*REJECT)/).empty? then - Value['rules']=Value['rules'].to_a.insert(0,'IP-CIDR,${11},REJECT,no-resolve'); - end; - if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$8',REJECT)/).empty? then - Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$8,REJECT'); - end; - if Value['rules'].to_a.grep(/(?=.*DST-PORT,'$9',REJECT)/).empty? then - Value['rules']=Value['rules'].to_a.insert(0,'DST-PORT,$9,REJECT'); - end; - else - Value['rules']=['IP-CIDR,${11},REJECT,no-resolve','DST-PORT,$8,REJECT','DST-PORT,$9,REJECT']; - end; - rescue Exception => e - YAML.LOG('Error: Set Loop Protect Rules Failed,【' + e.message + '】'); - end; }; t2=Thread.new{ @@ -750,10 +687,6 @@ yml_other_set() if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then x['url'] = '$github_address_mod' + 'gh/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '@' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1]; end; - elsif '$github_address_mod' == 'https://raw.fastgit.org/' then - if x['url'] and x['url'] =~ /^https:\/\/raw.githubusercontent.com/ then - x['url'] = 'https://raw.fastgit.org/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/' + x['url'].split(x['url'].split('/')[2] + '/' + x['url'].split('/')[3] + '/' + x['url'].split('/')[4] + '/')[1]; - end; else if x['url'] and x['url'] =~ /^https:\/\/(raw.|gist.)(githubusercontent.com|github.com)/ then x['url'] = '$github_address_mod' + x['url']; @@ -871,12 +804,12 @@ yml_other_rules_get() config_get "rule_name" "$section" "rule_name" "" config_get "GlobalTV" "$section" "GlobalTV" "" config_get "AsianTV" "$section" "AsianTV" "" + config_get "MainlandTV" "$section" "MainlandTV" "DIRECT" config_get "Proxy" "$section" "Proxy" "" config_get "Youtube" "$section" "Youtube" "" config_get "Bilibili" "$section" "Bilibili" "" config_get "Bahamut" "$section" "Bahamut" "" config_get "HBOMax" "$section" "HBOMax" "$GlobalTV" - config_get "HBOGo" "$section" "HBOGo" "$GlobalTV" config_get "Pornhub" "$section" "Pornhub" "" config_get "Apple" "$section" "Apple" "" config_get "Scholar" "$section" "Scholar" "" @@ -885,6 +818,7 @@ yml_other_rules_get() config_get "Spotify" "$section" "Spotify" "" config_get "Steam" "$section" "Steam" "" config_get "AdBlock" "$section" "AdBlock" "" + config_get "HTTPDNS" "$section" "HTTPDNS" "REJECT" config_get "Netease_Music" "$section" "Netease_Music" "" config_get "Speedtest" "$section" "Speedtest" "" config_get "Telegram" "$section" "Telegram" "" @@ -912,18 +846,18 @@ if [ "$1" != "0" ]; then config_foreach yml_other_rules_get "other_rules" "$5" if [ -z "$rule_name" ]; then SKIP_CUSTOM_OTHER_RULES=1 - yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" + yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" exit 0 #判断策略组是否存在 elif [ "$rule_name" = "lhie1" ]; then if [ -z "$(grep -F "$GlobalTV" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$AsianTV" /tmp/Proxy_Group)" ]\ + || [ -z "$(grep -F "$MainlandTV" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Youtube" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Bilibili" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Bahamut" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$HBOMax" /tmp/Proxy_Group)" ]\ - || [ -z "$(grep -F "$HBOGo" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Pornhub" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Apple" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$AppleTV" /tmp/Proxy_Group)" ]\ @@ -937,6 +871,7 @@ if [ "$1" != "0" ]; then || [ -z "$(grep -F "$Steam" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$miHoYo" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$AdBlock" /tmp/Proxy_Group)" ]\ + || [ -z "$(grep -F "$HTTPDNS" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Speedtest" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Telegram" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Crypto" /tmp/Proxy_Group)" ]\ @@ -948,16 +883,16 @@ if [ "$1" != "0" ]; then || [ -z "$(grep -F "$Domestic" /tmp/Proxy_Group)" ]; then LOG_OUT "Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!" SKIP_CUSTOM_OTHER_RULES=1 - yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" + yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" exit 0 fi fi if [ -z "$Proxy" ]; then LOG_OUT "Error: Missing Porxy-Group's Name, Stop Setting The Other Rules!" SKIP_CUSTOM_OTHER_RULES=1 - yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" + yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" exit 0 fi fi -yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" +yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" diff --git a/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg b/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg index 4664f751..a245a36b 100644 --- a/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg +++ b/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg @@ -1 +1 @@ -Current Version: v0.00.00-betaCurrent Versionv0.00.00-beta \ No newline at end of file +Current Version: v0.00.00Current Versionv0.00.00 \ No newline at end of file diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua index b185a4db..fee63157 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua @@ -146,7 +146,7 @@ end sources.write = dynamicList_write ---- TCP No Redir Ports -local TCP_NO_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "tcp_no_redir_ports") +local TCP_NO_REDIR_PORTS = m:get("@global_forwarding[0]", "tcp_no_redir_ports") o = s:option(Value, "tcp_no_redir_ports", translate("TCP No Redir Ports")) o:value("", translate("Use global config") .. "(" .. TCP_NO_REDIR_PORTS .. ")") o:value("disable", translate("No patterns are used")) @@ -154,7 +154,7 @@ o:value("1:65535", translate("All")) o.validate = port_validate ---- UDP No Redir Ports -local UDP_NO_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "udp_no_redir_ports") +local UDP_NO_REDIR_PORTS = m:get("@global_forwarding[0]", "udp_no_redir_ports") o = s:option(Value, "udp_no_redir_ports", translate("UDP No Redir Ports"), "" .. translate("Fill in the ports you don't want to be forwarded by the agent, with the highest priority.") .. @@ -203,7 +203,7 @@ o.value = "1" o:depends({ udp_node = "", ['!reverse'] = true }) ---- TCP Proxy Drop Ports -local TCP_PROXY_DROP_PORTS = m.uci:get(appname, "@global_forwarding[0]", "tcp_proxy_drop_ports") +local TCP_PROXY_DROP_PORTS = m:get("@global_forwarding[0]", "tcp_proxy_drop_ports") o = s:option(Value, "tcp_proxy_drop_ports", translate("TCP Proxy Drop Ports")) o:value("", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")") o:value("disable", translate("No patterns are used")) @@ -212,7 +212,7 @@ o:depends({ use_global_config = true }) o:depends({ _tcp_node_bool = "1" }) ---- UDP Proxy Drop Ports -local UDP_PROXY_DROP_PORTS = m.uci:get(appname, "@global_forwarding[0]", "udp_proxy_drop_ports") +local UDP_PROXY_DROP_PORTS = m:get("@global_forwarding[0]", "udp_proxy_drop_ports") o = s:option(Value, "udp_proxy_drop_ports", translate("UDP Proxy Drop Ports")) o:value("", translate("Use global config") .. "(" .. UDP_PROXY_DROP_PORTS .. ")") o:value("disable", translate("No patterns are used")) @@ -222,7 +222,7 @@ o:depends({ use_global_config = true }) o:depends({ _tcp_node_bool = "1" }) ---- TCP Redir Ports -local TCP_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "tcp_redir_ports") +local TCP_REDIR_PORTS = m:get("@global_forwarding[0]", "tcp_redir_ports") o = s:option(Value, "tcp_redir_ports", translate("TCP Redir Ports"), translatef("Only work with using the %s node.", "TCP")) o:value("", translate("Use global config") .. "(" .. TCP_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) @@ -234,7 +234,7 @@ o:depends({ use_global_config = true }) o:depends({ _tcp_node_bool = "1" }) ---- UDP Redir Ports -local UDP_REDIR_PORTS = m.uci:get(appname, "@global_forwarding[0]", "udp_redir_ports") +local UDP_REDIR_PORTS = m:get("@global_forwarding[0]", "udp_redir_ports") o = s:option(Value, "udp_redir_ports", translate("UDP Redir Ports"), translatef("Only work with using the %s node.", "UDP")) o:value("", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. ")") o:value("1:65535", translate("All")) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index 4168039c..620f3f5a 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -37,7 +37,7 @@ end local socks_list = {} -local tcp_socks_server = "127.0.0.1" .. ":" .. (m.uci:get(appname, "@global[0]", "tcp_node_socks_port") or "1070") +local tcp_socks_server = "127.0.0.1" .. ":" .. (m:get("@global[0]", "tcp_node_socks_port") or "1070") local socks_table = {} socks_table[#socks_table + 1] = { id = tcp_socks_server, @@ -594,7 +594,7 @@ o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translat o.default = "1" o.rmempty = false -if (m.uci:get(appname, "@global_forwarding[0]", "use_nft") or "0") == "1" then +if (m:get("@global_forwarding[0]", "use_nft") or "0") == "1" then o = s:taboption("DNS", Button, "clear_ipset", translate("Clear NFTSET"), translate("Try this feature if the rule modification does not take effect.")) else o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSET"), translate("Try this feature if the rule modification does not take effect.")) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua index e3212bc7..e2fda69e 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua @@ -4,7 +4,7 @@ local appname = "passwall" m = Map(appname, translate("Node Config")) m.redirect = api.url() -if not arg[1] or not m.uci:get(appname, arg[1]) then +if not arg[1] or not m:get(arg[1]) then luci.http.redirect(api.url("node_list")) end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua index 187beaaa..bc1ab22d 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua @@ -22,7 +22,7 @@ o.rmempty = false local auto_switch_tip local current_node = api.get_cache_var("socks_" .. arg[1]) if current_node then - local n = m.uci:get_all(appname, current_node) + local n = m:get(current_node) if n then if tonumber(m:get(arg[1], "enable_autoswitch") or 0) == 1 then if n then diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index bd8ff36c..c3ac56c2 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -655,11 +655,21 @@ function gen_config(var) } } if inbound.sniffing.enabled == true then - inbound.sniffing.destOverride = {"http", "tls", "quic", (remote_dns_fake) and "fakedns"} + inbound.sniffing.destOverride = {"http", "tls", "quic"} inbound.sniffing.metadataOnly = false inbound.sniffing.routeOnly = xray_settings.sniffing_override_dest ~= "1" or nil inbound.sniffing.domainsExcluded = xray_settings.sniffing_override_dest == "1" and get_domain_excluded() or nil end + if remote_dns_fake then + inbound.sniffing.enabled = true + if not inbound.sniffing.destOverride then + inbound.sniffing.destOverride = {"fakedns"} + inbound.sniffing.metadataOnly = true + else + table.insert(inbound.sniffing.destOverride, "fakedns") + inbound.sniffing.metadataOnly = false + end + end if tcp_redir_port then local tcp_inbound = api.clone(inbound) diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index 6258e80c..1df050c0 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -2,12 +2,12 @@ <% local api = require "luci.passwall.api" local appname = 'passwall' -local uci = self.map.uci -local ss_type = uci:get(appname, "@global_subscribe[0]", "ss_type") or "xray" -local trojan_type = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "xray" -local vmess_type = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray" -local vless_type = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray" -local hysteria2_type = uci:get(appname, "@global_subscribe[0]", "hysteria2_type") or "sing-box" +local map = self.map +local ss_type = map:get("@global_subscribe[0]", "ss_type") or "xray" +local trojan_type = map:get("@global_subscribe[0]", "trojan_type") or "xray" +local vmess_type = map:get("@global_subscribe[0]", "vmess_type") or "xray" +local vless_type = map:get("@global_subscribe[0]", "vless_type") or "xray" +local hysteria2_type = map:get("@global_subscribe[0]", "hysteria2_type") or "sing-box" -%>