Skip to content

Commit 39a3dbb

Browse files
committed
Merge branch 'dev'
2 parents 2cb62f3 + 582e294 commit 39a3dbb

File tree

74 files changed

+12989
-11828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+12989
-11828
lines changed

.github/workflows/clear_cache.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Clean jsDelivr Cache
22

33
on:
4-
# push
5-
# https://github.com/qinxs/cdn-assets
64
push:
75
branches:
86
- master
@@ -18,19 +16,26 @@ jobs:
1816
runs-on: ubuntu-latest
1917

2018
steps:
19+
- name: Apt Update
20+
env:
21+
DEBIAN_FRONTEND: noninteractive
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get -y install jq
25+
2126
- uses: actions/checkout@v4
2227

2328
# https://github.com/marketplace/actions/git-changesets
2429
- id: changed_files
2530
name: git-changesets
26-
uses: collin-miller/git-changesets@v0.0.4
31+
uses: collin-miller/git-changesets@v1
2732
with:
2833
# Default format is 'csv'. Other valid options are 'space-delimited' and 'json'.
29-
format: space-delimited
34+
format: json
3035

3136
- name: Clean jsDelivr Cache
3237
run: |
33-
for i in ${{ steps.changed_files.outputs.added_modified }}; do
34-
# echo ${{ steps.changed_files.outputs.all }}
35-
curl -sL --retry 3 https://purge.jsdelivr.net/gh/vernesong/OpenClash@${{ github.ref_name }}/$i
36-
done
38+
echo '${{ steps.changed_files.outputs.added_modified }}' | jq -r '.[]' | while read file; do
39+
# echo ${{ steps.changed_files.outputs.all }}
40+
curl -sL --retry 3 "https://purge.jsdelivr.net/gh/vernesong/OpenClash@${{ github.ref_name }}/${file}"
41+
done

.github/workflows/compile_meta_core.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- name: Setup Go
9090
uses: actions/setup-go@v5
9191
with:
92-
go-version: "1.23"
92+
go-version: "1.24"
9393
check-latest: true
9494

9595
- name: Clone Clash Meta Repository

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@
4141
* luci
4242
* luci-base
4343
* dnsmasq-full
44-
* coreutils
45-
* coreutils-nohup
4644
* bash
4745
* curl
48-
* ca-certificates
46+
* ca-bundle
4947
* ipset
5048
* ip-full
51-
* libcap
52-
* libcap-bin
5349
* ruby
5450
* ruby-yaml
5551
* unzip

luci-app-openclash/Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=luci-app-openclash
4-
PKG_VERSION:=0.46.064
4+
PKG_VERSION:=0.46.075
55
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
66

77
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -42,8 +42,8 @@ define Package/$(PKG_NAME)
4242
SUBMENU:=3. Applications
4343
TITLE:=LuCI support for clash
4444
PKGARCH:=all
45-
DEPENDS:=+dnsmasq-full +coreutils +coreutils-nohup +bash +curl +ca-certificates +ip-full \
46-
+libcap +libcap-bin +ruby +ruby-yaml +kmod-tun +unzip
45+
DEPENDS:=+dnsmasq-full +bash +curl +ca-bundle +ip-full \
46+
+ruby +ruby-yaml +kmod-tun +unzip
4747
MAINTAINER:=vernesong
4848
endef
4949

@@ -122,9 +122,9 @@ endef
122122

123123
define Package/$(PKG_NAME)/postrm
124124
#!/bin/sh
125-
DEFAULT_DNSMASQ_CFGID="$$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')"
125+
DEFAULT_DNSMASQ_CFGID="$$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}' 2>/dev/null)"
126126
if [ -f "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" ]; then
127-
DNSMASQ_CONF_DIR="$$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID")"
127+
DNSMASQ_CONF_DIR="$$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DEFAULT_DNSMASQ_CFGID" 2>/dev/null)"
128128
else
129129
DNSMASQ_CONF_DIR="/tmp/dnsmasq.d"
130130
fi

luci-app-openclash/luasrc/controller/openclash.lua

+12-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function index()
3131
entry({"admin", "services", "openclash", "opupdate"},call("action_opupdate"))
3232
entry({"admin", "services", "openclash", "coreupdate"},call("action_coreupdate"))
3333
entry({"admin", "services", "openclash", "flush_fakeip_cache"}, call("action_flush_fakeip_cache"))
34+
entry({"admin", "services", "openclash", "update_config"}, call("action_update_config"))
3435
entry({"admin", "services", "openclash", "download_rule"}, call("action_download_rule"))
3536
entry({"admin", "services", "openclash", "restore"}, call("action_restore_config"))
3637
entry({"admin", "services", "openclash", "backup"}, call("action_backup"))
@@ -252,7 +253,7 @@ local function opcv()
252253
if fs.access("/bin/opkg") then
253254
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}'")
254255
elseif fs.access("/usr/bin/apk") then
255-
return "v" .. luci.sys.exec("apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1")
256+
return "v" .. luci.sys.exec("apk list luci-app-openclash 2>/dev/null|grep 'installed' | grep -oE '[0-9]+(\\.[0-9]+)*' | head -1")
256257
end
257258
end
258259
end
@@ -347,14 +348,19 @@ function action_flush_fakeip_cache()
347348
local dase = dase() or ""
348349
local cn_port = cn_port()
349350
if not daip or not cn_port then return end
350-
state = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XPOST http://"%s":"%s"/cache/fakeip/flush', dase, daip, cn_port))
351-
end
352-
luci.http.prepare_content("application/json")
351+
state = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XPOST http://"%s":"%s"/cache/fakeip/flush', dase, daip, cn_port))
352+
end
353+
luci.http.prepare_content("application/json")
353354
luci.http.write_json({
354355
flush_status = state;
355356
})
356357
end
357358

359+
function action_update_config()
360+
local filename = luci.http.formvalue("filename") or "config"
361+
luci.sys.exec(string.format("/usr/share/openclash/openclash.sh '%s' >/dev/null 2>&1 &", filename))
362+
end
363+
358364
function action_restore_config()
359365
uci:set("openclash", "config", "enable", "0")
360366
uci:commit("openclash")
@@ -364,6 +370,8 @@ function action_restore_config()
364370
luci.sys.call("cp /usr/share/openclash/backup/openclash_force_sniffing* /etc/openclash/custom/ >/dev/null 2>&1 &")
365371
luci.sys.call("cp /usr/share/openclash/backup/openclash_sniffing* /etc/openclash/custom/ >/dev/null 2>&1 &")
366372
luci.sys.call("cp /usr/share/openclash/backup/yml_change.sh /usr/share/openclash/yml_change.sh >/dev/null 2>&1 &")
373+
luci.sys.call("cp /usr/share/openclash/backup/china_ip_route.ipset /etc/openclash/china_ip_route.ipset >/dev/null 2>&1 &")
374+
luci.sys.call("cp /usr/share/openclash/backup/china_ip6_route.ipset /etc/openclash/china_ip6_route.ipset >/dev/null 2>&1 &")
367375
luci.sys.call("rm -rf /etc/openclash/history/* >/dev/null 2>&1 &")
368376
end
369377

luci-app-openclash/luasrc/model/cbi/openclash/client.lua

+20-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ if a then
7979
btnis.template="openclash/other_button"
8080
btnis.render=function(o,t,a)
8181
if not e[t] then return false end
82-
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
83-
a.display=""
84-
else
85-
a.display="none"
86-
end
82+
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
83+
a.display=""
84+
else
85+
a.display="none"
86+
end
8787
o.inputstyle="apply"
8888
Button.render(o,t,a)
8989
end
@@ -95,6 +95,20 @@ if a then
9595
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
9696
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "client"))
9797
end
98+
99+
up=tb:option(DummyValue, "name", translate("Update"))
100+
up.template = "openclash/update_config"
101+
up.render = function(o,t,a)
102+
local display = "none"
103+
uci:foreach("openclash", "config_subscribe",
104+
function(s)
105+
if s.name == fs.filename(e[t].name) then
106+
display = ""
107+
end
108+
end)
109+
o.display = display
110+
DummyValue.render(o,t,a)
111+
end
98112
end
99113

100114
if not a then
@@ -152,6 +166,7 @@ o.inputstyle = "reset"
152166
o.write = function()
153167
uci:set("openclash", "config", "enable", 0)
154168
uci:commit("openclash")
169+
SYS.call("ps | grep openclash | grep -v grep | awk '{print $1}' | xargs -r kill -9 >/dev/null 2>&1")
155170
SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &")
156171
end
157172

luci-app-openclash/luasrc/model/cbi/openclash/config-overwrite.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ o.description = font_red..bold_on..translate("Change The Delay Calculation Metho
280280
o.default = "0"
281281

282282
o = s:taboption("meta", ListValue, "find_process_mode", translate("Enable Process Rule"))
283-
o.description = translate("Whether to Enable Process Rules, If You Are Not Sure, Please Choose off Which Useful in Router Environment")
283+
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")
284284
o:value("0", translate("Disable"))
285285
o:value("off", translate("OFF "))
286286
o:value("always", translate("Always "))

luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ o:depends("sub_convert", "1")
180180

181181
---- custom params
182182
o = s:option(DynamicList, "custom_params", translate("Custom Params"))
183-
o.description = font_red..bold_on..translate("eg: \"rename=\\s+([2-9])[xX]@ (HIGH:$1)\"")..bold_off..font_off
183+
o.description = font_red..bold_on..translate("eg: \"rename=match@replace\" , \"rename=\\s+([2-9])[xX]@ (HIGH:$1)\"")..bold_off..font_off
184184
o.rmempty = false
185185
o:depends("sub_convert", "1")
186186

luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe.lua

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ function o.cfgvalue(...)
111111
end
112112
end
113113

114+
---- update
115+
o = s:option(DummyValue, "name", translate("Update"))
116+
o.template = "openclash/update_config"
117+
114118
local t = {
115119
{Commit, Apply}
116120
}

luci-app-openclash/luasrc/model/cbi/openclash/config.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ btnrn.template="openclash/input_rename"
259259
btnrn.rawhtml = true
260260
btnrn.render=function(c,t,a)
261261
c.value = e[t].name
262-
Button.render(c,t,a)
262+
DummyValue.render(c,t,a)
263263
end
264264

265265
btndl = tb:option(Button,"download",translate("Download Config"))

luci-app-openclash/luasrc/model/cbi/openclash/groups-config.lua

-10
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ o = s:option(Value, "policy_filter", translate("Provider Filter"))
100100
o.rmempty = true
101101
o.placeholder = "bgp|sg"
102102

103-
-- [[ interface-name ]]--
104-
o = s:option(Value, "interface_name", translate("interface-name"))
105-
o.rmempty = true
106-
o.placeholder = translate("eth0")
107-
108-
-- [[ routing-mark ]]--
109-
o = s:option(Value, "routing_mark", translate("routing-mark"))
110-
o.rmempty = true
111-
o.placeholder = translate("2333")
112-
113103
o = s:option(DynamicList, "other_group", translate("Other Group (Support Regex)"))
114104
o.description = font_red..bold_on..translate("The Added Proxy Groups Must Exist Except 'DIRECT' & 'REJECT'")..bold_off..font_off
115105
o:value("all", translate("All Groups"))

luci-app-openclash/luasrc/model/cbi/openclash/proxy-provider-config.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ o.rmempty = true
5959
o.description = translate("Choose The Provider Type")
6060
o:value("http")
6161
o:value("file")
62+
o:value("inline")
6263

6364
o = s:option(Value, "name", translate("Provider Name"))
6465
o.rmempty = false
@@ -134,7 +135,16 @@ function o.cfgvalue(self, section)
134135
"# proxy-name:\n"..
135136
"# - pattern: \"IPLC-(.*?)倍\"\n"..
136137
"# target: \"iplc x $1\"\n"..
137-
"# exclude-type: \"ss|http\""
138+
"# exclude-type: \"ss|http\"\n"..
139+
"\n"..
140+
"# inline Example:\n"..
141+
"# payload:\n"..
142+
"# - name: \"ss1\"\n"..
143+
"# type: ss\n"..
144+
"# server: server\n"..
145+
"# port: 443\n"..
146+
"# cipher: chacha20-ietf-poly1305\n"..
147+
"# password: \"password\""
138148
else
139149
return Value.cfgvalue(self, section)
140150
end

luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-config.lua

+44-10
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,25 @@ o.default = "Rule-provider - "..sid
5757
o = s:option(ListValue, "type", translate("Rule Providers Type"))
5858
o.rmempty = true
5959
o.description = translate("Choose The Rule Providers Type")
60-
o:value("http", translate("http"))
61-
o:value("file", translate("file"))
60+
o:value("http")
61+
o:value("file")
62+
o:value("inline")
6263

63-
o = s:option(ListValue, "behavior", translate("Rule Behavior"))
64-
o.rmempty = true
65-
o.description = translate("Choose The Rule Behavior")
66-
o:value("domain")
67-
o:value("ipcidr")
68-
o:value("classical")
69-
70-
o = s:option(ListValue, "format", translate("Rule Format")..translate("(TUN&Meta Core)"))
64+
o = s:option(ListValue, "format", translate("Rule Format"))
7165
o.rmempty = true
7266
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>"
7367
o:value("yaml")
7468
o:value("text")
7569
o:value("mrs")
70+
o:depends("type", "file")
71+
o:depends("type", "http")
72+
73+
o = s:option(ListValue, "behavior", translate("Rule Behavior"))
74+
o.rmempty = true
75+
o.description = translate("Choose The Rule Behavior")
76+
o:value("domain")
77+
o:value("ipcidr")
78+
o:value("classical", translate("classical").." "..translate("(Not Support mrs Format)"))
7679

7780
o = s:option(ListValue, "path", translate("Rule Providers Path"))
7881
o.description = translate("Update Your Rule Providers File From Config Luci Page")
@@ -136,6 +139,36 @@ m.uci:foreach("openclash", "groups",
136139
o:value("DIRECT")
137140
o:value("REJECT")
138141

142+
-- [[ other-setting ]]--
143+
o = s:option(Value, "other_parameters", translate("Other Parameters"))
144+
o.template = "cbi/tvalue"
145+
o.rows = 20
146+
o.wrap = "off"
147+
o.description = font_red..bold_on..translate("Edit Your Other Parameters Here")..bold_off..font_off
148+
o.rmempty = true
149+
function o.cfgvalue(self, section)
150+
if self.map:get(section, "other_parameters") == nil then
151+
return "# Example:\n"..
152+
"# Only support YAML, four spaces need to be reserved at the beginning of each line to maintain formatting alignment\n"..
153+
"# 示例:\n"..
154+
"# 仅支持 YAML, 每行行首需要多保留四个空格以使脚本处理后能够与上方配置保持格式对齐\n"..
155+
"# inline Example:\n"..
156+
"# payload:\n"..
157+
"# - '.blogger.com'\n"..
158+
"# - '*.*.microsoft.com'\n"..
159+
"# - 'books.itunes.apple.com'\n"
160+
else
161+
return Value.cfgvalue(self, section)
162+
end
163+
end
164+
function o.validate(self, value)
165+
if value then
166+
value = value:gsub("\r\n?", "\n")
167+
value = value:gsub("%c*$", "")
168+
end
169+
return value
170+
end
171+
139172
local t = {
140173
{Commit, Back}
141174
}
@@ -159,4 +192,5 @@ o.write = function()
159192
end
160193

161194
m:append(Template("openclash/toolbar_show"))
195+
m:append(Template("openclash/config_editor"))
162196
return m

0 commit comments

Comments
 (0)