Compare commits

...

2 Commits

Author SHA1 Message Date
flucout
fdbbd304cb fix 2025-01-19 13:31:36 +08:00
flucout
53a484093e update 2025-01-19 13:27:28 +08:00
17 changed files with 381 additions and 83 deletions

View File

@ -5,7 +5,7 @@
网站后台管理可一键同步宝塔官方的插件列表与增量更新插件包还有云端使用记录、IP黑白名单、操作日志、定时任务等功能。
本项目自带 宝塔Linux面板、宝塔Windows面板、aaPanel面板、宝塔云监控 的最新版安装包和更新包已修改适配此第三方云端并且全开源无so等加密文件。
本项目自带 **宝塔Linux面板****宝塔Windows面板****aaPanel面板****宝塔云监控** 的最新版安装包和更新包,已修改适配此第三方云端,并且全开源,无.so等加密文件。
觉得该项目不错的可以给个Star~

View File

@ -147,6 +147,10 @@ class CleanViteJs extends Command
$file = preg_replace('!\w+\(\(\(\)=>"input"===\w+\.\w+\.type\)\)!', '!1', $file);
$file = preg_replace('!\w+\(\(function\(\)\{return"calc"===\w+\.\w+\.type\}\)\)!', '!1', $file);
$file = preg_replace('!\w+\(\(function\(\)\{return"input"===\w+\.\w+\.type\}\)\)!', '!1', $file);
$code = $this->getExtendCode($file, '"自动部署"', 2);
if($code){
$file = str_replace($code, '', $file);
}
$flag = true;
}
@ -194,6 +198,25 @@ class CleanViteJs extends Command
$flag = true;
}
if(strpos($file, '"商用SSL"')!==false){ //ssl
$code = $this->getExtendFunction($file, '"商用SSL"', '{', '}');
$file = str_replace($code, '', $file);
$code = $this->getExtendFunction($file, '"宝塔证书"', '{', '}');
$file = str_replace($code, '', $file);
$code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']');
if($code){
$file = str_replace($code, '[]', $file);
}
$code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']');
if($code){
$file = str_replace($code, '[]', $file);
}
}
if(strpos($file, '"SSL-CERTIFICATE-STORE"')!==false){ //ssl
$file = str_replace('("ssl")', '("encrypt")', $file);
$flag = true;
}
if(strpos($file, '如果您希望添加其它Docker应用')!==false){
$code = $this->getExtendCode($file, '如果您希望添加其它Docker应用', 1, '[', ']');
$code = $this->getExtendFunction($file, $code);
@ -217,7 +240,12 @@ class CleanViteJs extends Command
for($i=0;$i<5;$i++){
$code = $this->getExtendCode($file, ',"需求反馈"', 1, '[', ']');
if($code){
if(strpos($code, 'svgtofont-desired')){
$file = str_replace($code, '[]', $file);
}else{
$code = $this->getExtendFunction($code, ',"需求反馈"');
$file = str_replace($code, '', $file);
}
$flag = true;
}
}
@ -231,6 +259,11 @@ class CleanViteJs extends Command
$file = str_replace($code, '[]', $file);
$flag = true;
}
$code = $this->getExtendFunction($file, '," 需求反馈 "');
if($code){
$file = str_replace($code, '', $file);
$flag = true;
}
if(strpos('暂无搜索结果,<span class="text-primary cursor-pointer NpsDialog">提交需求反馈</span>', $file)!==false){
$file = str_replace('暂无搜索结果,<span class="text-primary cursor-pointer NpsDialog">提交需求反馈</span>', '暂无搜索结果', $file);

View File

@ -31,6 +31,9 @@ class UpdateAll extends Command
if(!config_get('wbt_type') && config_get('wbt_url') || config_get('wbt_type')==1 && config_get('wbt_surl')){
$this->process_plugins($input, $output, 'Windows');
}
if(!config_get('enbt_type') && config_get('enbt_url') || config_get('enbt_type')==1 && config_get('enbt_surl')){
$this->process_plugins($input, $output, 'en');
}
config_set('runtime', date('Y-m-d H:i:s'));
}
@ -43,7 +46,13 @@ class UpdateAll extends Command
$count = 0;
$type = intval(config_get($os=='Windows'?'updateall_type_win':'updateall_type'));
if($os=='Windows'){
$type = intval(config_get('updateall_type_win'));
}elseif($os=='en'){
$type = intval(config_get('updateall_type_en'));
}else{
$type = intval(config_get('updateall_type'));
}
$json_arr = Plugins::get_plugin_list($os);
//循环下载缺少的插件

View File

@ -193,6 +193,22 @@ class Api extends BaseController
return json($data);
}
public function get_panel_version_v2(){
$version = config_get('new_version');
$down_url = request()->root(true).'/install/update/LinuxPanel-'.$version.'.zip';
$data = [
'OfficialVersion' => [
'version' => $version,
'downUrl' => $down_url,
'updateMsg' => config_get('update_msg'),
'uptime' => config_get('update_date'),
],
'OfficialVersionLatest' => [],
'AccountVersion' => [],
];
return json($data);
}
//安装统计
public function setup_count(){
return 'ok';
@ -486,6 +502,10 @@ class Api extends BaseController
return json(['err_no'=>0, 'success'=>true, 'res'=>'Success', 'nonce'=>time()]);
}
public function get_user_give_away(){
return json(['no_exceed_limit'=>false, 'user_give'=>true]);
}
//获取所有蜘蛛IP列表
public function btwaf_getspiders(){
try{
@ -504,6 +524,29 @@ class Api extends BaseController
return json($result);
}
//检查是否国内IP
public function check_cnip(){
$clientip = bindec(decbin(ip2long($this->clientip)));
$json_file = app()->getBasePath().'lib/cn.json';
$arr = json_decode(file_get_contents($json_file), true);
if(!$arr) return 'False';
foreach($arr as $ip_arr){
if($clientip >= $ip_arr[0] && $clientip <= $ip_arr[1]){
return 'True';
}
}
return 'False';
}
//邮件配额
public function email_user_surplus(){
$data = [
'free' => ['surplus' => '120000', 'total' => '120000', 'used' => '0'],
'period' => ['surplus' => '2000000', 'total' => '2000000', 'used' => '0'],
];
return json(['success'=>true, 'msg'=>'获取成功', 'res'=>$data]);
}
//检查黑白名单
private function checklist(){
if(config_get('whitelist') == 1){

View File

@ -57,6 +57,7 @@ class Plugins
$data['beta'] = 0;
$data['uid'] = 1;
$data['skey'] = '';
$data['pro'] = -1;
$data['ltd'] = strtotime('+10 year');
}
foreach($data['list'] as &$plugin){

1
app/lib/cn.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
#!/bin/bash
Linux_Version="9.3.0"
Windows_Version="8.2.1"
Linux_Version="9.4.0"
Windows_Version="8.2.2"
Aapanel_Version="7.0.13"
Btm_Version="2.3.0"

View File

@ -12,12 +12,12 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''),
('whitelist', '0'),
('download_page', '1'),
('new_version', '9.3.0'),
('new_version', '9.4.0'),
('update_msg', '暂无更新日志'),
('update_date', '2024-12-06'),
('new_version_win', '8.2.1'),
('update_date', '2025-01-09'),
('new_version_win', '8.2.2'),
('update_msg_win', '暂无更新日志'),
('update_date_win', '2024-12-06'),
('update_date_win', '2024-12-30'),
('new_version_en', '7.0.13'),
('update_msg_en', '暂无更新日志'),
('update_date_en', '2024-11-17'),

View File

@ -4,7 +4,10 @@ export PATH
LANG=en_US.UTF-8
INSTALL_LOGFILE="/tmp/btpanel-install.log"
# exec > >(tee -a "$INSTALL_LOGFILE") 2>&1
if [ -f "$INSTALL_LOGFILE" ];then
rm -f $INSTALL_LOGFILE
fi
exec > >(tee -a "$INSTALL_LOGFILE") 2>&1
Btapi_Url='http://www.example.com'
Check_Api=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/SetupCount)
@ -23,6 +26,46 @@ if [ "${is64bit}" != '64' ];then
exit 1
fi
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
if [ "${Centos6Check}" ];then
echo "Centos6不支持安装宝塔面板请更换Centos7/8安装宝塔面板"
exit 1
fi
UbuntuCheck=$(cat /etc/issue|grep Ubuntu|awk '{print $2}'|cut -f 1 -d '.')
if [ "${UbuntuCheck}" ] && [ "${UbuntuCheck}" -lt "16" ];then
echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板建议更换Ubuntu18/20安装宝塔面板"
exit 1
fi
HOSTNAME_CHECK=$(cat /etc/hostname)
if [ -z "${HOSTNAME_CHECK}" ];then
echo "当前主机名hostname为空无法安装宝塔面板请咨询服务器运营商设置好hostname后再重新安装"
exit 1
fi
UBUNTU_NO_LTS=$(cat /etc/issue|grep Ubuntu|grep -E "19|21|23|25")
if [ "${UBUNTU_NO_LTS}" ];then
echo "当前您使用的非Ubuntu-lts版本无法进行宝塔面板的安装"
echo "请使用Ubuntu-20/20/22/24进行安装宝塔面板"
exit 1
fi
DEBIAN_9_C=$(cat /etc/issue|grep Debian|grep -E "8 |9 ")
if [ "${DEBIAN_9_C}" ];then
echo "当前您使用的Debian-8/9官方已经停止支持、无法进行宝塔面板的安装"
echo "请使用Debian-11/12进行安装宝塔面板"
exit 1
fi
cd ~
setup_path="/www"
python_bin=$setup_path/server/panel/pyenv/bin/python
cpu_cpunt=$(cat /proc/cpuinfo|grep processor|wc -l)
panelPort=$(expr $RANDOM % 55535 + 10000)
# if [ "$1" ];then
# IDC_CODE=$1
# fi
Ready_Check(){
WWW_DISK_SPACE=$(df |grep /www|awk '{print $4}')
ROOT_DISK_SPACE=$(df |grep /$|awk '{print $4}')
@ -60,47 +103,6 @@ Ready_Check(){
fi
}
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
if [ "${Centos6Check}" ];then
echo "Centos6不支持安装宝塔面板请更换Centos7/8安装宝塔面板"
exit 1
fi
UbuntuCheck=$(cat /etc/issue|grep Ubuntu|awk '{print $2}'|cut -f 1 -d '.')
if [ "${UbuntuCheck}" ] && [ "${UbuntuCheck}" -lt "16" ];then
echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板建议更换Ubuntu22/24安装宝塔面板"
exit 1
fi
HOSTNAME_CHECK=$(cat /etc/hostname)
if [ -z "${HOSTNAME_CHECK}" ];then
echo "当前主机名hostname为空无法安装宝塔面板请咨询服务器运营商设置好hostname后再重新安装"
exit 1
fi
UBUNTU_NO_LTS=$(cat /etc/issue|grep Ubuntu|grep -E "19|21|23|25")
if [ "${UBUNTU_NO_LTS}" ];then
echo "当前您使用的非Ubuntu-lts版本无法进行宝塔面板的安装"
echo "请使用Ubuntu-20/20/22/24进行安装宝塔面板"
exit 1
fi
DEBIAN_9_C=$(cat /etc/issue|grep Debian|grep -E "8 |9 ")
if [ "${DEBIAN_9_C}" ];then
echo "当前您使用的Debian-8/9官方已经停止支持、无法进行宝塔面板的安装"
echo "请使用Debian-11/12进行安装宝塔面板"
exit 1
fi
cd ~
setup_path="/www"
python_bin=$setup_path/server/panel/pyenv/bin/python
cpu_cpunt=$(cat /proc/cpuinfo|grep processor|wc -l)
panelPort=$(expr $RANDOM % 55535 + 10000)
# if [ "$1" ];then
# IDC_CODE=$1
# fi
GetSysInfo(){
if [ -s "/etc/redhat-release" ];then
SYS_VERSION=$(cat /etc/redhat-release)
@ -126,6 +128,28 @@ GetSysInfo(){
echo -e "如是新安装系统服务器建议更换至Debian-12/Ubuntu-22/Centos-9系统安装宝塔面板"
echo -e "============================================"
fi
if [ -f "/usr/sbin/setstatus" ] || [ -f "/usr/sbin/setstatus" ];then
echo -e "=================================================="
echo -e " 检测到为麒麟系统,可能默认开启安全功能导致安装失败"
echo -e " 请执行以下命令关闭安全加固后,再重新安装宝塔面板看是否正常"
echo -e " 命令sudo setstatus softmode -p"
echo -e "=================================================="
fi
SYS_SSL_LIBS=$(pkg-config --list-all | grep -q libssl)
if [ -z "$SYS_SSL_LIBS" ];then
echo "检测到缺少系统ssl相关依赖可执行下面命令安装依赖后再重新安装宝塔看是否正常"
echo "执行前请确保系统源正常"
if [ -f "/usr/bin/yum" ];then
echo "安装依赖命令: yum install openssl-devel -y"
elif [ -f "/usr/bin/apt-get" ];then
echo "安装依赖命令: apt-get install libssl-dev -y"
fi
rm -rf /www/server/panel/pyenv
echo -e "=================================================="
fi
}
Red_Error(){
echo '=================================================';
@ -175,11 +199,38 @@ Set_Ssl(){
fi
}
Add_lib_Install(){
Get_Versions
if [ "${os_type}" == "el" ] && [ "${os_version}" == "7" ];then
if [ -f "/etc/os-release" ];then
. /etc/os-release
OS_V=${VERSION_ID%%.*}
if [ "${ID}" == "debian" ] && [[ "${OS_V}" =~ ^(11|12)$ ]];then
OS_NAME=${ID}
elif [ "${ID}" == "ubuntu" ] && [[ "${OS_V}" =~ ^(22|24)$ ]];then
OS_NAME=${ID}
elif [ "${ID}" == "centos" ] && [[ "${OS_V}" =~ ^(7)$ ]];then
OS_NAME="el"
elif [ "${ID}" == "opencloudos" ] && [[ "${OS_V}" =~ ^(9)$ ]];then
OS_NAME=${ID}
elif [ "${ID}" == "tencentos" ] && [[ "${OS_V}" =~ ^(4)$ ]];then
OS_NAME=${ID}
elif [ "${ID}" == "hce" ] && [[ "${OS_V}" =~ ^(2)$ ]];then
OS_NAME=${ID}
elif { [ "${ID}" == "almalinux" ] || [ "${ID}" == "centos" ] || [ "${ID}" == "rocky" ]; } && [[ "${OS_V}" =~ ^(9)$ ]]; then
OS_NAME="el"
fi
fi
X86_CHECK=$(uname -m|grep x86_64)
if [ "${OS_NAME}" ] && [ "${X86_CHECK}" ];then
if [ "${PM}" = "yum" ]; then
mtype="1"
elif [ "${PM}" = "apt-get" ]; then
mtype="4"
fi
cd /www/server/panel/class
#btpython -c "import panelPlugin; plugin = panelPlugin.panelPlugin(); plugin.check_install_lib('1')"
#echo "True" > /tmp/panelTask.pl
btpython -c "import panelPlugin; plugin = panelPlugin.panelPlugin(); plugin.check_install_lib('${mtype}')"
echo "True" > /tmp/panelTask.pl
echo "True" > /www/server/panel/install/ins_lib.pl
fi
}
Get_Pack_Manager(){
@ -189,6 +240,67 @@ Get_Pack_Manager(){
PM="apt-get"
fi
}
Set_Repo_Url(){
if [ "${PM}"="apt-get" ];then
ALI_CLOUD_CHECK=$(grep Alibaba /etc/motd)
Tencent_Cloud=$(cat /etc/hostname |grep -E VM-[0-9]+-[0-9]+)
if [ "${ALI_CLOUD_CHECK}" ] || [ "${Tencent_Cloud}" ];then
return
fi
CN_CHECK=$(curl -sS --connect-timeout 10 -m 10 https://api.bt.cn/api/isCN)
if [ "${CN_CHECK}" == "True" ];then
SOURCE_URL_CHECK=$(grep -E 'security.ubuntu.com|archive.ubuntu.com|security.debian.org|deb.debian.org' /etc/apt/sources.list)
# if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ];then
# SOURCE_URL_CHECK=$(grep -E 'security.ubuntu.com|archive.ubuntu.com|security.debian.org|deb.debian.org' /etc/apt/sources.list.d/ubuntu.sources)
# fi
fi
#GET_SOURCES_URL=$(cat /etc/apt/sources.list|grep ^deb|head -n 1|awk -F[/:] '{print $4}')
GET_SOURCES_URL=$(cat /etc/apt/sources.list|grep ^deb|head -n 1|sed -E 's|^[^ ]+ https?://([^/]+).*|\1|')
# if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ];then
# GET_SOURCES_URL=$(cat /etc/apt/sources.list.d/ubuntu.sources|grep URIs:|head -n 1|sed -E 's|^[^ ]+ https?://([^/]+).*|\1|')
# fi
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${GET_SOURCES_URL} -o /dev/null)
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $1}')
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $2 * 1000}'|cut -d '.' -f 1)
if { [ "${NODE_STATUS}" != "200" ] && [ "${NODE_STATUS}" != "301" ]; } || [ "${TIME_TOTAL}" -ge "150" ] || [ "${SOURCE_URL_CHECK}" ]; then
\cp -rpa /etc/apt/sources.list /etc/apt/sources.list.btbackup
apt_lists=(mirrors.cloud.tencent.com mirrors.163.com repo.huaweicloud.com mirrors.tuna.tsinghua.edu.cn mirrors.aliyun.com mirrors.ustc.edu.cn )
for list in ${apt_lists[@]};
do
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${list} -o /dev/null)
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $1}')
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $2 * 1000}'|cut -d '.' -f 1)
if [ "${NODE_STATUS}" == "200" ] || [ "${NODE_STATUS}" == "301" ];then
if [ "${TIME_TOTAL}" -le "150" ];then
if [ -f "/etc/apt/sources.list" ];then
sed -i "s/${GET_SOURCES_URL}/${list}/g" /etc/apt/sources.list
sed -i "s/cn.security.ubuntu.com/${list}/g" /etc/apt/sources.list
sed -i "s/cn.archive.ubuntu.com/${list}/g" /etc/apt/sources.list
sed -i "s/security.ubuntu.com/${list}/g" /etc/apt/sources.list
sed -i "s/archive.ubuntu.com/${list}/g" /etc/apt/sources.list
sed -i "s/security.debian.org/${list}/g" /etc/apt/sources.list
sed -i "s/deb.debian.org/${list}/g" /etc/apt/sources.list
fi
# if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ];then
# \cp -rpa /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
# sed -i "s/${GET_SOURCES_URL}/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# sed -i "s/cn.security.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# sed -i "s/cn.archive.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# sed -i "s/security.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# sed -i "s/archive.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# sed -i "s/security.debian.org/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# sed -i "s/deb.debian.org/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
# fi
break;
fi
fi
done
fi
fi
}
Auto_Swap()
{
swap=$(free |grep Swap|awk '{print $2}')
@ -278,14 +390,7 @@ Set_Centos7_Repo(){
if [ "$?" != "0" ] ;then
sed -i "s/vault.epel.cloud/mirrors.cloud.tencent.com/g" /etc/yum.repos.d/*.repo
fi
}
# Set_Centos7_Repo(){
# if [ -z "${download_Url}" ];then
# download_Url="http://download.bt.cn"
# fi
# curl -Ss --connect-timeout 3 -m 60 ${download_Url}/install/vault-repo.sh|bash
# }
Set_Centos8_Repo(){
HUAWEI_CHECK=$(cat /etc/motd |grep "Huawei Cloud")
if [ "${HUAWEI_CHECK}" ] && [ "${is64bit}" == "64" ];then
@ -324,12 +429,16 @@ Set_Centos8_Repo(){
rm -f /etc/yum.repos.d/*.repo
tar -xvzf el8repo.tar.gz -C /etc/yum.repos.d/
fi
yum install unzip -y
yum install unzip tar -y
if [ "$?" != "0" ] ;then
sed -i "s/vault.epel.cloud/mirrors.cloud.tencent.com/g" /etc/yum.repos.d/*.repo
fi
}
get_node_url(){
if [ "${PM}" = "yum" ]; then
yum install wget -y
fi
if [ ! -f /bin/curl ];then
if [ "${PM}" = "yum" ]; then
yum install curl -y
@ -506,7 +615,8 @@ Install_RPM_Pack(){
Install_Deb_Pack(){
ln -sf bash /bin/sh
UBUNTU_22=$(cat /etc/issue|grep "Ubuntu 22")
if [ "${UBUNTU_22}" ];then
UBUNTU_24=$(cat /etc/issue|grep "Ubuntu 24")
if [ "${UBUNTU_22}" ] || [ "${UBUNTU_24}" ];then
apt-get remove needrestart -y
fi
ALIYUN_CHECK=$(cat /etc/motd|grep "Alibaba Cloud ")
@ -514,6 +624,13 @@ Install_Deb_Pack(){
apt-get remove libicu70 -y
fi
apt-get update -y
FNOS_CHECK=$(cat /etc/issue|grep fnOS)
if [ "${FNOS_CHECK}" ];then
apt-get install libc6 --allow-change-held-packages -y
apt-get install libc6-dev --allow-change-held-packages -y
fi
apt-get install bash -y
if [ -f "/usr/bin/bash" ];then
ln -sf /usr/bin/bash /bin/sh
@ -738,10 +855,10 @@ Install_Python_Lib(){
echo "==============================================="
if [ "${os_version}" != "" ];then
pyenv_file="/www/pyenv.tar.gz"
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 15
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 20
if [ "$?" != "0" ];then
get_node_url $download_Url
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 15
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 20
fi
tmp_size=$(du -b $pyenv_file|awk '{print $1}')
if [ $tmp_size -lt 703460 ];then
@ -803,6 +920,7 @@ Install_Python_Lib(){
$pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt
wget -O pip-packs.txt $download_Url/install/pyenv/pip-packs.txt
echo "正在后台安装pip依赖请稍等.........."
PIP_PACKS=$(cat pip-packs.txt)
for P_PACK in ${PIP_PACKS};
do
@ -882,9 +1000,29 @@ Install_Bt(){
yum install unzip -y
elif [ "${PM}" = "apt-get" ]; then
apt-get update
apt-get install unzip -y 2>&1|tee /tmp/apt_install_log.log
UNZIP_CHECK=$(which unzip)
if [ "$?" != "0" ];then
RECONFIGURE_CHECK=$(grep "dpkg --configure -a" /tmp/apt_install_log.log)
if [ "${RECONFIGURE_CHECK}" ];then
dpkg --configure -a
fi
APT_LOCK_CHECH=$(grep "/var/lib/dpkg/lock" /tmp/apt_install_log.log)
if [ "${APT_LOCK_CHECH}" ];then
pkill dpkg
pkill apt-get
pkill apt
[ -e /var/lib/dpkg/lock-frontend ] && rm -f /var/lib/dpkg/lock-frontend
[ -e /var/lib/dpkg/lock ] && rm -f /var/lib/dpkg/lock
[ -e /var/lib/apt/lists/lock ] && rm -f /var/lib/apt/lists/lock
[ -e /var/cache/apt/archives/lock ] && rm -f /var/cache/apt/archives/lock
dpkg --configure -a
fi
sleep 5
apt-get install unzip -y
fi
fi
fi
unzip -o panel.zip -d ${setup_path}/server/ > /dev/null
@ -1023,6 +1161,7 @@ Set_Bt_Panel(){
touch t.pl
ls -al python3.7 python
lsattr python3.7 python
btpython /www/server/panel/BT-Panel
Red_Error "ERROR: The BT-Panel service startup failed." "ERROR: 宝塔启动失败"
fi
@ -1110,6 +1249,13 @@ Get_Ip_Address(){
fi
fi
CN_CHECK=$(curl -sS --connect-timeout 10 -m 10 http://www.example.com/api/isCN)
if [ "${CN_CHECK}" == "True" ];then
echo "True" > /www/server/panel/data/domestic_ip.pl
else
echo "True" > /www/server/panel/data/foreign_ip.pl
fi
ipv4Check=$($python_bin -c "import re; print(re.match('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$','${getIpAddress}'))")
if [ "${ipv4Check}" == "None" ];then
ipv6Address=$(echo ${getIpAddress}|tr -d "[]")
@ -1144,6 +1290,7 @@ Install_Main(){
Lock_Clear
System_Check
Get_Pack_Manager
Set_Repo_Url
get_node_url
MEM_TOTAL=$(free -g|grep Mem|awk '{print $2}')
@ -1182,6 +1329,7 @@ echo "
+----------------------------------------------------------------------
"
while [ ${#} -gt 0 ]; do
case $1 in
-u|--user)
@ -1245,6 +1393,7 @@ if [ -f "/www/server/panel/BT-Panel" ];then
fi
fi
ARCH_LINUX=$(cat /etc/os-release |grep "Arch Linux")
if [ "${ARCH_LINUX}" ] && [ -f "/usr/bin/pacman" ];then
pacman -Sy
@ -1265,21 +1414,18 @@ echo -e "=================================================================="
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
echo -e "========================面板账户登录信息=========================="
echo -e ""
echo -e " 【云服务器】请在安全组放行 $panelPort 端口"
echo -e " 外网面板地址: ${HTTP_S}://${getIpAddress}:${panelPort}${auth_path}"
echo -e " 内网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
echo -e " username: $username"
echo -e " password: $password"
echo -e " "
echo -e "=========================打开面板前请看==========================="
echo -e ""
echo -e " 【云服务器】请在安全组放行 $panelPort 端口"
echo -e " 因默认启用自签证书https加密访问浏览器将提示不安全"
echo -e " 点击【高级】-【继续访问】或【接受风险并继续】访问"
echo -e " 教程https://www.bt.cn/bbs/thread-117246-1-1.html"
echo -e ""
echo -e "=================================================================="
endTime=`date +%s`
((outTime=($endTime-$startTime)/60))
if [ "${outTime}" -le "5" ];then
echo ${download_Url} > /www/server/panel/install/d_node.pl
fi
if [ "${outTime}" == "0" ];then
((outTime=($endTime-$startTime)))
echo -e "Time consumed:\033[32m $outTime \033[0mseconds!"

View File

@ -14,9 +14,31 @@ if [ "${NODE_FILE_CHECK}" ];then
rm -f /www/server/panel/data/node.json
fi
if [ -f "/www/server/panel/install/d_node.pl" ];then
LOCAL_DATE=$(date +%Y-%m-%d)
FILE_DATE=$(stat /www/server/panel/install/d_node.pl|grep Change|awk '{print $2}')
if [ "${LOCAL_DATE}" != "${FILE_DATE}" ];then
rm -f /www/server/panel/install/d_node.pl
else
test_url=$(cat /www/server/panel/install/d_node.pl)
HTTP_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${test_url}/net_test|xargs|awk '{print $2}')
if [ "${HTTP_CHECK}" == "200" ];then
NODE_URL=$test_url
fi
fi
fi
get_node_url(){
nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn https://cf1-node.aapanel.com);
if [ -f "/www/server/panel/data/domestic_ip.pl" ];then
nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn);
fi
if [ -f "/www/server/panel/data/foreign_ip.pl" ];then
nodes=(https://cf1-node.aapanel.com https://dg2.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn);
fi
if [ "$1" ];then
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
fi
@ -29,7 +51,11 @@ get_node_url(){
touch $tmp_file2
for node in ${nodes[@]};
do
if [ "${node}" == "https://cf1-node.aapanel.com" ];then
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/1net_test|xargs)
else
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/net_test|xargs)
fi
RES=$(echo ${NODE_CHECK}|awk '{print $1}')
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $2}')
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $3 * 1000 - 500 }'|cut -d '.' -f 1)
@ -113,7 +139,7 @@ send_check(){
chmod +x /etc/init.d/bt
p_path2=/www/server/panel/class/common.py
p_version=$(cat $p_path2|grep "version = "|awk '{print $3}'|tr -cd [0-9.])
curl -sS --connect-timeout 3 -m 60 https://www.bt.cn/api/panel/notpro?version=$p_version
curl -sS --connect-timeout 3 -m 60 http://www.example.com/api/panel/notpro?version=$p_version
NODE_URL=""
exit 0;
}

Binary file not shown.

View File

@ -103,7 +103,7 @@ fi
setup_path=/www
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ -z "$VERSION_CHECK" ];then
version='9.3.0'
version='9.4.0'
fi
armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then

View File

@ -15,6 +15,7 @@ Route::post('/panel/get_unbinding', 'api/return_success');
Route::post('/bt_cert', 'api/bt_cert');
Route::post('/Auth/GetAuthToken', 'api/get_auth_token');
Route::post('/Auth/GetBindCode', 'api/return_error');
Route::post('/auth/GetUserGiveAway', 'api/get_user_give_away');
Route::any('/bt_monitor/update_history', 'api/btm_update_history');
Route::any('/bt_monitor/latest_version', 'api/btm_latest_version');
Route::any('/bt_waf/get_malicious_ip', 'api/get_ssl_list');
@ -40,6 +41,7 @@ Route::group('api', function () {
Route::get('/panel/get_version', 'api/get_version');
Route::get('/wpanel/get_version', 'api/get_version_win');
Route::get('/panel/get_panel_version', 'api/get_panel_version');
Route::any('/panel/get_panel_version_v2', 'api/get_panel_version_v2');
Route::get('/SetupCount', 'api/setup_count');
Route::any('/panel/updateLinux', 'api/check_update');
Route::any('/wpanel/updateWindows', 'api/check_update_win');
@ -57,6 +59,7 @@ Route::group('api', function () {
Route::post('/Cert/get_order_list', 'api/return_empty_array');
Route::post('/Cert/get_product_list', 'api/return_success');
Route::get('/Pluginother/get_file', 'api/download_plugin_other');
Route::get('/isCN', 'api/check_cnip');
Route::post('/Pluginother/create_order', 'api/return_success');
Route::post('/Pluginother/renew_order', 'api/return_success');
@ -113,6 +116,9 @@ Route::group('api', function () {
Route::post('/v2/common_v1_authorization/get_pricing', 'api/return_error2');
Route::post('/v2/common_v2_authorization/get_pricing', 'api/return_error2');
Route::post('/v2/synchron', 'api/return_error2');
Route::post('/v2/product/email/user_surplus', 'api/email_user_surplus');
Route::post('/v2/product/email', 'api/return_error2');
Route::any('/bt_waf/getSpiders', 'api/btwaf_getspiders');
Route::post('/bt_waf/addSpider', 'api/return_empty');

View File

@ -11,7 +11,7 @@
#| 插件和模块加载器
#+--------------------------------------------------------------------
import public,os,sys,json
import public,os,sys,json,hashlib
def plugin_run(plugin_name,def_name,args):
'''
@ -186,10 +186,37 @@ def get_plugin_list(upgrade_force = False):
raise Exception(plugin_list)
else:
raise Exception('云端插件列表获取失败')
public.writeFile(plugin_list_file,json.dumps(plugin_list))
content = json.dumps(plugin_list)
public.writeFile(plugin_list_file,content)
plugin_bin_file = os.path.join(data_path,'plugin_bin.pl')
encode_content = __encode_plugin_list(content)
if encode_content:
public.writeFile(plugin_bin_file,encode_content)
return plugin_list
def __encode_plugin_list(content):
try:
userInfo = public.get_user_info()
if not userInfo or 'serverid' not in userInfo: return None
block_size = 51200
uid = str(userInfo['uid'])
server_id = userInfo['serverid']
key = server_id[10:26] + uid + server_id
key = hashlib.md5(key.encode()).hexdigest()
iv = key + server_id
iv = hashlib.md5(iv.encode()).hexdigest()
key = key[8:24]
iv = iv[8:24]
blocks = [content[i:i + block_size] for i in range(0, len(content), block_size)]
encrypted_content = ''
for block in blocks:
encrypted_content += __aes_encrypt(block, key, iv) + '\n'
return encrypted_content
except:
pass
return None
def start_total():
'''

View File

@ -58,7 +58,7 @@
在login_send_body方法内free_login_area(login_ip=server_ip_area的server_ip_area改成login_ip
- class/panelPlugin.py 文件删除public.total_keyword(get.query)这一行
- class/panelPlugin.py 文件
__set_pyenv方法内temp_file = public.readFile(filename)这行代码下面加上
@ -76,6 +76,10 @@
plugin_bin.pl 改成 plugin_list.json
删除 public.total_keyword(get.query)
删除 public.run_thread(self.get_cloud_list_status, args=(get,))
删除 public.run_thread(self.is_verify_unbinding, args=(get,))
- class/plugin_deployment.py 文件__setup_php_environment方法和GetJarPath方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
@ -97,8 +101,8 @@
- install/install_soft.sh 在. 执行之前加入以下代码
```shell
sed -i "s/http:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
sed -i "s/https:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
sed -i "s/http:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" $name.sh
sed -i "s/https:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" $name.sh
```
- install/public.sh 用官网最新版的[public.sh](http://download.bt.cn/install/public.sh)替换并去除最下面bt_check一行
@ -113,6 +117,8 @@
check_node_status()
self.upload_send_num()
- script/site_task.py 删除flush_ssh_log()
- [可选]去除各种计算题复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的\</body\>前面加入