Compare commits

..

2 Commits
1.4.1 ... 1.5.1

Author SHA1 Message Date
flucont
2c9f84c121 update 2022-12-17 17:25:27 +08:00
flucont
ab81af3b94 update 2022-12-03 14:14:52 +08:00
11 changed files with 227 additions and 161 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
Linux_Version="7.9.5" 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

View File

@@ -12,12 +12,12 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''), ('bt_key', ''),
('whitelist', '0'), ('whitelist', '0'),
('download_page', '1'), ('download_page', '1'),
('new_version', '7.9.5'), ('new_version', '7.9.6'),
('update_msg', '暂无更新日志'), ('update_msg', '暂无更新日志'),
('update_date', '2022-11-02'), ('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');

View File

@@ -54,6 +54,27 @@ GetSysInfo(){
echo -e ${SYS_VERSION} echo -e ${SYS_VERSION}
echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO} echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO}
echo -e ${SYS_INFO} echo -e ${SYS_INFO}
if [ -z "${os_version}" ];then
echo -e "============================================"
echo -e "检测到为非常用系统安装,建议更换至Centos-7或Debian-10+或Ubuntu-20+系统安装宝塔面板"
echo -e "详情请查看系统兼容表https://docs.qq.com/sheet/DUm54VUtyTVNlc21H?tab=BB08J2"
echo -e "特殊情况可通过以下联系方式寻求安装协助情况"
fi
is64bit=$(getconf LONG_BIT)
if [ "${is64bit}" == '32' ];then
echo -e "宝塔面板不支持32位系统进行安装请使用64位系统/服务器架构进行安装宝塔"
exit 1
fi
S390X_CHECK=$(uname -a|grep s390x)
if [ "${S390X_CHECK}" ];then
echo -e "宝塔面板不支持s390x架构进行安装请使用64位系统/服务器架构进行安装宝塔"
exit 1
fi
echo -e "============================================"
echo -e "请截图以上报错信息发帖至论坛www.bt.cn/bbs求助" echo -e "请截图以上报错信息发帖至论坛www.bt.cn/bbs求助"
} }
Red_Error(){ Red_Error(){
@@ -97,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"
@@ -183,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://125.90.93.52:5880 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);
if [ "$1" ];then if [ "$1" ];then
nodes=($(echo ${nodes[*]}|sed "s#${1}##")) nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
@@ -225,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
@@ -426,7 +474,7 @@ Install_Python_Lib(){
if [ "$is_package" = "" ];then if [ "$is_package" = "" ];then
wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip.txt -T 5 wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip.txt -T 5
$pyenv_path/pyenv/bin/pip install -U pip $pyenv_path/pyenv/bin/pip install -U pip
$pyenv_path/pyenv/bin/pip install -U setuptools $pyenv_path/pyenv/bin/pip install -U setuptools==65.5.0
$pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt $pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt
fi fi
source $pyenv_path/pyenv/bin/activate source $pyenv_path/pyenv/bin/activate
@@ -560,7 +608,7 @@ Install_Python_Lib(){
ln -sf $pyenv_path/pyenv/bin/python3.7 /usr/bin/btpython ln -sf $pyenv_path/pyenv/bin/python3.7 /usr/bin/btpython
chmod -R 700 $pyenv_path/pyenv/bin chmod -R 700 $pyenv_path/pyenv/bin
$pyenv_path/pyenv/bin/pip install -U pip $pyenv_path/pyenv/bin/pip install -U pip
$pyenv_path/pyenv/bin/pip install -U setuptools $pyenv_path/pyenv/bin/pip install -U setuptools==65.5.0
$pyenv_path/pyenv/bin/pip install -U wheel==0.34.2 $pyenv_path/pyenv/bin/pip install -U wheel==0.34.2
$pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt $pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt
source $pyenv_path/pyenv/bin/activate source $pyenv_path/pyenv/bin/activate
@@ -576,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
@@ -680,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
@@ -687,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
@@ -698,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
@@ -776,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
@@ -812,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
@@ -869,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`

View File

@@ -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.

View File

@@ -42,7 +42,7 @@ download_Url=$NODE_URL
setup_path=/www setup_path=/www
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version) version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ "$version" = '' ];then if [ "$version" = '' ];then
version='7.9.5' version='7.9.6'
fi fi
armCheck=$(uname -m|grep arm) armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then if [ "${armCheck}" ];then

View File

@@ -70,7 +70,7 @@ select_node(){
get_version(){ get_version(){
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version) version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ "$version" = '' ];then if [ "$version" = '' ];then
version='7.9.5' version='7.9.6'
fi fi
} }

View File

@@ -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')

View File

@@ -16,6 +16,8 @@
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/需排除clearModel.py、scanningModel.py、ipsModel.py - 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/需排除clearModel.py、scanningModel.py、ipsModel.py
- class/panelAuth.py 替换 http://www.bt.cn/api/ => http://www.example.com/api/
- 全局搜索替换 http://download.bt.cn/install/update6.sh => http://www.example.com/install/update6.sh - 全局搜索替换 http://download.bt.cn/install/update6.sh => http://www.example.com/install/update6.sh
- class/ajax.py 文件 \#是否执行升级程序 下面的 public.get_url() 改成 public.GetConfigValue('home') - class/ajax.py 文件 \#是否执行升级程序 下面的 public.get_url() 改成 public.GetConfigValue('home')
@@ -42,11 +44,13 @@
在 def get_improvement(): 这一行下面加上 return False 在 def get_improvement(): 这一行下面加上 return False
在free_login_area方法内get_free_ips_area替换成get_ips_area
- class/panelPlugin.py 文件download_icon方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn' - class/panelPlugin.py 文件download_icon方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
- class/panelPlugin.py 文件,删除public.total_keyword(get.query)这一行 删除public.total_keyword(get.query)这一行
- class/panelPlugin.py 文件,set_pyenv方法内temp_file = public.readFile(filename)这行代码下面加上 set_pyenv方法内temp_file = public.readFile(filename)这行代码下面加上
```python ```python
temp_file = temp_file.replace('wget -O Tpublic.sh', '#wget -O Tpublic.sh') temp_file = temp_file.replace('wget -O Tpublic.sh', '#wget -O Tpublic.sh')