Skip to content

Commit

Permalink
0.46.056
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Dec 3, 2024
1 parent 2000034 commit 35d6593
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 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.055
PKG_VERSION:=0.46.056
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
9 changes: 9 additions & 0 deletions luci-app-openclash/luasrc/controller/openclash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ local function startlog()
return line_trans
end

local funciton 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"]
Expand Down Expand Up @@ -1079,6 +1087,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();
})
Expand Down
4 changes: 4 additions & 0 deletions luci-app-openclash/luasrc/model/cbi/openclash/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ o = s:taboption("op_mode", Value, "log_size", translate("Log Size (KB)"))
o.description = translate("Set Log File Size (KB)")
o.default = "1024"

o = s:taboption("op_mode", Flag, "test_before_start", translate("Test Before Start"))
o.description = translate("Test Config Before Core Start")
o.default = 0

o = s:taboption("op_mode", Flag, "bypass_gateway_compatible", translate("Bypass Gateway Compatible"))
o.description = translate("If The Network Cannot be Connected in Bypass Gateway Mode, Please Try to Enable.")..font_red..bold_on..translate("Suggestion: If The Device Does Not Have WLAN, Please Disable The Lan Interface's Bridge Option")..bold_off..font_off
o.default = 0
Expand Down
7 changes: 6 additions & 1 deletion luci-app-openclash/luasrc/view/openclash/update.htm
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,12 @@
var oplv = status.oplv;
var oplvis = oplv.substring(oplv.indexOf("v") + 1,oplv.indexOf(","));
if ( oplvis != "" ) {
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash_'+oplvis+'_all.ipk';
if (status.pkg_type == "apk") {
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash-'+oplvis+'.apk';
}
else {
url2='https://raw.githubusercontent.com/vernesong/OpenClash/package/'+r+'/luci-app-openclash_'+oplvis+'_all.ipk';
}
window.location.href=url2;
}
else {
Expand Down
11 changes: 10 additions & 1 deletion luci-app-openclash/po/zh-cn/openclash.zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,9 @@ msgstr "警告:TUN 接口启动失败,请检查依赖情况或稍后重试
msgid "Warning: TUN Interface Start Failed, Try to Restart Again..."
msgstr "警告:TUN 接口启动失败,尝试重启内核..."

msgid "Error: Core Start Failed, Please Check The Log Infos!"
msgstr "错误:内核启动失败,请查看《内核日志》排查失败原因!"

msgid "Forced Sniff Pure IP Connections"
msgstr "强制探测(嗅探)所有纯 IP 的连接"

Expand Down Expand Up @@ -3427,4 +3430,10 @@ msgid "Direct"
msgstr "直连"

msgid "Error: Config File Overwrite Failed,"
msgstr "错误:配置文件覆写失败,"
msgstr "错误:配置文件覆写失败,"

msgid "Test Config Before Core Start"
msgstr "启动前调用内核测试配置文件"

msgid "Test Before Start"
msgstr "启动前测试"
15 changes: 14 additions & 1 deletion luci-app-openclash/root/etc/init.d/openclash
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ do_run_file()

config_test()
{
if [ -f "$CLASH" ]; then
if [ -f "$CLASH" ] && [ "$test_before_start" -eq 1 ]; then
LOG_OUT "Test The Config File First..."
test_info=$(nohup $CLASH -t -d $CLASH_CONFIG -f "$CONFIG_FILE")
local IFS=$'\n'
Expand Down Expand Up @@ -783,6 +783,7 @@ check_core_status()
{
TUN_WAIT=0
TUN_RESTART=1
CORE_HTTP_CODE=0
if [ -n "$en_mode_tun" ] || [ "$ipv6_mode" -eq 2 ] || [ "$ipv6_mode" -eq 3 ]; then
if [ -n "$en_mode_tun" ]; then
ip_="ip"
Expand Down Expand Up @@ -824,6 +825,17 @@ check_core_status()
ip route add default dev utun table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" ipproto icmp table main pref 8000
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" pref 8001
else
while ( [ -n "$(pidof clash)" ] && [ "$CORE_HTTP_CODE" != "200" ] && [ "$TUN_RESTART" -le 120 ] )
do
CORE_HTTP_CODE=$(curl -m 5 -o /dev/null -s -w '%{http_code}' -H 'Content-Type: application/json' -H "Authorization: Bearer ${da_password}" -XGET http://${lan_ip}:${cn_port}/group)
let TUN_WAIT++
sleep 1
done >/dev/null 2>&1
if [ -z "$(pidof clash)" ]; then
LOG_OUT "Error: Core Start Failed, Please Check The Log Infos!"
start_fail
fi
fi
}

Expand Down Expand Up @@ -2924,6 +2936,7 @@ get_config()
intranet_allowed_wan_name=$(uci -q get openclash.config.intranet_allowed_wan_name || echo 0)
custom_fakeip_filter_mode=$(uci -q get openclash.config.custom_fakeip_filter_mode || echo "blacklist")
iptables_compat=$(iptables -m owner -h 2>/dev/null | grep "owner match options" || echo 0)
test_before_start=$(uci -q get openclash.config.test_before_start || echo 0)
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
uci -q commit openclash
}
Expand Down
2 changes: 2 additions & 0 deletions luci-app-openclash/root/usr/share/openclash/yml_change.sh
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ threads << Thread.new {
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
Expand Down

0 comments on commit 35d6593

Please sign in to comment.