~修复数据库无法下载的bug
This commit is contained in:
juewuy
2024-01-04 23:05:00 +08:00
parent e93af12812
commit 809a5b224c
3 changed files with 47 additions and 43 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1018,57 +1018,57 @@ setgeo(){
} }
getdb(){ getdb(){
#下载及安装 dblink="${update_url}/bin/dashboard/${db_type}.tar.gz"
if [ -f /www/clash/CNAME -o -f $CRASHDIR/ui/CNAME ];then echo -----------------------------------------------
echo 正在连接服务器获取安装文件…………
$CRASHDIR/start.sh webget $TMPDIR/clashdb.tar.gz $dblink
if [ "$?" = "1" ];then
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[31m检测到您已经安装过本地面板了\033[0m" echo -e "\033[31m文件下载失败\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "是否覆盖安装?[1/0] > " res error_down
if [ "$res" = 1 ]; then setdb
rm -rf /www/clash else
rm -rf $CRASHDIR/ui echo -e "\033[33m下载成功正在解压文件\033[0m"
rm -rf $bindir/ui mkdir -p $dbdir > /dev/null
dblink="${update_url}/bin/dashboard/${db_type}.tar.gz" tar -zxvf "$TMPDIR/clashdb.tar.gz" -C $dbdir > /dev/null
echo ----------------------------------------------- if [ $? -ne 0 ];then
echo 正在连接服务器获取安装文件………… tar -zxvf "$TMPDIR/clashdb.tar.gz" --no-same-permissions -C $dbdir > /dev/null
$CRASHDIR/start.sh webget $TMPDIR/clashdb.tar.gz $dblink [ $? -ne 0 ] && echo "文件解压失败!" && rm -rf $TMPDIR/clashfm.tar.gz && exit 1
if [ "$?" = "1" ];then
echo -----------------------------------------------
echo -e "\033[31m文件下载失败\033[0m"
echo -----------------------------------------------
error_down
setdb
else
echo -e "\033[33m下载成功正在解压文件\033[0m"
mkdir -p $dbdir > /dev/null
tar -zxvf "$TMPDIR/clashdb.tar.gz" -C $dbdir > /dev/null
if [ $? -ne 0 ];then
tar -zxvf "$TMPDIR/clashdb.tar.gz" --no-same-permissions -C $dbdir > /dev/null
[ $? -ne 0 ] && echo "文件解压失败!" && rm -rf $TMPDIR/clashfm.tar.gz && exit 1
fi
#修改默认host和端口
if [ "$db_type" = "clashdb" -o "$db_type" = "meta_db" -o "$db_type" = "meta_xd" ];then
sed -i "s/127.0.0.1/${host}/g" $dbdir/assets/*.js
sed -i "s/9090/${db_port}/g" $dbdir/assets/*.js
else
sed -i "s/127.0.0.1:9090/${host}:${db_port}/g" $dbdir/*.html
#sed -i "s/7892/${db_port}/g" $dbdir/app*.js
fi
#写入配置文件
setconfig hostdir \'$hostdir\'
echo -----------------------------------------------
echo -e "\033[32m面板安装成功\033[0m"
rm -rf $TMPDIR/clashdb.tar.gz
fi
else
echo -e "\033[33m安装已取消\033[0m"
fi fi
#修改默认host和端口
if [ "$db_type" = "clashdb" -o "$db_type" = "meta_db" -o "$db_type" = "meta_xd" ];then
sed -i "s/127.0.0.1/${host}/g" $dbdir/assets/*.js
sed -i "s/9090/${db_port}/g" $dbdir/assets/*.js
else
sed -i "s/127.0.0.1:9090/${host}:${db_port}/g" $dbdir/*.html
#sed -i "s/7892/${db_port}/g" $dbdir/app*.js
fi
#写入配置文件
setconfig hostdir \'$hostdir\'
echo -----------------------------------------------
echo -e "\033[32m面板安装成功\033[0m"
rm -rf $TMPDIR/clashdb.tar.gz
fi fi
sleep 1 sleep 1
} }
setdb(){ setdb(){
dbdir(){ dbdir(){
if [ -w /www -a -n "$(pidof nginx)" ];then if [ -f /www/clash/CNAME -o -f $CRASHDIR/ui/CNAME ];then
echo -----------------------------------------------
echo -e "\033[31m检测到您已经安装过本地面板了\033[0m"
echo -----------------------------------------------
read -p "是否覆盖安装?[1/0] > " res
if [ "$res" = 1 ]; then
rm -rf $bindir/ui
[ -f /www/clash/CNAME ] && rm -rf /www/clash && dbdir=/www/clash
[ -f $CRASHDIR/ui/CNAME ] && rm -rf $CRASHDIR/ui && dbdir=$CRASHDIR/ui
getdb
else
setdb
echo -e "\033[33m安装已取消\033[0m"
fi
elif [ -w /www -a -n "$(pidof nginx)" ];then
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "请选择面板\033[33m安装目录\033[0m" echo -e "请选择面板\033[33m安装目录\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
@@ -1081,15 +1081,19 @@ setdb(){
if [ "$num" = '1' ]; then if [ "$num" = '1' ]; then
dbdir=$CRASHDIR/ui dbdir=$CRASHDIR/ui
hostdir=":$db_port/ui" hostdir=":$db_port/ui"
getdb
elif [ "$num" = '2' ]; then elif [ "$num" = '2' ]; then
dbdir=/www/clash dbdir=/www/clash
hostdir='/clash' hostdir='/clash'
getdb
else else
setdb setdb
echo -e "\033[33m安装已取消\033[0m"
fi fi
else else
dbdir=$CRASHDIR/ui dbdir=$CRASHDIR/ui
hostdir=":$db_port/ui" hostdir=":$db_port/ui"
getdb
fi fi
} }