v1.0.0beta17.2
~修复使用在线节点时获取配置文件报错的bug ~修复手动更新订阅界面不显示已保存链接的bug ~下载dashboard面板时,自动检测目录是否可写
This commit is contained in:
@@ -80,6 +80,8 @@ getconfig(){
|
||||
sed -i "1i\userguide=1" $ccfg
|
||||
[ "$res" = 1 ] && source $clashdir/getdate.sh && userguide
|
||||
fi
|
||||
#检查执行权限
|
||||
[ ! -x $clashdir/start.sh ] && chmod +x $clashdir/start.sh
|
||||
}
|
||||
setconfig(){
|
||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||
@@ -95,9 +97,9 @@ errornum(){
|
||||
startover(){
|
||||
echo -e "\033[32mclash服务已启动!\033[0m"
|
||||
if [ -n "$hostdir" ];then
|
||||
echo -e "请使用\033[4;32mhttp://$host$hostdir\033[0m管理内置规则"
|
||||
echo -e "请使用 \033[4;32mhttp://$host$hostdir\033[0m 管理内置规则"
|
||||
else
|
||||
echo -e "可使用\033[4;32mhttp://clash.razord.top\033[0m管理内置规则"
|
||||
echo -e "可使用 \033[4;32mhttp://clash.razord.top\033[0m 管理内置规则"
|
||||
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m $db_port \033[0m"
|
||||
echo -e "推荐前往更新菜单安装本地Dashboard面板,连接更稳定!\033[0m"
|
||||
fi
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=92
|
||||
START=99
|
||||
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
USE_PROCD=1
|
||||
#获取目录
|
||||
DIR=$(cat /etc/profile | grep clashdir | awk -F "\"" '{print $2}')
|
||||
[ -z "$DIR" ] && DIR=$(cat ~/.bashrc | grep clashdir | awk -F "\"" '{print $2}')
|
||||
BINDIR=$(cat $DIR/mark | grep bindir | awk -F "=" '{print $2}')
|
||||
[ -z "$BINDIR" ] && BINDIR=$DIR
|
||||
|
||||
|
||||
@@ -295,18 +295,6 @@ clashlink(){
|
||||
getlink
|
||||
|
||||
elif [ "$num" = 2 ];then
|
||||
if [ -n "$Url" ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m检测到已记录的订阅链接:\033[0m"
|
||||
echo -e "\033[4;32m$Url\033[0m"
|
||||
echo -----------------------------------------------
|
||||
read -p "清空链接/追加导入?[1/0] > " res
|
||||
if [ "$res" = '1' ]; then
|
||||
Url=""
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m链接已清空!\033[0m"
|
||||
fi
|
||||
fi
|
||||
getlink2
|
||||
|
||||
elif [ "$num" = 3 ];then
|
||||
@@ -354,7 +342,7 @@ clashlink(){
|
||||
else
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m当前系统记录的订阅链接为:\033[0m"
|
||||
echo -e "\033[4;32m$Url\033[0m"
|
||||
echo -e "\033[4;32m$Url$Https\033[0m"
|
||||
echo -----------------------------------------------
|
||||
read -p "确认更新配置文件?[1/0] > " res
|
||||
if [ "$res" = '1' ]; then
|
||||
@@ -600,25 +588,30 @@ getdb(){
|
||||
errornum
|
||||
update
|
||||
fi
|
||||
echo -----------------------------------------------
|
||||
echo -e "请选择面板\033[33m安装目录:\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 1 在$clashdir/ui目录安装(推荐!安装后会自动重启clash服务!)"
|
||||
echo -e " 2 在/www/clash目录安装(依赖Openwrt的Nginx服务,可能失败!)"
|
||||
echo -----------------------------------------------
|
||||
echo " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -w /www/clash ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e "请选择面板\033[33m安装目录:\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 1 在$clashdir/ui目录安装"
|
||||
echo -e " 2 在/www/clash目录安装(推荐!)"
|
||||
echo -----------------------------------------------
|
||||
echo " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
|
||||
if [ -z "$num" ];then
|
||||
update
|
||||
elif [ "$num" = '1' ]; then
|
||||
dbdir=$clashdir/ui
|
||||
hostdir=":$db_port/ui"
|
||||
elif [ "$num" = '2' ]; then
|
||||
if [ -z "$num" ];then
|
||||
update
|
||||
elif [ "$num" = '1' ]; then
|
||||
dbdir=$clashdir/ui
|
||||
hostdir=":$db_port/ui"
|
||||
elif [ "$num" = '2' ]; then
|
||||
dbdir=/www/clash
|
||||
hostdir='/clash'
|
||||
else
|
||||
update
|
||||
fi
|
||||
else
|
||||
dbdir=/www/clash
|
||||
hostdir='/clash'
|
||||
else
|
||||
update
|
||||
fi
|
||||
#下载及安装
|
||||
if [ -d /www/clash -o -d $clashdir/ui ];then
|
||||
|
||||
@@ -55,7 +55,7 @@ webget(){
|
||||
[ "$3" = "echoon" ] && progress=''
|
||||
[ -z "$4" ] && redirect='' || redirect='--max-redirect=0'
|
||||
wget -Y on $progress $redirect --no-check-certificate --timeout=5 -O $1 $2
|
||||
[ $? -eq 0 ] && result="200"
|
||||
[ "$?" = 0 ] && result="200"
|
||||
fi
|
||||
export all_proxy=''
|
||||
}
|
||||
@@ -148,8 +148,8 @@ EOF`
|
||||
fi
|
||||
else
|
||||
Https=""
|
||||
#检测节点
|
||||
if [ -z "$(cat $yamlnew | grep 'server:' | grep -v 'nameserver')" ];then
|
||||
#检测节点或providers
|
||||
if [ -z "$(cat $yamlnew | grep -E 'server:|proxy-providers:' | grep -v 'nameserver')" ];then
|
||||
echo -----------------------------------------------
|
||||
logger "获取到了配置文件,但似乎并不包含正确的节点信息!" 31
|
||||
echo -----------------------------------------------
|
||||
@@ -182,8 +182,7 @@ EOF`
|
||||
mv -f $yamlnew $yaml
|
||||
fi
|
||||
echo 配置文件已生成!正在启动clash使其生效!
|
||||
#重启clash服务
|
||||
$0 stop
|
||||
#启动clash服务
|
||||
$0 start
|
||||
if [ "$?" = 0 ];then
|
||||
logger "配置文件获取成功!clash服务已启动!"
|
||||
@@ -489,7 +488,7 @@ bfstart(){
|
||||
#检查clash核心
|
||||
if [ ! -f $bindir/clash ];then
|
||||
if [ -f $clashdir/clash ];then
|
||||
mv $clashdir/clash $bindir/clash && chmod 777 $bindir/clash
|
||||
mv $clashdir/clash $bindir/clash && chmod +x $bindir/clash
|
||||
else
|
||||
logger "未找到clash核心,正在下载!" 33
|
||||
[ -z "$clashcore" ] && [ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && clashcore=clashpre || clashcore=clash
|
||||
@@ -613,7 +612,7 @@ getyaml)
|
||||
getyaml
|
||||
;;
|
||||
webget)
|
||||
webget $1 $2 $3 $4
|
||||
webget $2 $3 $4 $5
|
||||
;;
|
||||
web_save)
|
||||
getconfig
|
||||
|
||||
Reference in New Issue
Block a user