Skip to content

Commit

Permalink
openclash update with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryLip committed Nov 29, 2024
1 parent f3806f5 commit ec86f18
Show file tree
Hide file tree
Showing 25 changed files with 1,257 additions and 680 deletions.
8 changes: 4 additions & 4 deletions package/network/ipv6/odhcp6c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=odhcp6c
PKG_RELEASE:=20
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git
PKG_SOURCE_DATE:=2023-05-12
PKG_SOURCE_VERSION:=bcd283632ac13391aac3ebdd074d1fd832d76fa3
PKG_MIRROR_HASH:=0c18c578045f9251bd86a5b8fb0518b69c519e83f69907bf76583a2985482508
PKG_SOURCE_DATE:=2024-09-25
PKG_SOURCE_VERSION:=b6ae9ffaeb0e18e9fa3d5be62faa8d3c9f340a58
PKG_MIRROR_HASH:=25499b6a0d403815e6b04869a02d2d5a32582348bff2bc2626559d297425a908
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0

Expand Down
1 change: 1 addition & 0 deletions package/network/ipv6/odhcp6c/files/dhcpv6.script
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ setup_interface () {

if [ -z "$gw" -o "$duplicate" = 1 ]; then
proto_add_ipv6_route "$addr" "$mask" "$gw" "$metric" "$valid"
env -i ACTION="ifup" INTERFACE="$INTERFACE" DEVICE="$DEVICE" ADDR="$addr" MASK="$mask" "GW"="$gw" METRIC="$metric" VALID="$valid" /sbin/hotplug-call dhcpv6
else
for prefix in $PREFIXES $ADDRESSES; do
local paddr="${prefix%%,*}"
Expand Down
5 changes: 3 additions & 2 deletions package/new/luci-app-openclash/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.46.050
PKG_VERSION:=0.46.055
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down Expand Up @@ -56,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
Expand Down Expand Up @@ -112,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ local function coremodel()
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 |awk '{print $2}'")
return luci.sys.exec("apk list libc 2>/dev/null |awk '{print $2}'")
end
end
end
Expand Down Expand Up @@ -255,7 +255,7 @@ local function opcv()
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 |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1")
return "v" .. luci.sys.exec("apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "Proxy", translate("Proxy"))
o = s:option(ListValue, "CN Mainland TV", translate("CN Mainland TV"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
Expand All @@ -106,7 +106,7 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "Youtube", translate("Youtube"))
o = s:option(ListValue, "Proxy", translate("Proxy"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
Expand All @@ -117,7 +117,7 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "Bilibili", translate("Bilibili"))
o = s:option(ListValue, "Youtube", translate("Youtube"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
Expand All @@ -128,7 +128,7 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "Bahamut", translate("Bahamut"))
o = s:option(ListValue, "Bilibili", translate("Bilibili"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
Expand All @@ -139,7 +139,7 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "HBOMax", translate("HBO Max"))
o = s:option(ListValue, "Bahamut", translate("Bahamut"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
Expand All @@ -150,7 +150,7 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "HBOGo", translate("HBO Go"))
o = s:option(ListValue, "HBOMax", translate("HBO Max"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,28 +496,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
Expand Down Expand Up @@ -552,40 +530,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
Expand Down Expand Up @@ -787,7 +731,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")

Expand Down
18 changes: 6 additions & 12 deletions package/new/luci-app-openclash/po/zh-cn/openclash.zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ msgstr "国际流媒体"
msgid "AsianTV"
msgstr "亚洲流媒体"

msgid "CN Mainland TV"
msgstr "大陆流媒体"

msgid "Proxy"
msgstr "必须代理的流量"

Expand Down Expand Up @@ -2487,15 +2490,9 @@ msgstr "提示:开始自动选择(检测)Netflix 解锁节点..."
msgid "Tip: Start Auto Select Proxy For Disney Plus Unlock..."
msgstr "提示:开始自动选择(检测)Disney Plus 解锁节点..."

msgid "Tip: Start Auto Select Proxy For HBO Now Unlock..."
msgstr "提示:开始自动选择(检测)HBO Now 解锁节点..."

msgid "Tip: Start Auto Select Proxy For HBO Max Unlock..."
msgstr "提示:开始自动选择(检测)HBO Max 解锁节点..."

msgid "Tip: Start Auto Select Proxy For HBO GO Asia Unlock..."
msgstr "提示:开始自动选择(检测)HBO GO Asia 解锁节点..."

msgid "Tip: Start Auto Select Proxy For YouTube Premium Unlock..."
msgstr "提示:开始自动选择(检测)YouTube Premium 解锁节点..."

Expand Down Expand Up @@ -2529,15 +2526,9 @@ msgstr "Netflix 策略组:"
msgid "Disney Plus Group:"
msgstr "Disney Plus 策略组:"

msgid "HBO Now Group:"
msgstr "HBO Now 策略组:"

msgid "HBO Max Group:"
msgstr "HBO Max 策略组:"

msgid "HBO GO Asia Group:"
msgstr "HBO GO Asia 策略组:"

msgid "TVB Anywhere+ Group:"
msgstr "TVB Anywhere+ 策略组:"

Expand Down Expand Up @@ -3434,3 +3425,6 @@ msgstr "全局"

msgid "Direct"
msgstr "直连"

msgid "Error: Config File Overwrite Failed,"
msgstr "错误:配置文件覆写失败,"
3 changes: 2 additions & 1 deletion package/new/luci-app-openclash/root/etc/init.d/openclash
Original file line number Diff line number Diff line change
Expand Up @@ -2933,7 +2933,7 @@ start()

enable=$(uci -q get openclash.config.enable)
[ "$enable" != "1" ] && LOG_OUT "Warning: OpenClash Now Disabled, Need Start From Luci Page, Exit..." && SLOG_CLEAN && del_lock && exit 0

service openclash enable
LOG_OUT "OpenClash Start Running..."

config_choose
Expand Down Expand Up @@ -3028,6 +3028,7 @@ stop()

LOG_OUT "Step 6: Delete OpenClash Residue File..."
if [ "$enable" != "1" ]; then
service openclash disable
rm -rf /tmp/clash_last_version >/dev/null 2>&1
rm -rf /tmp/Proxy_Group >/dev/null 2>&1
rm -rf /tmp/rules_name >/dev/null 2>&1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
LOG_OUT "Tip: Start Running Custom Overwrite Scripts..."
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
CONFIG_FILE="$1" #config path
#Config Path
CONFIG_FILE="$1"

#Simple Demo:
#Simple Demo:
#Key Overwrite Demo
#1--config path
#2--key name
Expand All @@ -28,13 +29,29 @@ CONFIG_FILE="$1" #config path
#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}}}"

#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 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,5 @@ sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*10240;

/etc/init.d/uhttpd restart >/dev/null 2>&1

rm -f /tmp/luci-indexcache
rm -f /tmp/luci-indexcache* >/dev/null 2>&1
exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
uci -q set openclash.config.config_reload=1
uci -q commit openclash
if ([ -z "$2" ] || ([ -n "$2" ] && [ "$2" != "one_key_update" ])) && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
uci -q set openclash.config.config_reload=0
uci -q commit openclash
/etc/init.d/openclash restart >/dev/null 2>&1 &
fi
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ del_lock() {
rm -rf "/tmp/lock/openclash_debug.lock"
}

ipk_v()
{
if [ -x "/bin/opkg" ]; then
echo $(opkg status "$1" 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null)
elif [ -x "/usr/bin/apk" ]; then
echo $(apk list "$1" 2>/dev/null |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1)
fi
}

DEBUG_LOG="/tmp/openclash_debug.log"
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
set_lock
Expand All @@ -31,11 +40,15 @@ en_mode=$(uci -q get openclash.config.en_mode)
RAW_CONFIG_FILE=$(uci -q get openclash.config.config_path)
CONFIG_FILE="/etc/openclash/$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
core_model=$(uci -q get openclash.config.core_version)
cpu_model=$(ipk_v libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null)
if [ -x "/bin/opkg" ]; then
cpu_model=$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null)
elif [ -x "/usr/bin/apk" ]; then
cpu_model=$(apk list libc 2>/dev/null|awk '{print $2}')
fi
core_meta_version=$(/etc/openclash/core/clash_meta -v 2>/dev/null |awk -F ' ' '{print $3}' |head -1 2>/dev/null)
servers_update=$(uci -q get openclash.config.servers_update)
mix_proxies=$(uci -q get openclash.config.mix_proxies)
op_version=$(ipk_v luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print "v"$2}')
op_version=$(ipk_v "luci-app-openclash")
china_ip_route=$(uci -q get openclash.config.china_ip_route)
common_ports=$(uci -q get openclash.config.common_ports)
router_self_proxy=$(uci -q get openclash.config.router_self_proxy)
Expand Down Expand Up @@ -80,15 +93,6 @@ ts_re()
fi
}

ipk_v()
{
if [ -x "/bin/opkg" ]; then
echo $(opkg status "$1" 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null)
elif [ -x "/usr/bin/apk" ]; then
echo $(apk list "$1" |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1)
fi
}

dns_re()
{
if [ "$1" = "1" ]; then
Expand Down
Loading

0 comments on commit ec86f18

Please sign in to comment.