~根据sayo-melu的pr,新增了下载dashboard面板后修改默认host端口为本机端口的功能
~增加了启动clash时对端口占用进行检测的功能
~界面优化
This commit is contained in:
juewuy
2020-08-17 12:44:55 +08:00
parent 8178a577df
commit 9da9606c57
5 changed files with 14 additions and 7 deletions

Binary file not shown.

View File

@@ -1 +1 @@
versionsh=0.9.4
versionsh=0.9.5

View File

@@ -59,12 +59,12 @@ fi
#输出状态
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[30;46m欢迎使用Clash for Miwifi\033[0m"
echo -e "\033[30;46m欢迎使用Clash for Miwifi\033[0m 版本:$versionsh_l"
echo -e "Clash服务"$run""$auto""
if [ $status -gt 0 ];then
echo -e "当前内存占用:\033[44m"$VmRSS"\033[0m已运行\033[46;30m"$day"\033[44;37m"$time"\033[0m"
fi
echo -e "我的博客:\033[36;4mjuewuy.xyz\033[0m交流反馈群:\033[36;4mt.me/clashfm\033[0m"
echo -e "博客:\033[36;4mhttps://juewuy.xyz\033[0mTG群:\033[36;4mhttps://t.me/clashfm\033[0m"
echo -----------------------------------------------
#安装clash核心
if [ ! -f $clashdir/clash ];then
@@ -93,19 +93,18 @@ clashstart(){
/etc/init.d/clash stop > /dev/null 2>&1
echo -e "\033[31mClash服务已停止\033[0m"
fi
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/etc/init.d/clash start
sleep 1
status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
if [[ $status -gt 0 ]];then
host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mclash服务已启动\033[0m"
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板连接更稳定\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31mclash服务启动失败请检查配置文件\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fi

View File

@@ -3,7 +3,7 @@
# Copyright (C) 2007 OpenWrt.org
USE_PROCD=1
START=99
START=92
getconfig(){
#开机加载环境变量保证找到文件路径
@@ -30,6 +30,10 @@ fi
if [ "$common_ports" = "已开启" ];then
ports='-m multiport --dports 22,53,587,465,995,993,143,80,443 '
fi
#检测系统端口占用
for portx in 1053 7890 7892 9999 ;do
[ -n "$(netstat -ntulp |grep $portx|grep -v clash)" ] && echo -e "检测到端口:\033[30;47m $portx \033[0m被占用clash无法启动" && exit;
done
}
modify_yaml(){
##########需要变更的配置###########

View File

@@ -443,7 +443,11 @@ if [ "$res" = '1' ]; then
mkdir -p /www/clash > /dev/null
tar -zxvf '/tmp/clashdb.tar.gz' -C /www/clash > /dev/null
[ $? -ne 0 ] && echo "文件解压失败!" && exit 1
echo -e "\033[32m面板安装成功"
#修改默认host和端口
sed -i "s/127.0.0.1/$host/g" /www/clash/js/*.js
sed -i "s/9090/9999/g" /www/clash/js/*.js
#
echo -e "\033[32m面板安装成功\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[36m请使用\033[32;4mhttp://$host/clash\033[0;36m访问面板\033[0m"
rm -rf /tmp/clashdb.tar.gz