OpenClash: bump to 0.40.7-beta

This commit is contained in:
CN_SZTL 2020-10-01 13:44:39 +08:00
parent 720c041494
commit b0d1bb27bc
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
26 changed files with 236 additions and 147 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.40.6
PKG_VERSION:=0.40.7
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -55,6 +55,17 @@ function index()
end
local fs = require "luci.openclash"
local core_path_mode = luci.sys.exec("uci get openclash.config.small_flash_memory 2>/dev/null |tr -d '\n'")
if core_path_mode ~= "1" then
dev_core_path="/etc/openclash/core/clash"
tun_core_path="/etc/openclash/core/clash_tun"
game_core_path="/etc/openclash/core/clash_game"
else
dev_core_path="/tmp/etc/openclash/core/clash"
tun_core_path="/tmp/etc/openclash/core/clash_tun"
game_core_path="/tmp/etc/openclash/core/clash_game"
end
local function is_running()
return luci.sys.call("pidof clash >/dev/null") == 0
end
@ -143,26 +154,26 @@ local function coremodel()
end
local function corecv()
if not nixio.fs.access("/etc/openclash/core/clash") and not nixio.fs.access("/etc/openclash/clash") then
if not nixio.fs.access(dev_core_path) then
return "0"
else
return luci.sys.exec("/etc/openclash/core/clash -v 2>/dev/null |awk -F ' ' '{print $2}'")
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",dev_core_path))
end
end
local function coretuncv()
if not nixio.fs.access("/etc/openclash/core/clash_tun") then
if not nixio.fs.access(tun_core_path) then
return "0"
else
return luci.sys.exec("/etc/openclash/core/clash_tun -v 2>/dev/null |awk -F ' ' '{print $2}'")
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",tun_core_path))
end
end
local function coregamecv()
if not nixio.fs.access("/etc/openclash/core/clash_game") then
if not nixio.fs.access(game_core_path) then
return "0"
else
return luci.sys.exec("/etc/openclash/core/clash_game -v 2>/dev/null |awk -F ' ' '{print $2}'")
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",game_core_path))
end
end

View File

@ -89,6 +89,12 @@ o:depends("en_mode", "redir-host-tun")
o:depends("en_mode", "redir-host-vpn")
o:depends("en_mode", "redir-host-mix")
o = s:taboption("op_mode", ListValue, "small_flash_memory", font_red..bold_on..translate("Small Flash Memory")..bold_off..font_off)
o.description = translate("Move Core And GEOIP Data File To /tmp/etc/openclash For Small Flash Memory Device")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default = "0"
---- Operation Mode
switch_mode = s:taboption("op_mode", DummyValue, "", nil)
switch_mode.template = "openclash/switch_mode"

View File

@ -1039,4 +1039,10 @@ msgid "Convert Subscribe Online With Template, Mix Proxies and Keep Settings opt
msgstr "根据模板在线转换配置文件,混合节点和保留配置功能将不可用"
msgid "Convert Subscribe function of Online is Supported By subconverter Written By tindy X"
msgstr "在线订阅转换功能由tindy X通过subconverter提供支持"
msgstr "在线订阅转换功能由tindy X通过subconverter提供支持"
msgid "Small Flash Memory"
msgstr "小闪存模式"
msgid "Move Core And GEOIP Data File To /tmp/etc/openclash For Small Flash Memory Device"
msgstr "针对闪存空间不够的设备移动内核和GEOIP数据库文件到 /tmp/etc/openclash 文件夹"

View File

@ -28,6 +28,7 @@ config openclash 'config'
option operation_mode 'redir-host'
option enable_rule_proxy '0'
option redirect_dns '0'
option small_flash_memory '0'
config dns_servers
option group 'nameserver'

View File

@ -126,11 +126,6 @@ start_fail()
yml_merge()
{
#合并文件
if [ -z "$(grep "^Proxy:#d" "$PROXY_FILE")" ]; then
sed -i "s/^Proxy:/proxies:/g" "$PROXY_FILE" 2>/dev/null
else
sed -i "s/^Proxy:#d/proxies:/g" "$PROXY_FILE" 2>/dev/null
fi
cat "$CHANGE_FILE" "$DNS_FILE" "$PROXY_PROVIDER_FILE" "$PROXY_FILE" "$GROUP_FILE" "$RULE_PROVIDER_FILE" "$SCRIPT_FILE" "$RULE_FILE" > "$CONFIG_FILE" 2>/dev/null
}
@ -655,27 +650,35 @@ sed -i '/OpenClash-Game-Rules-End/d' "$RULE_FILE" 2>/dev/null
sed -i '/OpenClash-Game-Rules/r/tmp/yaml_game_rule_group.yaml' "$RULE_FILE" 2>/dev/null
}
yml_merge
#处理游戏节点与策略组
config_load "openclash"
config_foreach yml_rule_group_get "rule_provider_config"
config_foreach yml_rule_group_get "game_config"
sed -i '/^ \{0,\}proxy-groups:/r/tmp/yaml_groups.yaml' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}proxy-groups:/r/tmp/yaml_groups.yaml' "$GROUP_FILE" 2>/dev/null
sed -i '/^ \{0,\}Proxy:/d' /tmp/yaml_servers.yaml 2>/dev/null
sed -i '/^ \{0,\}proxy-providers:/d' /tmp/yaml_provider.yaml 2>/dev/null
if [ -z "$(grep "^ \{0,\}Proxy:" "$CONFIG_FILE" 2>/dev/null)" ] && [ -f "/tmp/yaml_servers.yaml" ]; then
sed -i '/^ \{0,\}proxy-groups:/i\Proxy:' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Proxy:/r/tmp/yaml_servers.yaml' "$CONFIG_FILE" 2>/dev/null
elif [ -f "/tmp/yaml_servers.yaml" ]; then
sed -i '/^ \{0,\}Proxy:/r/tmp/yaml_servers.yaml' "$CONFIG_FILE" 2>/dev/null
if [ ! -f "$PROXY_FILE" ] && [ -f "/tmp/yaml_servers.yaml" ]; then
echo "Proxy:" > "$PROXY_FILE" 2>/dev/null
sed -i '/Proxy:/r/tmp/yaml_servers.yaml' "$PROXY_FILE" 2>/dev/null
elif [ -f "/tmp/yaml_servers.yaml" ] && [ -z "$(grep "^Proxy:#d" "$PROXY_FILE")" ]; then
sed -i '/^Proxy:/r/tmp/yaml_servers.yaml' "$PROXY_FILE" 2>/dev/null
elif [ -f "/tmp/yaml_servers.yaml" ] && [ -n "$(grep "^Proxy:#d" "$PROXY_FILE")" ]; then
sed -i '/^Proxy:#d/r/tmp/yaml_servers.yaml' "$PROXY_FILE" 2>/dev/null
fi
if [ -z "$(grep "^ \{0,\}proxy-providers:" "$CONFIG_FILE" 2>/dev/null)" ] && [ -f "/tmp/yaml_provider.yaml" ]; then
sed -i '/OpenClash-General-Settings/a\proxy-providers:' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}proxy-providers:/r/tmp/yaml_provider.yaml' "$CONFIG_FILE" 2>/dev/null
if [ ! -f "$PROXY_PROVIDER_FILE" ] && [ -f "/tmp/yaml_provider.yaml" ]; then
echo "proxy-providers:" > "$PROXY_PROVIDER_FILE" 2>/dev/null
sed -i '/proxy-providers:/r/tmp/yaml_provider.yaml' "$PROXY_PROVIDER_FILE" 2>/dev/null
elif [ -f "/tmp/yaml_servers.yaml" ]; then
sed -i '/^ \{0,\}proxy-providers:r/tmp/yaml_provider.yaml' "$CONFIG_FILE" 2>/dev/null
sed -i '/^proxy-providers:r/tmp/yaml_provider.yaml' "$PROXY_PROVIDER_FILE" 2>/dev/null
fi
#关键字还原
if [ -z "$(grep "^Proxy:#d" "$PROXY_FILE")" ]; then
sed -i "s/^Proxy:/proxies:/g" "$PROXY_FILE" 2>/dev/null
else
sed -i "s/^Proxy:#d/proxies:/g" "$PROXY_FILE" 2>/dev/null
fi
}
yml_rule_set_add()
@ -962,13 +965,13 @@ if [ ! -f "$CONFIG_FILE" ]; then
echo "配置文件不存在,您已设置订阅信息,准备开始下载..." >$START_LOG
sleep 3
kill_clash
stop
nohup /usr/share/openclash/openclash.sh &
exit 0
elif [ ! -f "$CONFIG_FILE" ]; then
echo "错误: 缺少配置文件,请上传或更新配置文件!" >$START_LOG
echo "${LOGTIME} Config Not Found" >> $LOG_FILE
sleep 5
start_fail
exit 0
fi
fi
}
@ -1009,84 +1012,105 @@ do_run_mode()
fi
}
do_run_core()
do_run_file()
{
if [ ! -h "/etc/openclash/clash" ] && [ -s "/etc/openclash/clash" ] && [ ! -s "/etc/openclash/core/clash" ]; then
mv "/etc/openclash/clash" "/etc/openclash/core/clash" 2>/dev/null
fi
if [ "$small_flash_memory" != "1" ]; then
dev_core_path="/etc/openclash/core/clash"
tun_core_path="/etc/openclash/core/clash_tun"
game_core_path="/etc/openclash/core/clash_game"
geoip_path="/etc/openclash/Country.mmdb"
else
dev_core_path="/tmp/etc/openclash/core/clash"
tun_core_path="/tmp/etc/openclash/core/clash_tun"
game_core_path="/tmp/etc/openclash/core/clash_game"
geoip_path="/tmp/etc/openclash/Country.mmdb"
fi
rm -rf "/etc/openclash/clash" 2>/dev/null
rm -rf "/etc/openclash/clash" 2>/dev/null
if [ "$en_mode_tun" = "1" ] || [ "$en_mode_tun" = "3" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
core_type="Tun"
echo "检测到配置了【Tun】内核专属功能调用【Tun】内核启动..." >$START_LOG
sleep 1
fi
if [ "$en_mode_tun" = "1" ] || [ "$en_mode_tun" = "3" ]; then
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
core_type="Tun"
core_start_log="检测到配置了【Tun】内核专属功能调用【Tun】内核启动..."
fi
if [ "$en_mode_tun" = "2" ]; then
ln -s /etc/openclash/core/clash_game /etc/openclash/clash 2>/dev/null
core_type="Game"
echo "检测到配置了【Game】内核专属功能调用【Game】内核启动..." >$START_LOG
sleep 1
fi
if [ "$proxy_mode" = "script" ] || [ "$rule_source" = "ConnersHua" ] || [ "$rule_source" = "lhie1" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
core_type="Tun"
echo "检测到配置了【Tun】内核专属功能调用【Tun】内核启动..." >$START_LOG
sleep 1
fi
if [ "$en_mode_tun" = "2" ]; then
ln -s "$game_core_path" /etc/openclash/clash 2>/dev/null
core_type="Game"
core_start_log="检测到配置了【Game】内核专属功能调用【Game】内核启动..."
fi
if [ -n "$(grep "^ \{0,\}rule-providers:" "$RULE_PROVIDER_FILE" 2>/dev/null)" ] && [ -n "$(grep "^ \{0,\}behavior" "$RULE_PROVIDER_FILE" 2>/dev/null |grep -v "^ \{0,\}#")" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
core_type="Tun"
echo "检测到配置了【Tun】内核专属功能调用【Tun】内核启动..." >$START_LOG
sleep 1
fi
if [ "$proxy_mode" = "script" ] || [ "$rule_source" = "ConnersHua" ] || [ "$rule_source" = "lhie1" ]; then
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
core_type="Tun"
core_start_log="检测到配置了【Tun】内核专属功能调用【Tun】内核启动..."
fi
if [ -n "$(grep "^ \{0,\}rule-providers:" "$CONFIG_FILE" 2>/dev/null)" ] && [ -n "$(grep "^ \{0,\}behavior" "$CONFIG_FILE" 2>/dev/null |grep -v "^ \{0,\}#")" ]; then
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
core_type="Tun"
core_start_log="检测到配置了【Tun】内核专属功能调用【Tun】内核启动..."
fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash" ] && [ -z "$core_type" ]; then
ln -s /etc/openclash/core/clash /etc/openclash/clash 2>/dev/null
echo "未检测到特殊配置调用【Dev】内核启动..." >$START_LOG
sleep 1
fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "$dev_core_path" ] && [ -z "$core_type" ]; then
ln -s "$dev_core_path" /etc/openclash/clash 2>/dev/null
core_start_log="未检测到特殊配置调用【Dev】内核启动..."
fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash_tun" ] && [ "$core_type" != "Game" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
echo "检测到【Dev】内核未安装调用【Tun】内核启动..." >$START_LOG
sleep 1
fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "$tun_core_path" ] && [ "$core_type" != "Game" ]; then
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
core_start_log="检测到【Dev】内核未安装调用【Tun】内核启动..."
fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash_game" ] && [ "$core_type" != "Tun" ]; then
ln -s /etc/openclash/core/clash_game /etc/openclash/clash 2>/dev/null
echo "检测到【Dev】内核未安装调用【Game】内核启动..." >$START_LOG
sleep 1
fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "$game_core_path" ] && [ "$core_type" != "Tun" ]; then
ln -s "$game_core_path" /etc/openclash/clash 2>/dev/null
core_start_log="检测到【Dev】内核未安装调用【Game】内核启动..."
fi
#权限检查
[ ! -x "/etc/openclash/core/clash_tun" ] && chmod 4755 /etc/openclash/core/clash_tun 2>/dev/null
[ ! -x "/etc/openclash/core/clash_game" ] && chmod 4755 /etc/openclash/core/clash_game 2>/dev/null
[ ! -x "/etc/openclash/core/clash" ] && chmod 4755 /etc/openclash/core/clash 2>/dev/null
[ ! -f "$CLASH" ] && {
echo "检测到内核文件不存在,准备开始下载..." >$START_LOG
sleep 3
rm -rf "/tmp/clash_last_version" 2>/dev/null
[ ! -x "$tun_core_path" ] && chmod 4755 "$tun_core_path" 2>/dev/null
[ ! -x "$game_core_path" ] && chmod 4755 "$game_core_path" 2>/dev/null
[ ! -x "$dev_core_path" ] && chmod 4755 "$dev_core_path" 2>/dev/null
[ -f "$geoip_path" ] && [ "$small_flash_memory" = "1" ] && {
rm -rf "/etc/openclash/Country.mmdb" 2>/dev/null
ln -s "$geoip_path" /etc/openclash/Country.mmdb 2>/dev/null
}
[ ! -f "$geoip_path" ] && {
echo "检测到GEOIP数据库文件不存在准备开始下载..." >$START_LOG
sleep 3
kill_clash
nohup /usr/share/openclash/openclash_ipdb.sh &
exit 0
}
[ ! -f "$CLASH" ] && {
echo "检测到内核文件不存在,准备开始下载..." >$START_LOG
sleep 3
rm -rf "/tmp/clash_last_version" 2>/dev/null
kill_clash
nohup /usr/share/openclash/openclash_core.sh "$core_type" &
exit 0
}
}
start_run_core()
{
echo "$core_start_log" >$START_LOG
sleep 1
ulimit -SHn 65535 2>/dev/null
config_reload=$(uci get openclash.config.config_reload 2>/dev/null)
if [ -n "$(pidof clash)" ] && [ "$core_type" != "Tun" ] && [ "$config_reload" != "0" ]; then
curl -s --connect-timeout 5 -m 5 -H 'Content-Type: application/json' -H "Authorization: Bearer ${da_password}" -XPUT http://"$lan_ip":"$cn_port"/configs -d "{\"path\": \"$CONFIG_FILE\"}" 2>/dev/null
else
kill_clash
stop
nohup /usr/share/openclash/openclash_core.sh "$core_type" &
}
ulimit -SHn 65535 2>/dev/null
config_reload=$(uci get openclash.config.config_reload 2>/dev/null)
if [ -n "$(pidof clash)" ] && [ "$core_type" != "Tun" ] && [ "$config_reload" != "0" ]; then
curl -s --connect-timeout 5 -m 5 -H 'Content-Type: application/json' -H "Authorization: Bearer ${da_password}" -XPUT http://"$lan_ip":"$cn_port"/configs -d "{\"path\": \"$CONFIG_FILE\"}" 2>/dev/null
else
kill_clash
nohup "$CLASH" -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
fi
uci set openclash.config.config_reload=1 2>/dev/null
uci commit openclash
nohup "$CLASH" -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
fi
uci set openclash.config.config_reload=1 2>/dev/null
uci commit openclash
}
set_firewall()
@ -1437,6 +1461,7 @@ get_config()
enable_rule_proxy=$(uci get openclash.config.enable_rule_proxy 2>/dev/null)
stack_type=$(uci get openclash.config.stack_type 2>/dev/null)
china_ip_route=$(uci get openclash.config.china_ip_route 2>/dev/null)
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
}
yml_field_check()
@ -1479,6 +1504,9 @@ start()
echo "第一步: 获取配置..." >$START_LOG
get_config
#检查文件是否存在
do_run_file
echo "第二步: 配置文件检查..." >$START_LOG
yml_check "$en_mode" "$enable_custom_dns" "$CONFIG_FILE" "$BACKUP_FILE" "$START_BACKUP"
yml_dns_check
@ -1496,6 +1524,7 @@ start()
yml_provider_path "$RULE_PROVIDER_FILE" "rule_provider"
yml_custom_rule_provider
yml_game_custom
yml_merge
echo "第四步: DNS设置检查..." >$START_LOG
if [ -n "$(sed -n '/^ \{0,\}nameserver:/{n;p}' "$CONFIG_FILE" |grep '^ \{0,\}fallback:')" ] || [ -n "$(sed -n '/^ \{0,\}nameserver:/{n;p}' "$CONFIG_FILE" |grep 'OpenClash-General')" ]; then
@ -1507,8 +1536,8 @@ start()
fi
echo "第五步: 启动主程序..." >$START_LOG
#检查是否存在核心文件
do_run_core
sleep 1
start_run_core
#检测proxy_provider配置文件状态
echo "第六步: 等待主程序下载外部文件..." >$START_LOG

View File

@ -0,0 +1,19 @@
{
"files": {
"main.css": "./static/css/main.83e4b341.chunk.css",
"main.js": "./static/js/main.33688145.chunk.js",
"runtime-main.js": "./static/js/runtime-main.fefd5bb9.js",
"static/js/2.4c19c7e9.chunk.js": "./static/js/2.4c19c7e9.chunk.js",
"index.html": "./index.html",
"service-worker.js": "./service-worker.js",
"static/js/2.4c19c7e9.chunk.js.LICENSE.txt": "./static/js/2.4c19c7e9.chunk.js.LICENSE.txt",
"static/media/logo.45983944.png": "./static/media/logo.45983944.png",
"workbox-8a532145.js": "./workbox-8a532145.js"
},
"entrypoints": [
"static/js/runtime-main.fefd5bb9.js",
"static/js/2.4c19c7e9.chunk.js",
"static/css/main.83e4b341.chunk.css",
"static/js/main.33688145.chunk.js"
]
}

View File

@ -1 +1 @@
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><title>Clash</title><link href="main.01d1a3c82895ade21dbf.css" rel="stylesheet"></head><body><div id="root"></div><script src="js/1.bundle.01d1a3c82895ade21dbf.min.js"></script><script src="js/bundle.01d1a3c82895ade21dbf.min.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Clash web port"/><title>Clash</title><link href="./static/css/main.83e4b341.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,l=r[0],f=r[1],i=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./";var l=this["webpackJsonpclash-dashboard"]=this["webpackJsonpclash-dashboard"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var c=f;t()}([])</script><script src="./static/js/2.4c19c7e9.chunk.js"></script><script src="./static/js/main.33688145.chunk.js"></script></body></html>

View File

@ -0,0 +1 @@
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise(async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()})),s.then(()=>{if(!r[e])throw new Error(`Module ${e} didnt register its module`);return r[e]})},s=(s,r)=>{Promise.all(s.map(e)).then(e=>r(1===e.length?e[0]:e))},r={require:Promise.resolve(s)};self.define=(s,i,c)=>{r[s]||(r[s]=Promise.resolve().then(()=>{let r={};const t={uri:location.origin+s.slice(1)};return Promise.all(i.map(s=>{switch(s){case"exports":return r;case"module":return t;default:return e(s)}})).then(e=>{const s=c(...e);return r.default||(r.default=s),r})}))}}define("./service-worker.js",["./workbox-8a532145"],(function(e){"use strict";self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),e.clientsClaim(),e.precacheAndRoute([{url:"./index.html",revision:"b1a27ccef352baebb9667369555f9309"},{url:"./static/css/main.83e4b341.chunk.css",revision:"5a48466e5ff2a8ceec3348c3c498c260"},{url:"./static/js/2.4c19c7e9.chunk.js",revision:"d46b87667ddd715dd648d1ef8779c0b7"},{url:"./static/js/2.4c19c7e9.chunk.js.LICENSE.txt",revision:"176c1a1a28b19c611d9701905d8d60b7"},{url:"./static/js/main.33688145.chunk.js",revision:"62d6fab15c25a50205f635111e4e9e01"},{url:"./static/js/runtime-main.fefd5bb9.js",revision:"98f4f314ef9abb714a6c74c41e1e5a04"},{url:"./static/media/logo.45983944.png",revision:"198a55c9efe85ab0145d4402c07cfe65"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("./index.html"),{denylist:[/^\/_/,/\/[^/?]+\.[^/]+$/]}))}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){function r(r){for(var n,a,l=r[0],f=r[1],i=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./";var l=this["webpackJsonpclash-dashboard"]=this["webpackJsonpclash-dashboard"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var c=f;t()}([]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

View File

@ -7,11 +7,23 @@ LOG_FILE="/tmp/openclash.log"
CORE_TYPE="$1"
[ -z "$CORE_TYPE" ] || [ "$1" = "one_key_update" ] && CORE_TYPE="Dev"
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
CPU_MODEL=$(uci get openclash.config.core_version 2>/dev/null)
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
mkdir -p /etc/openclash/core
if [ "$small_flash_memory" != "1" ]; then
dev_core_path="/etc/openclash/core/clash"
tun_core_path="/etc/openclash/core/clash_tun"
game_core_path="/etc/openclash/core/clash_game"
mkdir -p /etc/openclash/core
else
dev_core_path="/tmp/etc/openclash/core/clash"
tun_core_path="/tmp/etc/openclash/core/clash_tun"
game_core_path="/tmp/etc/openclash/core/clash_game"
mkdir -p /tmp/etc/openclash/core
fi
[ -s "/tmp/openclash.auth" ] && {
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
@ -19,8 +31,9 @@ mkdir -p /etc/openclash/core
case $CORE_TYPE in
"Tun")
CORE_CV=$(/etc/openclash/core/clash_tun -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_CV=$($tun_core_path -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 2p /tmp/clash_last_version 2>/dev/null)
echo $CORE_CV >>/tmp/1
if [ -z "$CORE_LV" ]; then
echo "获取【Tun】内核最新版本信息失败请稍后再试..." >$START_LOG
echo "${LOGTIME} 【Tun】Core Version Check Error, Please Try Again After A few seconds" >>$LOG_FILE
@ -33,14 +46,14 @@ case $CORE_TYPE in
fi
;;
"Game")
CORE_CV=$(/etc/openclash/core/clash_game -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_CV=$($game_core_path -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 3p /tmp/clash_last_version 2>/dev/null)
if [ "$en_mode" = "fake-ip-vpn" ] || [ "$en_mode" = "redir-host-vpn" ]; then
if_restart=1
fi
;;
*)
CORE_CV=$(/etc/openclash/core/clash -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_CV=$($dev_core_path -v 2>/dev/null |awk -F ' ' '{print $2}')
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
if [ "$en_mode" = "fake-ip" ] || [ "$en_mode" = "redir-host" ]; then
if_restart=1
@ -87,7 +100,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
[ -s "/tmp/clash_tun.gz" ] && {
gzip -d /tmp/clash_tun.gz >/dev/null 2>&1
rm -rf /tmp/clash_tun.gz >/dev/null 2>&1
rm -rf /etc/openclash/core/clash_tun >/dev/null 2>&1
rm -rf "$tun_core_path" >/dev/null 2>&1
chmod 4755 /tmp/clash_tun >/dev/null 2>&1
chown root:root /tmp/clash_tun >/dev/null 2>&1
}
@ -97,18 +110,22 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
tar zxvf /tmp/clash_game.tar.gz -C /tmp >/dev/null 2>&1
mv /tmp/clash /tmp/clash_game >/dev/null 2>&1
rm -rf /tmp/clash_game.tar.gz >/dev/null 2>&1
rm -rf /etc/openclash/core/clash_game >/dev/null 2>&1
rm -rf "$game_core_path" >/dev/null 2>&1
chmod 4755 /tmp/clash_game >/dev/null 2>&1
chown root:root /tmp/clash_game >/dev/null 2>&1
}
;;
*)
[ -s "/tmp/clash.tar.gz" ] && {
rm -rf /etc/openclash/core/clash >/dev/null 2>&1
tar zxvf /tmp/clash.tar.gz -C /etc/openclash/core
rm -rf "$dev_core_path" >/dev/null 2>&1
if [ "$small_flash_memory" != "1" ]; then
tar zxvf /tmp/clash.tar.gz -C /etc/openclash/core
else
tar zxvf /tmp/clash.tar.gz -C /tmp/etc/openclash/core
fi
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
chmod 4755 /etc/openclash/core/clash >/dev/null 2>&1
chown root:root /etc/openclash/core/clash >/dev/null 2>&1
chmod 4755 "$dev_core_path" >/dev/null 2>&1
chown root:root "$dev_core_path" >/dev/null 2>&1
}
esac
@ -138,10 +155,10 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
case $CORE_TYPE in
"Tun")
mv /tmp/clash_tun /etc/openclash/core/clash_tun >/dev/null 2>&1
mv /tmp/clash_tun "$tun_core_path" >/dev/null 2>&1
;;
"Game")
mv /tmp/clash_game /etc/openclash/core/clash_game >/dev/null 2>&1
mv /tmp/clash_game "$game_core_path" >/dev/null 2>&1
;;
*)
esac

View File

@ -62,6 +62,8 @@ cat >> "$DEBUG_LOG" <<-EOF
生成时间: $LOGTIME
插件版本: $op_version
\`\`\`
EOF
cat >> "$DEBUG_LOG" <<-EOF
@ -278,6 +280,7 @@ else
rm -rf /tmp/yaml_general 2>/dev/null
cat "$CHANGE_FILE" "$DNS_FILE" >> "$DEBUG_LOG"
fi
sed -i '/^ \{0,\}secret:/d' "$DEBUG_LOG" 2>/dev/null
#firewall
cat >> "$DEBUG_LOG" <<-EOF
@ -371,4 +374,9 @@ cat >> "$DEBUG_LOG" <<-EOF
#===================== 最近运行日志 =====================#
EOF
tail -n 30 "/tmp/openclash.log" >> "$DEBUG_LOG" 2>/dev/null
tail -n 50 "/tmp/openclash.log" >> "$DEBUG_LOG" 2>/dev/null
cat >> "$DEBUG_LOG" <<-EOF
\`\`\`
EOF

View File

@ -7,11 +7,19 @@
START_LOG="/tmp/openclash_start.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
LOG_FILE="/tmp/openclash.log"
small_flash_memory=$(uci get openclash.config.small_flash_memory 2>/dev/null)
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
if [ -s "/tmp/openclash.auth" ]; then
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
fi
if [ "$small_flash_memory" != "1" ]; then
geoip_path="/etc/openclash/Country.mmdb"
mkdir -p /etc/openclash
else
geoip_path="/tmp/etc/openclash/Country.mmdb"
mkdir -p /tmp/etc/openclash
fi
echo "开始下载 GEOIP 数据库..." >$START_LOG
if pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb -o /tmp/Country.mmdb >/dev/null 2>&1
@ -20,7 +28,7 @@
fi
if [ "$?" -eq "0" ] && [ -s "/tmp/Country.mmdb" ]; then
echo "GEOIP 数据库下载成功,检查数据库版本是否更新..." >$START_LOG
cmp -s /tmp/Country.mmdb /etc/openclash/Country.mmdb
cmp -s /tmp/Country.mmdb "$geoip_path"
if [ "$?" -ne "0" ]; then
status=$(unify_ps_prevent)
while ( [ "$status" -gt 1 ] )
@ -29,13 +37,13 @@
status=$(unify_ps_prevent)
done
echo "数据库版本有更新,开始替换数据库版本..." >$START_LOG
mv /tmp/Country.mmdb /etc/openclash/Country.mmdb >/dev/null 2>&1
/etc/init.d/openclash restart
mv /tmp/Country.mmdb "$geoip_path" >/dev/null 2>&1
echo "删除下载缓存..." >$START_LOG
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
echo "GEOIP 数据库更新成功!" >$START_LOG
echo "${LOGTIME} GEOIP Database Update Successful" >>$LOG_FILE
sleep 10
sleep 5
/etc/init.d/openclash restart
echo "" >$START_LOG
else
echo "数据库版本没有更新,停止继续操作..." >$START_LOG

View File

@ -30,6 +30,14 @@ do
enable=$(uci get openclash.config.enable)
if [ "$enable" -eq 1 ]; then
clash_pids=$(pidof clash |sed 's/$//g' |wc -l)
if [ "$clash_pids" -gt 1 ]; then
echo "${LOGTIME} Watchdog: Multiple Clash Processes, Kill All..." >> $LOG_FILE
for clash_pid in $clash_pids; do
kill -9 "$clash_pid" 2>/dev/null
done >/dev/null 2>&1
sleep 1
fi 2>/dev/null
if ! pidof clash >/dev/null; then
CRASH_NUM=$(expr "$CRASH_NUM" + 1)
if [ "$CRASH_NUM" -le 3 ]; then

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,7 @@ yml_groups_set()
fi
#游戏策略组存在时判断节点是否存在
if [ ! -z "$if_game_group" ] && [ ! -z "$(grep "^ \{0,\}- name: $if_game_group" "$CONFIG_GROUP_FILE")" ]; then
if [ -n "$if_game_group" ] && [ -n "$(grep "^$if_game_group$" /tmp/Proxy_Group)" ]; then
config_foreach yml_servers_add "servers" "$name" "$type" "check" #加入服务器节点
config_foreach set_proxy_provider "proxy-provider" "$group_name" "check" #加入代理集
return