~更新在线下载GeoIP数据库功能
~更新在线下载及部署Dashboard面板功能
~UI小幅度优化
This commit is contained in:
juewuy
2020-08-07 19:18:14 +08:00
parent 119f34894a
commit 8ce2598ff2
5 changed files with 100 additions and 19 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -12,7 +12,7 @@ result=$(curl -w %{http_code} -skLo /tmp/clashversion $url/bin/version)
[ "$result" != "200" ] && echo "无法连接到服务器!" && exit 1
source /tmp/clashversion
echo -----------------------------------------------
echo -e "最新版本\033[32m $versionsh \033[0m"
echo -e "~~~~版本:\033[32m$versionsh\033[0m"
echo -----------------------------------------------
echo -e "\033[44m使用中如遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo -e "\033[37m目前仅支持小米AX系列3款路由器"

View File

@@ -9,7 +9,7 @@ echo "***********************************************"
getconfig(){
#版本号
versionsh_l=0.8.3
versionsh_l=0.8.4
#更新服务器地址
update_url="https://juewuy.xyz/clash"
#文件路径
@@ -65,10 +65,18 @@ echo -e "当前内存占用:\033[44m"$VmRSS"\033[0m已运行\033[46;30m"
fi
#安装clash核心
if [ ! -f $clashdir/clash ];then
echo -----------------------------------------------
echo -e "\033[31m没有找到核心文件请先下载clash核心\033[0m"
source $clashdir/getdate.sh
getcore
fi
#安装GeoIP数据库
if [ ! -f $clashdir/Country.mmdb ];then
echo -----------------------------------------------
echo -e "\033[31m没有找到GeoIP数据库文件请先下载数据库\033[0m"
source $clashdir/getdate.sh
getgeo
fi
}
clashstart(){
@@ -76,10 +84,11 @@ clashstart(){
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管理内置规则"
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 -e "也可以前往更新菜单安装本地Dashboard面板连接更稳定"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
else
echo -----------------------------------------------
@@ -397,15 +406,16 @@ exit;
update(){
echo -----------------------------------------------
echo -e "\033[33m欢迎使用更新功能\033[0m"
echo -----------------------------------------------
echo -e "感谢:\033[32mClash \033[0m作者\033[36m Dreamacro\033[0m 项目地址:\033[32mhttps://github.com/Dreamacro/clash\033[0m"
echo -e "感谢:\033[32mClashR \033[0m作者\033[36m BROBIRD\033[0m 项目地址:\033[32mhttps://github.com/BROBIRD/clash\033[0m"
echo -e "感谢:\033[32mtun2socks \033[0m作者\033[36m eycorsican\033[0m 项目地址:\033[32mhttps://github.com/eycorsican/go-tun2socks\033[0m"
echo -e "感谢:\033[32m更多的帮助过我的人\033[0m"
echo -----------------------------------------------
echo -e " 1 更新管理脚本"
echo -e " 2 更新\替换clash核心文件"
echo -e " 3 更新GeoIP数据库(施工中)"
echo -e " 9 卸载clash"
echo -e " 1 更新\033[36m管理脚本\033[0m"
echo -e " 2 切换\033[33mclash核心\033[0m"
echo -e " 3 更新\033[32mGeoIP数据库\033[0m"
echo -e " 4 安装本地\033[35mDashboard\033[0m面板"
echo -e " 9 \033[31m卸载\033[34mClash for Miwfi\033[0m"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [[ $num -le 9 ]] > /dev/null 2>&1; then
@@ -424,6 +434,10 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
source $clashdir/getdate.sh
getgeo
elif [[ $num == 4 ]]; then
source $clashdir/getdate.sh
getdb
elif [[ $num == 9 ]]; then
read -p "确认卸载clash警告该操作不可逆[1/0] " res
if [ "$res" = '1' ]; then
@@ -431,6 +445,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
/etc/init.d/clash stop
rm -rf $clashdir
rm -rf /etc/init.d/clash
rm -rf /www/clash
rm -rf $csh
sed -i '/alias clash=*/'d /etc/profile
sed -i '/export clashdir=*/'d /etc/profile
@@ -458,8 +473,8 @@ echo -e " 3 \033[31m停止\033[0mclash服务"
echo -e " 4 $auto1"
echo -e " 5 设置定时任务(施工中)"
echo -e " 6 导入\033[32m节点/订阅\033[0m链接"
echo -e " 8 \033[36m测试菜单\033[0m"
echo -e " 9 \033[32m检查更新\033[0m"
echo -e " 8 \033[35m测试菜单\033[0m"
echo -e " 9 \033[36m更新/卸载\033[0m"
echo -e " 0 \033[0m退出脚本\033[0m"
read -p "请输入对应数字 > " num
if [[ $num -le 9 ]] > /dev/null 2>&1; then
@@ -517,17 +532,18 @@ echo -e "\033[36m正在施工中敬请期待\033[0m"
elif [[ $num == 8 ]]; then
echo -----------------------------------------------
echo -e "\033[31m这里是测试命令菜单\033[0m"
echo 1 不能正常运行时,手动运行clash查看报错信息
echo 2 查看系统53端口占用
echo 3 测试ssl加密aes-128-gcm跑分
echo 4 查看iptables端口转发详情
echo 5 查看config.yaml前40行
echo 6 测试代理服务器连通性
echo 0 返回上级目录!
echo " 1 查看clash运行时的报错信息"
echo " 2 查看系统DNS端口(:53)占用 "
echo " 3 测试ssl加密aes-128-gcm跑分"
echo " 4 查看iptables端口转发详情"
echo " 5 查看config.yaml前40行"
echo " 6 测试代理服务器连通性google.tw)"
echo " 0 返回上级目录!"
read -p "请输入对应数字 > " num
if [[ $num == 0 ]]; then
clashsh
elif [[ $num == 1 ]]; then
etc/init.d/clash stop
echo -e "\033[31m如有报错请截图后到TG群询问\033[0m"
$clashdir/clash -d $clashdir & { sleep 3 ; kill $! & }
echo -e "\033[31m如有报错请截图后到TG群询问\033[0m"

View File

@@ -332,8 +332,73 @@ result=$(curl -w %{http_code} -kLo /tmp/clash.new $corelink)
}
getgeo(){
echo 未完成,敬请期待!!!!
echo -----------------------------------------------
echo -e "\033[32m感谢Alecthw大神提供的优质GeoIP数据库\033[0m"
echo -----------------------------------------------
echo -e "\033[33m请选择下载源\033[0m"
echo -e " 1 我的个人服务器"
echo -e " 2 Alecthw大神提供的服务器"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [[ $num == 0 ]]; then
update
elif [[ $num == 1 ]]; then
geolink="$update_url/bin/Country.mmdb"
echo $geolink
elif [[ $num == 2 ]]; then
geolink="http://www.ideame.top/mmdb/Country.mmdb"
else
echo -e "\033[31m请输入正确的数字\033[0m"
update
exit;
fi
echo -----------------------------------------------
echo 正在从服务器获取数据库文件…………
result=$(curl -w %{http_code} -kLo $clashdir/Country.mmdb $geolink)
if [ "$result" != "200" ];then
echo -----------------------------------------------
echo -e "\033[31m文件下载失败\033[0m"
echo -----------------------------------------------
getgeo
else
echo -----------------------------------------------
echo -e "\033[32mGeoIP数据库文件下载成功\033[0m"
update
fi
update
}
getdb(){
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[36m安装本地版dashboard管理面板\033[0m"
echo -----------------------------------------------
echo -e "\033[32m打开管理面板的速度更快且更稳定"
echo -e "\033[33m需要占用约500kb的本地空间(目录:/www/clash)\033[0m"
echo -e "\033[36m可以使用\033[32;4mhttp://$host/clash\033[0;36m访问面板\033[0m"
echo -----------------------------------------------
read -p "是否安装/更新安装本地面板?[1/0] > " res
if [ "$res" = '1' ]; then
dblink="$update_url/bin/clashdb.tar.gz"
echo -----------------------------------------------
echo 正在连接服务器获取安装文件…………
result=$(curl -w %{http_code} -kLo /tmp/clashdb.tar.gz $dblink)
if [ "$result" != "200" ];then
echo -----------------------------------------------
echo -e "\033[31m文件下载失败\033[0m"
echo -----------------------------------------------
getdb
else
echo -e "\033[33m下载成功正在解压文件\033[0m"
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面板安装成功"
echo -----------------------------------------------
echo -e "\033[36m请使用\033[32;4mhttp://$host/clash\033[0;36m访问面板\033[0m"
rm -rf /tmp/clashdb.tar.gz
update
fi
fi
update
}