Skip to content

Commit 1db8494

Browse files
committed
chore: remove dev&tun core support
1 parent f58bd26 commit 1db8494

File tree

16 files changed

+172
-1012
lines changed

16 files changed

+172
-1012
lines changed

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

+4-49
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,8 @@ end
112112

113113
local core_path_mode = uci:get("openclash", "config", "small_flash_memory")
114114
if core_path_mode ~= "1" then
115-
dev_core_path="/etc/openclash/core/clash"
116-
tun_core_path="/etc/openclash/core/clash_tun"
117115
meta_core_path="/etc/openclash/core/clash_meta"
118116
else
119-
dev_core_path="/tmp/etc/openclash/core/clash"
120-
tun_core_path="/tmp/etc/openclash/core/clash_tun"
121117
meta_core_path="/tmp/etc/openclash/core/clash_meta"
122118
end
123119

@@ -129,10 +125,6 @@ local function is_web()
129125
return luci.sys.call("pidof clash >/dev/null") == 0
130126
end
131127

132-
local function restricted_mode()
133-
return uci:get("openclash", "config", "restricted_mode")
134-
end
135-
136128
local function is_watchdog()
137129
return process_status("openclash_watchdog.sh")
138130
end
@@ -161,14 +153,6 @@ local function lhie1()
161153
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/usr/share/openclash/res/lhie1.yaml"))
162154
end
163155

164-
local function ConnersHua()
165-
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/usr/share/openclash/res/ConnersHua.yaml"))
166-
end
167-
168-
local function ConnersHua_return()
169-
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/usr/share/openclash/res/ConnersHua_return.yaml"))
170-
end
171-
172156
local function chnroute()
173157
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/etc/openclash/china_ip_route.ipset"))
174158
end
@@ -241,29 +225,13 @@ local function coremodel()
241225
end
242226

243227
local function check_core()
244-
if not nixio.fs.access(dev_core_path) and not nixio.fs.access(tun_core_path) and not nixio.fs.access(meta_core_path) then
228+
if not nixio.fs.access(meta_core_path) then
245229
return "0"
246230
else
247231
return "1"
248232
end
249233
end
250234

251-
local function corecv()
252-
if not nixio.fs.access(dev_core_path) then
253-
return "0"
254-
else
255-
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'", dev_core_path))
256-
end
257-
end
258-
259-
local function coretuncv()
260-
if not nixio.fs.access(tun_core_path) then
261-
return "0"
262-
else
263-
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'", tun_core_path))
264-
end
265-
end
266-
267235
local function coremetacv()
268236
if not nixio.fs.access(meta_core_path) then
269237
return "0"
@@ -274,10 +242,8 @@ end
274242

275243
local function corelv()
276244
luci.sys.call("bash /usr/share/openclash/clash_version.sh")
277-
local core_lv = luci.sys.exec("sed -n 1p /tmp/clash_last_version 2>/dev/null")
278-
local core_tun_lv = luci.sys.exec("sed -n 2p /tmp/clash_last_version 2>/dev/null")
279245
local core_meta_lv = luci.sys.exec("sed -n 3p /tmp/clash_last_version 2>/dev/null")
280-
return core_lv .. "," .. core_tun_lv .. "," .. core_meta_lv
246+
return core_meta_lv
281247
end
282248

283249
local function opcv()
@@ -357,13 +323,9 @@ function core_download()
357323
local cdn_url = luci.http.formvalue("url")
358324
if cdn_url then
359325
luci.sys.call(string.format("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh '%s' >/dev/null 2>&1", cdn_url))
360-
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Dev' '%s' >/dev/null 2>&1 &", cdn_url))
361-
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'TUN' '%s' >/dev/null 2>&1 &", cdn_url))
362326
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Meta' '%s' >/dev/null 2>&1 &", cdn_url))
363327
else
364328
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
365-
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
366-
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
367329
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
368330
end
369331

@@ -754,7 +716,7 @@ function action_rule_mode()
754716
local daip = daip()
755717
local dase = dase() or ""
756718
local cn_port = cn_port()
757-
core_type = uci:get("openclash", "config", "core_type") or "Dev"
719+
core_type = uci:get("openclash", "config", "core_type") or "Meta"
758720
if not daip or not cn_port then return end
759721
info = json.parse(luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/configs', dase, daip, cn_port)))
760722
if info then
@@ -776,9 +738,7 @@ function action_switch_rule_mode()
776738
local daip = daip()
777739
local dase = dase() or ""
778740
local cn_port = cn_port()
779-
local core_type = uci:get("openclash", "config", "core_type") or "Dev"
780741
mode = luci.http.formvalue("rule_mode")
781-
if mode == script and core_type ~= "TUN" then luci.http.status(500, "Switch Faild") return end
782742
if not daip or not cn_port then luci.http.status(500, "Switch Faild") return end
783743
info = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XPATCH http://"%s":"%s"/configs -d \'{\"mode\": \"%s\"}\'', dase, daip, cn_port, mode))
784744
if info ~= "" then
@@ -1084,17 +1044,14 @@ function action_status()
10841044
db_forward_ssl = db_foward_ssl(),
10851045
web = is_web(),
10861046
cn_port = cn_port(),
1087-
restricted_mode = restricted_mode(),
1088-
core_type = uci:get("openclash", "config", "core_type") or "Dev";
1047+
core_type = uci:get("openclash", "config", "core_type") or "Meta";
10891048
})
10901049
end
10911050

10921051
function action_state()
10931052
luci.http.prepare_content("application/json")
10941053
luci.http.write_json({
10951054
lhie1 = lhie1(),
1096-
ConnersHua = ConnersHua(),
1097-
ConnersHua_return = ConnersHua_return(),
10981055
ipdb = ipdb(),
10991056
geosite = geosite(),
11001057
historychecktime = historychecktime(),
@@ -1120,8 +1077,6 @@ end
11201077
function action_update()
11211078
luci.http.prepare_content("application/json")
11221079
luci.http.write_json({
1123-
corecv = corecv(),
1124-
coretuncv = coretuncv(),
11251080
coremetacv = coremetacv(),
11261081
coremodel = coremodel(),
11271082
opcv = opcv(),

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function IsYmlFile(e)
4242
end
4343

4444
-- [[ Edit Game Rule ]] --
45-
s = m:section(TypedSection, "game_config", translate("Game Rules Append (Only TUN & Meta Core Support)"))
45+
s = m:section(TypedSection, "game_config", translate("Game Rules Append"))
4646
s.anonymous = true
4747
s.addremove = true
4848
s.sortable = true
@@ -118,7 +118,7 @@ o:value("REJECT")
118118
o.rmempty = true
119119

120120
-- [[ Edit Other Rule Provider ]] --
121-
s = m:section(TypedSection, "rule_provider_config", translate("Other Rule Providers Append (Only TUN & Meta Core Support)"))
121+
s = m:section(TypedSection, "rule_provider_config", translate("Other Rule Providers Append"))
122122
s.anonymous = true
123123
s.addremove = true
124124
s.sortable = true
@@ -204,7 +204,7 @@ o:value("0", translate("Priority Match"))
204204
o:value("1", translate("Extended Match"))
205205

206206
-- [[ Edit Custom Rule Provider ]] --
207-
s = m:section(TypedSection, "rule_providers", translate("Custom Rule Providers Append (Only TUN & Meta Core Support)"))
207+
s = m:section(TypedSection, "rule_providers", translate("Custom Rule Providers Append"))
208208
s.anonymous = true
209209
s.addremove = true
210210
s.sortable = true

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ o:value("trojan", translate("trojan"))
140140
o:value("vless", translate("Vless ")..translate("(Only Meta Core)"))
141141
o:value("hysteria", translate("Hysteria ")..translate("(Only Meta Core)"))
142142
o:value("hysteria2", translate("Hysteria2 ")..translate("(Only Meta Core)"))
143-
o:value("wireguard", translate("WireGuard")..translate("(TUN&Meta Core)"))
143+
o:value("wireguard", translate("WireGuard")..translate("(Only Meta Core)"))
144144
o:value("tuic", translate("Tuic")..translate("(Only Meta Core)"))
145145
o:value("snell", translate("Snell"))
146146
o:value("socks5", translate("Socks5"))

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ m.description = translate("Note: To restore the default configuration, try acces
3838
"<br/>"..font_green..translate("Note: Game proxy please use nodes except VMess")..font_off..
3939
"<br/>"..font_green..translate("Note: If you need to perform client access control in Fake-IP mode, please change the DNS hijacking mode to firewall forwarding")..font_off..
4040
"<br/>"..translate("Note: The default proxy routes local traffic, BT, PT download, etc., please use Redir-Host mode as much as possible and pay attention to traffic avoidance")..
41-
"<br/>"..translate("Note: If the connection is abnormal, please follow the steps on this page to check first")..": ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://github.com/vernesong/OpenClash/wiki/%E7%BD%91%E7%BB%9C%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8%E6%97%B6%E6%8E%92%E6%9F%A5%E5%8E%9F%E5%9B%A0\")'>"..translate("Click to the page").."</a>"
41+
"<br/>"..translate("Note: If the connection is abnormal, please follow the steps on this page to check first")..": ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://github.com/vernesong/OpenClash/wiki/%E7%BD%91%E7%BB%9C%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8%E6%97%B6%E6%8E%92%E6%9F%A5%E5%8E%9F%E5%9B%A0\")'>"..translate("Click to the page").."</a>"..
42+
"<br/>"..font_green..translate("For More Useful Meta Core Functions Go Wiki")..": "..font_off.."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/\")'>"..translate("https://wiki.metacubex.one/").."</a>"
4243

4344
s = m:section(TypedSection, "openclash")
4445
s.anonymous = true
@@ -59,10 +60,6 @@ s:tab("developer", translate("Developer Settings"))
5960
s:tab("debug", translate("Debug Logs"))
6061
s:tab("dlercloud", translate("Dler Cloud"))
6162

62-
o = s:taboption("op_mode", Flag, "enable_meta_core", font_red..bold_on..translate("Enable Meta Core")..bold_off..font_off)
63-
o.description = font_red..bold_on..translate("Some Premium Core Features are Unavailable, For Other More Useful Functions Go Wiki:")..bold_off..font_off.." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://wiki.metacubex.one/\")'>https://wiki.metacubex.one/</a>"
64-
o.default = 0
65-
6663
o = s:taboption("op_mode", ListValue, "en_mode", font_red..bold_on..translate("Select Mode")..bold_off..font_off)
6764
o.description = translate("Select Mode For OpenClash Work, Try Flush DNS Cache If Network Error")
6865
if op_mode == "redir-host" then
@@ -99,7 +96,6 @@ o.description = translate("Select Proxy Mode")
9996
o:value("rule", translate("Rule Proxy Mode"))
10097
o:value("global", translate("Global Proxy Mode"))
10198
o:value("direct", translate("Direct Proxy Mode"))
102-
o:value("script", translate("Script Proxy Mode (Tun Core Only)"))
10399
o.default = "rule"
104100

105101
o = s:taboption("op_mode", Value, "delay_start", translate("Delay Start (s)"))

luci-app-openclash/luasrc/view/openclash/status.htm

+2-24
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,7 @@
3636
<tr>
3737
<td colspan="4" width="100%">
3838
<p style="margin: 10px 0; text-align: center">
39-
<%
40-
if uci:get("openclash", "config", "enable_meta_core") ~= '1' then
41-
%>
42-
<img id="_logo" src="/luci-static/resources/openclash/img/logo.png?<%=random%>" loading="lazy" width="150px" height="150px" onload="return logo_check(this,this.src,'https://raw.githubusercontent.com/vernesong/OpenClash/<%=RELEASE_BRANCH%>/img/logo.png')" onerror="return logo_error(this,'/luci-static/resources/openclash/img/logo.png?<%=random%>')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
43-
<%
44-
else
45-
%>
46-
<img id="_logo" src="/luci-static/resources/openclash/img/meta.png?<%=random%>" loading="lazy" width="150px" height="150px" onload="return logo_check(this,this.src,'https://raw.githubusercontent.com/vernesong/OpenClash/<%=RELEASE_BRANCH%>/img/meta.png')" onerror="return logo_error(this,'/luci-static/resources/openclash/img/meta.png?<%=random%>')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
47-
<%
48-
end
49-
%>
39+
<img id="_logo" src="/luci-static/resources/openclash/img/meta.png?<%=random%>" loading="lazy" width="150px" height="150px" onload="return logo_check(this,this.src,'https://raw.githubusercontent.com/vernesong/OpenClash/<%=RELEASE_BRANCH%>/img/meta.png')" onerror="return logo_error(this,'/luci-static/resources/openclash/img/meta.png?<%=random%>')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
5040
</p>
5141
<p id="_clashversion" style="margin: 10px 0; text-align: center">
5242
<img src="/luci-static/resources/openclash/img/version.svg?<%=random%>" alt="currentversion" height="21px" onclick="return go_update()">
@@ -185,7 +175,6 @@
185175
</p>
186176
</td></tr>
187177
<tr><td width="25%"><%:Node Select Backup%></td><td width="25%" align="left" id="_historychecktime"><%:Collecting data...%></td><td width="25%"><%:lhie1 Rule Update%></td><td width="25%" align="left" id="_lhie1"><%:Collecting data...%></td></tr>
188-
<tr><td width="25%"><%:ConnersHua Rule Update%></td><td width="25%" align="left" id="_ConnersHua"><%:Collecting data...%></td><td width="25%"><%:ConnersHua Return Rule Update%></td><td width="25%" align="left" id="_ConnersHua_return"><%:Collecting data...%></td></tr>
189178
<tr><td width="25%"><%:Mainland IP Update%></td><td width="25%" align="left" id="_chnroute"><%:Collecting data...%></td><td width="25%"><%: Mainland IPv6 Update%></td><td width="25%" align="left" id="_chnroutev6"><%:Collecting data...%></td></tr>
190179
<tr><td width="25%"><%:GEOIP Data Update%></td><td width="25%" align="left" id="_ipdb"><%:Collecting data...%></td><td width="25%"><%:GeoSite Data Update%></td><td width="25%" align="left" id="_geosite"><%:Collecting data...%></td></tr>
191180
</table>
@@ -213,8 +202,6 @@
213202
var ipdb = document.getElementById('_ipdb');
214203
var geosite = document.getElementById('_geosite');
215204
var lhie1 = document.getElementById('_lhie1');
216-
var ConnersHua = document.getElementById('_ConnersHua');
217-
var ConnersHua_return = document.getElementById('_ConnersHua_return');
218205
var chnroute = document.getElementById('_chnroute');
219206
var chnroutev6 = document.getElementById('_chnroutev6');
220207
var historychecktime = document.getElementById('_historychecktime');
@@ -250,14 +237,7 @@
250237

251238
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "status")%>', null, function(x, status) {
252239
if ( x && x.status == 200 ) {
253-
if ( status.restricted_mode != "1" )
254-
{
255-
clash.innerHTML = status.clash ? '<b style=color:green>' + status.core_type +'&nbsp;&nbsp;&nbsp;<%:Running%></b>' : '<b style=color:red><%:Not Running%></b>';
256-
}
257-
else
258-
{
259-
clash.innerHTML = status.clash ? '<b style=color:green>' + status.core_type +'&nbsp;&nbsp;&nbsp;<%:Running%>&nbsp;&nbsp;&nbsp;<%:<Limited State>%></b>' : '<b style=color:red><%:Not Running%></b>';
260-
}
240+
clash.innerHTML = status.clash ? '<b style=color:green>' + status.core_type +'&nbsp;&nbsp;&nbsp;<%:Running%></b>' : '<b style=color:red><%:Not Running%></b>';
261241
watchdog.innerHTML = status.watchdog ? '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<%:Daemons%>:&nbsp;&nbsp;&nbsp;<b style=color:green><%:Running%></b>' : '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<%:Daemons%>:&nbsp;&nbsp;&nbsp;<b style=color:red><%:Not Running%></b>';
262242
dase.innerHTML = status.dase ? "<b style=color:green>"+status.dase+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
263243
web.innerHTML = status.web ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Yacd Control Panel%>" onclick="return ycad_dashboard(this)"/>' : '<b style=color:red><%:Not Running%></b>';
@@ -544,8 +524,6 @@
544524
ipdb.innerHTML = status.ipdb ? "<b style=color:green>"+status.ipdb+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
545525
geosite.innerHTML = status.geosite ? "<b style=color:green>"+status.geosite+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
546526
lhie1.innerHTML = status.lhie1 ? "<b style=color:green>"+status.lhie1+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
547-
ConnersHua.innerHTML = status.ConnersHua ? "<b style=color:green>"+status.ConnersHua+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
548-
ConnersHua_return.innerHTML = status.ConnersHua_return ? "<b style=color:green>"+status.ConnersHua_return+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
549527
chnroute.innerHTML = status.chnroute ? "<b style=color:green>"+status.chnroute+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
550528
chnroutev6.innerHTML = status.chnroutev6 ? "<b style=color:green>"+status.chnroutev6+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
551529
if ( status.historychecktime != "0" ) {

0 commit comments

Comments
 (0)