mirror of
https://github.com/flucont/btcloud.git
synced 2025-01-23 13:18:13 -05:00
update
This commit is contained in:
parent
ab81af3b94
commit
2c9f84c121
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
Linux_Version="7.9.6"
|
Linux_Version="7.9.6"
|
||||||
Windows_Version="7.7.0"
|
Windows_Version="7.8.0"
|
||||||
|
|
||||||
FILES=(
|
FILES=(
|
||||||
public/install/src/panel6.zip
|
public/install/src/panel6.zip
|
||||||
|
@ -15,9 +15,9 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
|
|||||||
('new_version', '7.9.6'),
|
('new_version', '7.9.6'),
|
||||||
('update_msg', '暂无更新日志'),
|
('update_msg', '暂无更新日志'),
|
||||||
('update_date', '2022-11-29'),
|
('update_date', '2022-11-29'),
|
||||||
('new_version_win', '7.7.0'),
|
('new_version_win', '7.8.0'),
|
||||||
('update_msg_win', '暂无更新日志'),
|
('update_msg_win', '暂无更新日志'),
|
||||||
('update_date_win', '2022-09-09'),
|
('update_date_win', '2022-12-08'),
|
||||||
('updateall_type', '0'),
|
('updateall_type', '0'),
|
||||||
('syskey', 'UqP94LtI8eWAIgCP');
|
('syskey', 'UqP94LtI8eWAIgCP');
|
||||||
|
|
||||||
|
@ -118,6 +118,33 @@ System_Check(){
|
|||||||
Install_Check
|
Install_Check
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Set_Ssl(){
|
||||||
|
echo -e ""
|
||||||
|
echo -e "----------------------------------------------------------------------"
|
||||||
|
echo -e "为了您的面板使用安全,建议您开启面板SSL,开启后请使用https访问宝塔面板"
|
||||||
|
echo -e "输入y回车即开启面板SSL并进行下一步安装"
|
||||||
|
echo -e "输入n回车跳过面板SSL配置,直接进行安装"
|
||||||
|
echo -e "10秒后将跳过SSL配置,直接进行面板安装"
|
||||||
|
echo -e "----------------------------------------------------------------------"
|
||||||
|
echo -e ""
|
||||||
|
read -t 10 -p "是否确定开启面板SSL ? (y/n): " yes
|
||||||
|
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
SET_SSL=false
|
||||||
|
else
|
||||||
|
case "$yes" in
|
||||||
|
y)
|
||||||
|
SET_SSL=true
|
||||||
|
;;
|
||||||
|
n)
|
||||||
|
SET_SSL=false
|
||||||
|
rm -f /www/server/panel/data/ssl.pl
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
Set_Ssl
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
Get_Pack_Manager(){
|
Get_Pack_Manager(){
|
||||||
if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then
|
if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then
|
||||||
PM="yum"
|
PM="yum"
|
||||||
@ -204,7 +231,7 @@ get_node_url(){
|
|||||||
|
|
||||||
echo '---------------------------------------------';
|
echo '---------------------------------------------';
|
||||||
echo "Selected download node...";
|
echo "Selected download node...";
|
||||||
nodes=(http://dg2.bt.cn http://dg1.bt.cn http://download.bt.cn http://125.90.93.52:5880 http://36.133.1.8:5880 http://123.129.198.197 http://103.179.243.14:5880 http://128.1.164.196);
|
nodes=(https://dg2.bt.cn https://dg1.bt.cn https://download.bt.cn);
|
||||||
|
|
||||||
if [ "$1" ];then
|
if [ "$1" ];then
|
||||||
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
|
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
|
||||||
@ -246,7 +273,7 @@ get_node_url(){
|
|||||||
if [ -z "$NODE_URL" ];then
|
if [ -z "$NODE_URL" ];then
|
||||||
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
|
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
|
||||||
if [ -z "$NODE_URL" ];then
|
if [ -z "$NODE_URL" ];then
|
||||||
NODE_URL='http://download.bt.cn';
|
NODE_URL='https://download.bt.cn';
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f $tmp_file1
|
rm -f $tmp_file1
|
||||||
@ -597,11 +624,8 @@ Install_Bt(){
|
|||||||
if [ -f ${setup_path}/server/panel/data/port.pl ];then
|
if [ -f ${setup_path}/server/panel/data/port.pl ];then
|
||||||
panelPort=$(cat ${setup_path}/server/panel/data/port.pl)
|
panelPort=$(cat ${setup_path}/server/panel/data/port.pl)
|
||||||
else
|
else
|
||||||
RE_NUM=$(expr $RANDOM % 3)
|
|
||||||
if [ "${RE_NUM}" == "1" ];then
|
|
||||||
panelPort=$(expr $RANDOM % 55535 + 10000)
|
panelPort=$(expr $RANDOM % 55535 + 10000)
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
mkdir -p ${setup_path}/server/panel/logs
|
mkdir -p ${setup_path}/server/panel/logs
|
||||||
mkdir -p ${setup_path}/server/panel/vhost/apache
|
mkdir -p ${setup_path}/server/panel/vhost/apache
|
||||||
mkdir -p ${setup_path}/server/panel/vhost/nginx
|
mkdir -p ${setup_path}/server/panel/vhost/nginx
|
||||||
@ -701,6 +725,8 @@ Set_Bt_Panel(){
|
|||||||
auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
|
auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
|
||||||
echo "/${auth_path}" > ${admin_auth}
|
echo "/${auth_path}" > ${admin_auth}
|
||||||
fi
|
fi
|
||||||
|
auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
|
||||||
|
echo "/${auth_path}" > ${admin_auth}
|
||||||
chmod -R 700 $pyenv_path/pyenv/bin
|
chmod -R 700 $pyenv_path/pyenv/bin
|
||||||
/www/server/panel/pyenv/bin/pip3 install pymongo
|
/www/server/panel/pyenv/bin/pip3 install pymongo
|
||||||
/www/server/panel/pyenv/bin/pip3 install psycopg2-binary
|
/www/server/panel/pyenv/bin/pip3 install psycopg2-binary
|
||||||
@ -708,6 +734,10 @@ Set_Bt_Panel(){
|
|||||||
/www/server/panel/pyenv/bin/pip3 install flask-sock
|
/www/server/panel/pyenv/bin/pip3 install flask-sock
|
||||||
auth_path=$(cat ${admin_auth})
|
auth_path=$(cat ${admin_auth})
|
||||||
cd ${setup_path}/server/panel/
|
cd ${setup_path}/server/panel/
|
||||||
|
if [ "$SET_SSL" == true ]; then
|
||||||
|
btpip install -I pyOpenSSl
|
||||||
|
btpython /www/server/panel/tools.py ssl
|
||||||
|
fi
|
||||||
/etc/init.d/bt start
|
/etc/init.d/bt start
|
||||||
$python_bin -m py_compile tools.py
|
$python_bin -m py_compile tools.py
|
||||||
$python_bin tools.py username
|
$python_bin tools.py username
|
||||||
@ -719,7 +749,7 @@ Set_Bt_Panel(){
|
|||||||
/etc/init.d/bt restart
|
/etc/init.d/bt restart
|
||||||
sleep 3
|
sleep 3
|
||||||
isStart=$(ps aux |grep 'BT-Panel'|grep -v grep|awk '{print $2}')
|
isStart=$(ps aux |grep 'BT-Panel'|grep -v grep|awk '{print $2}')
|
||||||
LOCAL_CURL=$(curl 127.0.0.1:8888/login 2>&1 |grep -i html)
|
LOCAL_CURL=$(curl 127.0.0.1:${panelPort}/login 2>&1 |grep -i html)
|
||||||
if [ -z "${isStart}" ] && [ -z "${LOCAL_CURL}" ];then
|
if [ -z "${isStart}" ] && [ -z "${LOCAL_CURL}" ];then
|
||||||
/etc/init.d/bt 22
|
/etc/init.d/bt 22
|
||||||
cd /www/server/panel/pyenv/bin
|
cd /www/server/panel/pyenv/bin
|
||||||
@ -797,7 +827,6 @@ Get_Ip_Address(){
|
|||||||
isHosts=$(cat /etc/hosts|grep 'www.bt.cn')
|
isHosts=$(cat /etc/hosts|grep 'www.bt.cn')
|
||||||
if [ -z "${isHosts}" ];then
|
if [ -z "${isHosts}" ];then
|
||||||
echo "" >> /etc/hosts
|
echo "" >> /etc/hosts
|
||||||
echo "116.213.43.206 www.bt.cn" >> /etc/hosts
|
|
||||||
getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
|
getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
|
||||||
if [ -z "${getIpAddress}" ];then
|
if [ -z "${getIpAddress}" ];then
|
||||||
sed -i "/bt.cn/d" /etc/hosts
|
sed -i "/bt.cn/d" /etc/hosts
|
||||||
@ -833,6 +862,7 @@ Setup_Count(){
|
|||||||
echo /www > /var/bt_setupPath.conf
|
echo /www > /var/bt_setupPath.conf
|
||||||
}
|
}
|
||||||
Install_Main(){
|
Install_Main(){
|
||||||
|
#Set_Ssl
|
||||||
startTime=`date +%s`
|
startTime=`date +%s`
|
||||||
Lock_Clear
|
Lock_Clear
|
||||||
System_Check
|
System_Check
|
||||||
@ -890,17 +920,28 @@ fi
|
|||||||
|
|
||||||
Install_Main
|
Install_Main
|
||||||
|
|
||||||
|
PANEL_SSL=$(cat /www/server/panel/data/ssl.pl 2> /dev/null)
|
||||||
|
if [ "${PANEL_SSL}" == "True" ];then
|
||||||
|
HTTP_S="https"
|
||||||
|
else
|
||||||
|
HTTP_S="http"
|
||||||
|
fi
|
||||||
|
|
||||||
echo > /www/server/panel/data/bind.pl
|
echo > /www/server/panel/data/bind.pl
|
||||||
echo -e "=================================================================="
|
echo -e "=================================================================="
|
||||||
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
|
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
|
||||||
echo -e "=================================================================="
|
echo -e "=================================================================="
|
||||||
echo "外网面板地址: http://${getIpAddress}:${panelPort}${auth_path}"
|
echo "外网面板地址: ${HTTP_S}://${getIpAddress}:${panelPort}${auth_path}"
|
||||||
echo "内网面板地址: http://${LOCAL_IP}:${panelPort}${auth_path}"
|
echo "内网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
|
||||||
echo -e "username: $username"
|
echo -e "username: $username"
|
||||||
echo -e "password: $password"
|
echo -e "password: $password"
|
||||||
echo -e "\033[33mIf you cannot access the panel,\033[0m"
|
echo -e "\033[33mIf you cannot access the panel,\033[0m"
|
||||||
echo -e "\033[33mrelease the following panel port [${panelPort}] in the security group\033[0m"
|
echo -e "\033[33mrelease the following panel port [${panelPort}] in the security group\033[0m"
|
||||||
echo -e "\033[33m若无法访问面板,请检查防火墙/安全组是否有放行面板[${panelPort}]端口\033[0m"
|
echo -e "\033[33m若无法访问面板,请检查防火墙/安全组是否有放行面板[${panelPort}]端口\033[0m"
|
||||||
|
if [ "${HTTP_S}" == "https" ];then
|
||||||
|
echo -e "\033[33m因已开启面板自签证书,访问面板会提示不匹配证书,请参考以下链接配置证书\033[0m"
|
||||||
|
echo -e "\033[33mhttps://www.bt.cn/bbs/thread-105443-1-1.html\033[0m"
|
||||||
|
fi
|
||||||
echo -e "=================================================================="
|
echo -e "=================================================================="
|
||||||
|
|
||||||
endTime=`date +%s`
|
endTime=`date +%s`
|
||||||
|
@ -10,7 +10,7 @@ export LANG=en_US.UTF-8
|
|||||||
export LANGUAGE=en_US:en
|
export LANGUAGE=en_US:en
|
||||||
|
|
||||||
get_node_url(){
|
get_node_url(){
|
||||||
nodes=(http://dg2.bt.cn http://dg1.bt.cn http://36.133.1.8:5880 http://123.129.198.197 http://38.34.185.130 http://116.213.43.206:5880 http://128.1.164.196);
|
nodes=(https://dg2.bt.cn https://dg1.bt.cn https://download.bt.cn https://hk1-node.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn);
|
||||||
|
|
||||||
if [ "$1" ];then
|
if [ "$1" ];then
|
||||||
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
|
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
|
||||||
@ -52,7 +52,7 @@ get_node_url(){
|
|||||||
if [ -z "$NODE_URL" ];then
|
if [ -z "$NODE_URL" ];then
|
||||||
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
|
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
|
||||||
if [ -z "$NODE_URL" ];then
|
if [ -z "$NODE_URL" ];then
|
||||||
NODE_URL='http://download.bt.cn';
|
NODE_URL='https://download.bt.cn';
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f $tmp_file1
|
rm -f $tmp_file1
|
||||||
@ -108,7 +108,7 @@ send_check(){
|
|||||||
chmod +x /etc/init.d/bt
|
chmod +x /etc/init.d/bt
|
||||||
p_path2=/www/server/panel/class/common.py
|
p_path2=/www/server/panel/class/common.py
|
||||||
p_version=$(cat $p_path2|grep "version = "|awk '{print $3}'|tr -cd [0-9.])
|
p_version=$(cat $p_path2|grep "version = "|awk '{print $3}'|tr -cd [0-9.])
|
||||||
curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/panel/notpro?version=$p_version
|
curl -sS --connect-timeout 3 -m 60 https://www.bt.cn/api/panel/notpro?version=$p_version
|
||||||
NODE_URL=""
|
NODE_URL=""
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
@ -147,3 +147,4 @@ if [ ! $NODE_URL ];then
|
|||||||
get_node_url
|
get_node_url
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -265,16 +265,15 @@ def GetLocalIp():
|
|||||||
ipaddress = readFile(filename)
|
ipaddress = readFile(filename)
|
||||||
if not ipaddress:
|
if not ipaddress:
|
||||||
|
|
||||||
url = 'http://pv.sohu.com/cityjson?ie=utf-8'
|
url = 'http://www.example.com/api/getIpAddress';
|
||||||
str = httpGet(url)
|
str = httpGet(url)
|
||||||
ipaddress = re.search('\d+.\d+.\d+.\d+',str).group(0)
|
|
||||||
writeFile(filename,ipaddress)
|
writeFile(filename,ipaddress)
|
||||||
|
|
||||||
ipaddress = re.search('\d+.\d+.\d+.\d+',ipaddress).group(0);
|
ipaddress = re.search('\d+.\d+.\d+.\d+',ipaddress).group(0);
|
||||||
return ipaddress
|
return ipaddress
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
url = 'http://www.example.com/api/getIpAddress';
|
url = 'https://www.bt.cn/Api/getIpAddress';
|
||||||
str = httpGet(url)
|
str = httpGet(url)
|
||||||
writeFile(filename,ipaddress)
|
writeFile(filename,ipaddress)
|
||||||
return str
|
return str
|
||||||
@ -486,7 +485,7 @@ def get_url(timeout = 0.5):
|
|||||||
import json
|
import json
|
||||||
try:
|
try:
|
||||||
#
|
#
|
||||||
node_list = [{"protocol":"http://","address":"dg1.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"dg2.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"node.aapanel.com","port":"80","ping":500},{"protocol":"http://","address":"download.bt.cn","port":"80","ping":500}]
|
node_list = [{"protocol":"http://","address":"dg2.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"dg1.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"download.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"hk1-node.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"na1-node.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"jp1-node.bt.cn","port":"80","ping":500}]
|
||||||
|
|
||||||
mnode1 = []
|
mnode1 = []
|
||||||
mnode2 = []
|
mnode2 = []
|
||||||
@ -511,11 +510,11 @@ def get_url(timeout = 0.5):
|
|||||||
else: #终选中等延迟,中等带宽
|
else: #终选中等延迟,中等带宽
|
||||||
mnode = sorted(mnode2,key= lambda x:x['ping'],reverse=False)
|
mnode = sorted(mnode2,key= lambda x:x['ping'],reverse=False)
|
||||||
|
|
||||||
if not mnode: return 'http://download.bt.cn'
|
if not mnode: return 'https://download.bt.cn'
|
||||||
#return mnode[0]['protocol'] + mnode[0]['address'] + ':' + mnode[0]['port']
|
#return mnode[0]['protocol'] + mnode[0]['address'] + ':' + mnode[0]['port']
|
||||||
return "https://" + mnode[0]['address']
|
return "https://" + mnode[0]['address']
|
||||||
except:
|
except:
|
||||||
return 'http://download.bt.cn'
|
return 'https://download.bt.cn'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -984,7 +983,7 @@ def add_panel_services(num = 0):
|
|||||||
ret = ExecShell("\"{}\" {}/panel/runserver.py --startup auto install".format(py_path,setupPath))
|
ret = ExecShell("\"{}\" {}/panel/runserver.py --startup auto install".format(py_path,setupPath))
|
||||||
|
|
||||||
delete_server('btTask')
|
delete_server('btTask')
|
||||||
ExecShell("\"{}\" {}/panel/task.py --startup auto install".format(py_path,setupPath))
|
ret1 = ExecShell("\"{}\" {}/panel/task.py --startup auto install".format(py_path,setupPath))
|
||||||
|
|
||||||
if get_server_status('btPanel') < 0 or get_server_status('btTask') < 0:
|
if get_server_status('btPanel') < 0 or get_server_status('btTask') < 0:
|
||||||
if num <= 0 :
|
if num <= 0 :
|
||||||
@ -994,7 +993,7 @@ def add_panel_services(num = 0):
|
|||||||
|
|
||||||
add_panel_services(1)
|
add_panel_services(1)
|
||||||
else:
|
else:
|
||||||
writeFile(error_path,ret[0] + ret[1])
|
writeFile(error_path,ret[0] + ret[1] + ret1[0] + ret1[1])
|
||||||
else:
|
else:
|
||||||
os.system('sc failure btPanel reset=1800 actions=restart/60000/restart/120000/restart/30000')
|
os.system('sc failure btPanel reset=1800 actions=restart/60000/restart/120000/restart/30000')
|
||||||
os.system('sc failure btTask reset=1800 actions=restart/60000/restart/120000/restart/30000')
|
os.system('sc failure btTask reset=1800 actions=restart/60000/restart/120000/restart/30000')
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user