mirror of
https://github.com/flucont/btcloud.git
synced 2025-10-14 06:10:24 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9d2d883668 | ||
![]() |
3d1f1b721a | ||
![]() |
fa9188b94d | ||
![]() |
2ddb4ff64c | ||
![]() |
963b675026 | ||
![]() |
5642ea3038 | ||
![]() |
2aff0d9e6d | ||
![]() |
0ca1c9d0e3 | ||
![]() |
c1681a9731 | ||
![]() |
911a567fde | ||
![]() |
b27349a416 | ||
![]() |
def82c88cb | ||
![]() |
04028103c1 | ||
![]() |
d18cd84e29 | ||
![]() |
268f76f9ba |
237
app/command/CleanViteJs.php
Normal file
237
app/command/CleanViteJs.php
Normal file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\input\Argument;
|
||||
use think\console\input\Option;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use app\lib\Plugins;
|
||||
|
||||
class CleanViteJs extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('cleanvitejs')
|
||||
->addArgument('dir', Argument::REQUIRED, '/BTPanel/static/vite/js/路径')
|
||||
->setDescription('处理宝塔面板vite/js文件');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$dir = trim($input->getArgument('dir'));
|
||||
if(!file_exists($dir)){
|
||||
$output->writeln('目录不存在');
|
||||
return;
|
||||
}
|
||||
//$this->handlefile($dir.'/DockerImages.js');
|
||||
$this->checkdir($dir);
|
||||
}
|
||||
|
||||
private function getExtendCode($content, $part, $n = 1, $startChar = '{', $endChar = '}'){
|
||||
if(!$part) return false;
|
||||
$length = strlen($content);
|
||||
$start = strpos($content, $part);
|
||||
if($start===false)return false;
|
||||
$end = $start+strlen($part);
|
||||
$start--;
|
||||
$c = 0;
|
||||
for($i=$start;$i>=0;$i--){
|
||||
if(substr($content,$i,1) == $startChar) $c++;
|
||||
if(substr($content,$i,1) == $endChar) $c--;
|
||||
if($c == $n){
|
||||
$start = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$c = 0;
|
||||
for($i=$end;$i<=$length;$i++){
|
||||
if(substr($content,$i,1) == $endChar) $c++;
|
||||
if(substr($content,$i,1) == $startChar) $c--;
|
||||
if($c == $n){
|
||||
$end = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return substr($content, $start, $end - $start + 1);
|
||||
}
|
||||
|
||||
private function getExtendFunction($content, $part, $startChar = '(', $endChar = ')'){
|
||||
$code = $this->getExtendCode($content, $part, 1, $startChar, $endChar);
|
||||
if(!$code) return false;
|
||||
$start = strpos($content, $code) - 1;
|
||||
$end = $start + strlen($code);
|
||||
for($i=$start;$i>=0;$i--){
|
||||
$char = substr($content,$i,1);
|
||||
if(!ctype_alpha($char)){
|
||||
$start = $i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(substr($content,$start-1,1) == ',') $start--;
|
||||
return substr($content, $start, $end - $start + 1);
|
||||
}
|
||||
|
||||
private function checkdir($basedir){
|
||||
if($dh=opendir($basedir)){
|
||||
while (($file=readdir($dh)) !== false){
|
||||
if($file != '.' && $file != '..'){
|
||||
if(!is_dir($basedir.'/'.$file) && substr($file,-3)=='.js'){
|
||||
$this->handlefile($basedir.'/'.$file);
|
||||
}else if(!is_dir($basedir.'/'.$file) && substr($file,-4)=='.map'){
|
||||
unlink($basedir.'/'.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
|
||||
private function handlefile($filepath){
|
||||
$file = file_get_contents($filepath);
|
||||
if(!$file)return;
|
||||
|
||||
$flag = false;
|
||||
|
||||
if(strpos($file, 'window.location.protocol.indexOf("https")>=0')!==false){ //index
|
||||
$file = str_replace('(window.location.protocol.indexOf("https")>=0)', '1', $file);
|
||||
$file = preg_replace('!setTimeout\(\(\(\)=>\{\w+\(\)\}\),3e3\)!', '', $file);
|
||||
$file = preg_replace('!setTimeout\(\(function\(\)\{\w+\(\)\}\),3e3\)!', '', $file);
|
||||
$file = preg_replace('!recommendShow:\w+,!', 'recommendShow:!1,', $file);
|
||||
$code = $this->getExtendCode($file, '"需求反馈"', 2);
|
||||
if($code){
|
||||
$file = str_replace($code, '{}', $file);
|
||||
}
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '"WechatOfficial"')!==false){ //main
|
||||
$code = $this->getExtendCode($file, '"WechatOfficial"', 5);
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$start = strpos($file, $code) - 1;
|
||||
for($i=$start;$i>=0;$i--){
|
||||
if(substr($file,$i,1) == ','){
|
||||
$start = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$code = $this->getExtendCode($file, '"/other/customer-service.png"', 2);
|
||||
$code = $this->getExtendCode($file, $code, 2, '[', ']');
|
||||
$end = strpos($file, $code)+strlen($code);
|
||||
$code = substr($file, $start, $end - $start + 1);
|
||||
$file = str_replace($code, '', $file);
|
||||
$file = str_replace('startNegotiate(),', '', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '"calc"') !== false && strpos($file, '"checkConfirm"') !== false){ //main2
|
||||
$file = preg_replace('!,isCalc:\w+,isInput:\w+,isCheck:\w+,!', ',isCalc:!1,isInput:!1,isCheck:!1,', $file);
|
||||
$file = preg_replace('!\w+\(\(\(\)=>"calc"===\w+\.type\|\|"checkConfirm"===\w+\.type\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(\(\)=>"input"===\w+\.type\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(\(\)=>"check"===\w+\.type\|\|"checkConfirm"===\w+\.type\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(function\(\)\{return"calc"===\w+\.type\|\|"checkConfirm"===\w+\.type\}\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(function\(\)\{return"input"===\w+\.type\}\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(function\(\)\{return"check"===\w+\.type\|\|"checkConfirm"===\w+\.type\}\)\)!', '!1', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '请冷静几秒钟,确认以下要删除的数据')!==false && strpos($file, '"计算结果:"')!==false){ //site
|
||||
$code = $this->getExtendCode($file, '"计算结果:"', 2, '[', ']');
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$file = str_replace($code, '', $file);
|
||||
$file = preg_replace('!\w+\.sum===\w+\.addend1\+\w+\.addend2!', '!0', $file);
|
||||
$file = preg_replace('!\w+\.sum\!==\w+\.addend1\+\w+\.addend2!', '!1', $file);
|
||||
$file = preg_replace('!,disableDeleteButton:\w+,countdown:\w+,!', ',disableDeleteButton:!1,countdown:!1,', $file);
|
||||
if(preg_match('/startCountdown:(\w+),/', $file, $matchs)){
|
||||
$file = str_replace([';'.$matchs[1].'()', $matchs[1].'(),'], '', $file);
|
||||
}
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
/*if(strpos($file, '"bt-waf-gray"')!==false){ //site.popup
|
||||
$code = $this->getExtendCode($file, '"bt-waf-gray"', 2);
|
||||
$code = $this->getExtendCode($file, $code, 1, '[', ']');
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$file = str_replace($code, '""', $file);
|
||||
$flag = true;
|
||||
}*/
|
||||
|
||||
if(strpos($file, '"商用SSL证书"')!==false){ //site-ssl
|
||||
$code = $this->getExtendFunction($file, '"商用SSL证书"', '{', '}');
|
||||
$file = str_replace($code, '', $file);
|
||||
$code = $this->getExtendFunction($file, '"测试证书"', '{', '}');
|
||||
$file = str_replace($code, '', $file);
|
||||
$file = str_replace('"currentCertInfo":"busSslList"', '"currentCertInfo":"currentCertInfo"', $file);
|
||||
$file = preg_replace('!\{(\w+)\.value="busSslList",\w+\(\)\}!', '{$1.value="letsEncryptList"}', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '如果您希望添加其它Docker应用')!==false){
|
||||
$code = $this->getExtendCode($file, '如果您希望添加其它Docker应用', 1, '[', ']');
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$file = str_replace($code, '', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '"recom-view"')!==false){ //soft
|
||||
$code = $this->getExtendFunction($file, '"recom-view"');
|
||||
$file = str_replace($code, 'void(0)', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '"打开插件文件目录"')!==false){ //soft.table
|
||||
$code = $this->getExtendFunction($file, '"(续费)"');
|
||||
$file = str_replace($code, '""', $file);
|
||||
$code = $this->getExtendFunction($file, '"(续费)"');
|
||||
$file = str_replace($code, '""', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '检测到同名文件')!==false){ //file.
|
||||
$code = $this->getExtendCode($file, '计算结果:', 3, '[', ']');
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$file = str_replace($code, '', $file);
|
||||
$file = preg_replace('!\w+\.sum===\w+\.addend1\+\w+\.addend2!', '!0', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
for($i=0;$i<5;$i++){
|
||||
$code = $this->getExtendCode($file, 'content:"需求反馈"', 2);
|
||||
if($code){
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$start = strpos($file, $code);
|
||||
if(substr($file,$start-1,1) == ':'){
|
||||
$file = str_replace($code, '{}', $file);
|
||||
}else{
|
||||
$file = str_replace($code, '', $file);
|
||||
}
|
||||
$flag = true;
|
||||
}
|
||||
}
|
||||
$code = $this->getExtendFunction($file, '("需求反馈")');
|
||||
if($code){
|
||||
$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);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(!$flag) return;
|
||||
if(file_put_contents($filepath, $file)){
|
||||
echo '文件:'.$filepath.' 处理成功'."\n";
|
||||
}else{
|
||||
echo '文件:'.$filepath.' 处理失败,可能无写入权限'."\n";
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,13 +8,13 @@ class Index extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return 'Server is ok';
|
||||
return '';
|
||||
}
|
||||
|
||||
public function download()
|
||||
{
|
||||
if(config_get('download_page') == '0' && !request()->islogin){
|
||||
return redirect('/admin/login');
|
||||
return 'need login';
|
||||
}
|
||||
View::assign('siteurl', request()->root(true));
|
||||
return view();
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
Linux_Version="8.0.5"
|
||||
Windows_Version="7.9.0"
|
||||
Btm_Version="2.2.9"
|
||||
Linux_Version="9.1.0"
|
||||
Windows_Version="8.0.0"
|
||||
Btm_Version="2.3.0"
|
||||
|
||||
FILES=(
|
||||
public/install/src/panel6.zip
|
||||
|
@@ -23,7 +23,7 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="./">宝塔第三方云端管理中心</a>
|
||||
<a class="navbar-brand" href="./">Cloud</a>
|
||||
</div><!-- /.navbar-header -->
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
@@ -8,5 +8,6 @@ return [
|
||||
'updateall' => 'app\command\UpdateAll',
|
||||
'decrypt' => 'app\command\DecryptFile',
|
||||
'clean' => 'app\command\Clean',
|
||||
'cleanvitejs' => 'app\command\CleanViteJs',
|
||||
],
|
||||
];
|
||||
|
@@ -48,7 +48,7 @@ CREATE TABLE `cloud_white` (
|
||||
DROP TABLE IF EXISTS `cloud_record`;
|
||||
CREATE TABLE `cloud_record` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(20) NOT NULL,
|
||||
`ip` varchar(200) NOT NULL,
|
||||
`addtime` datetime NOT NULL,
|
||||
`usetime` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
|
@@ -3,6 +3,9 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
INSTALL_LOGFILE="/tmp/btpanel-install.log"
|
||||
# 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)
|
||||
if [ "$Check_Api" != 'ok' ];then
|
||||
@@ -16,7 +19,8 @@ fi
|
||||
|
||||
is64bit=$(getconf LONG_BIT)
|
||||
if [ "${is64bit}" != '64' ];then
|
||||
Red_Error "抱歉, 当前面板版本不支持32位系统, 请使用64位系统或安装宝塔5.9!";
|
||||
echo "抱歉, 当前面板版本不支持32位系统, 请使用64位系统或安装宝塔5.9!";
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
|
||||
@@ -27,7 +31,7 @@ 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安装宝塔面板"
|
||||
echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板,建议更换Ubuntu22/24安装宝塔面板"
|
||||
exit 1
|
||||
fi
|
||||
HOSTNAME_CHECK=$(cat /etc/hostname)
|
||||
@@ -36,6 +40,20 @@ if [ -z "${HOSTNAME_CHECK}" ];then
|
||||
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
|
||||
@@ -59,28 +77,17 @@ GetSysInfo(){
|
||||
echo -e ${SYS_VERSION}
|
||||
echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_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 "============================================"
|
||||
|
||||
if [ -f "/etc/redhat-release" ];then
|
||||
Centos7Check=$(cat /etc/redhat-release | grep ' 7.' | grep -iE 'centos')
|
||||
echo -e "============================================"
|
||||
echo -e "Centos7/8官方已经停止支持"
|
||||
echo -e "如是新安装系统服务器建议更换至Debian-12/Ubuntu-22/Centos-9系统安装宝塔面板"
|
||||
echo -e "============================================"
|
||||
fi
|
||||
}
|
||||
Red_Error(){
|
||||
echo '=================================================';
|
||||
@@ -124,32 +131,19 @@ System_Check(){
|
||||
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
|
||||
SET_SSL=true
|
||||
if [ "${SSL_PL}" ];then
|
||||
SET_SSL=""
|
||||
fi
|
||||
}
|
||||
Add_lib_Install(){
|
||||
Get_Versions
|
||||
if [ "${os_type}" == "el" ] && [ "${os_version}" == "7" ];then
|
||||
cd /www/server/panel/class
|
||||
#btpython -c "import panelPlugin; plugin = panelPlugin.panelPlugin(); plugin.check_install_lib('1')"
|
||||
#echo "True" > /tmp/panelTask.pl
|
||||
fi
|
||||
}
|
||||
Get_Pack_Manager(){
|
||||
if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then
|
||||
PM="yum"
|
||||
@@ -167,6 +161,8 @@ Auto_Swap()
|
||||
if [ ! -d /www ];then
|
||||
mkdir /www
|
||||
fi
|
||||
echo "正在设置虚拟内存,请稍等..........";
|
||||
echo '---------------------------------------------';
|
||||
swapFile="/www/swap"
|
||||
dd if=/dev/zero of=$swapFile bs=1M count=1025
|
||||
mkswap -f $swapFile
|
||||
@@ -194,7 +190,59 @@ Service_Add(){
|
||||
update-rc.d bt defaults
|
||||
fi
|
||||
}
|
||||
Set_Centos_Repo(){
|
||||
Set_Centos7_Repo(){
|
||||
# CN_YUM_URL=$(grep -E "aliyun|163|tencent|tsinghua" /etc/yum.repos.d/CentOS-Base.repo)
|
||||
# if [ -z "${CN_YUM_URL}" ];then
|
||||
# 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
|
||||
# return
|
||||
# fi
|
||||
MIRROR_CHECK=$(cat /etc/yum.repos.d/CentOS-Base.repo |grep "[^#]mirror.centos.org")
|
||||
if [ "${MIRROR_CHECK}" ] && [ "${is64bit}" == "64" ];then
|
||||
\cp -rpa /etc/yum.repos.d/ /etc/yumBak
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
fi
|
||||
|
||||
TSU_MIRROR_CHECK=$(cat /etc/yum.repos.d/CentOS-Base.repo |grep "tuna.tsinghua.edu.cn")
|
||||
if [ "${TSU_MIRROR_CHECK}" ];then
|
||||
\cp -rpa /etc/yum.repos.d/ /etc/yumBak
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|#baseurl=https://mirrors.tuna.tsinghua.edu.cn|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|#baseurl=http://mirrors.tuna.tsinghua.edu.cn|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|baseurl=https://mirrors.tuna.tsinghua.edu.cn|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|baseurl=http://mirrors.tuna.tsinghua.edu.cn|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
yum install unzip -y
|
||||
if [ "$?" != "0" ] ;then
|
||||
TAR_CHECK=$(which tar)
|
||||
if [ "$?" == "0" ] ;then
|
||||
\cp -rpa /etc/yum.repos.d/ /etc/yumBak
|
||||
if [ -z "${download_Url}" ];then
|
||||
download_Url="http://download.bt.cn"
|
||||
fi
|
||||
curl -Ss --connect-timeout 5 -m 60 -O ${download_Url}/src/el7repo.tar.gz
|
||||
rm -f /etc/yum.repos.d/*.repo
|
||||
tar -xvzf el7repo.tar.gz -C /etc/yum.repos.d/
|
||||
fi
|
||||
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
|
||||
\cp -rpa /etc/yum.repos.d/ /etc/yumBak
|
||||
@@ -217,6 +265,21 @@ Set_Centos_Repo(){
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
fi
|
||||
|
||||
yum install unzip tar -y
|
||||
if [ "$?" != "0" ] ;then
|
||||
if [ -z "${download_Url}" ];then
|
||||
download_Url="http://download.bt.cn"
|
||||
fi
|
||||
if [ ! -f "/usr/bin/tar" ] ;then
|
||||
curl -Ss --connect-timeout 5 -m 60 -O ${download_Url}/src/tar-1.30-5.el8.x86_64.rpm
|
||||
yum install tar-1.30-5.el8.x86_64.rpm -y
|
||||
fi
|
||||
\cp -rpa /etc/yum.repos.d/ /etc/yumBak
|
||||
curl -Ss --connect-timeout 5 -m 60 -O ${download_Url}/src/el8repo.tar.gz
|
||||
rm -f /etc/yum.repos.d/*.repo
|
||||
tar -xvzf el8repo.tar.gz -C /etc/yum.repos.d/
|
||||
fi
|
||||
}
|
||||
get_node_url(){
|
||||
if [ ! -f /bin/curl ];then
|
||||
@@ -236,7 +299,15 @@ get_node_url(){
|
||||
|
||||
echo '---------------------------------------------';
|
||||
echo "Selected download node...";
|
||||
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);
|
||||
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 https://download.bt.cn);
|
||||
|
||||
CURL_CHECK=$(which curl)
|
||||
if [ "$?" == "0" ];then
|
||||
CN_CHECK=$(curl -sS --connect-timeout 10 -m 10 https://api.bt.cn/api/isCN)
|
||||
if [ "${CN_CHECK}" == "True" ];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
|
||||
fi
|
||||
|
||||
if [ "$1" ];then
|
||||
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
|
||||
@@ -255,7 +326,7 @@ get_node_url(){
|
||||
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $2}')
|
||||
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $3 * 1000 - 500 }'|cut -d '.' -f 1)
|
||||
if [ "${NODE_STATUS}" == "200" ];then
|
||||
if [ $TIME_TOTAL -lt 100 ];then
|
||||
if [ $TIME_TOTAL -lt 300 ];then
|
||||
if [ $RES -ge 1500 ];then
|
||||
echo "$RES $node" >> $tmp_file1
|
||||
fi
|
||||
@@ -266,8 +337,8 @@ get_node_url(){
|
||||
fi
|
||||
|
||||
i=$(($i+1))
|
||||
if [ $TIME_TOTAL -lt 100 ];then
|
||||
if [ $RES -ge 3000 ];then
|
||||
if [ $TIME_TOTAL -lt 300 ];then
|
||||
if [ $RES -ge 2390 ];then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
@@ -303,10 +374,25 @@ Remove_Package(){
|
||||
}
|
||||
Install_RPM_Pack(){
|
||||
yumPath=/etc/yum.conf
|
||||
|
||||
CentosStream8Check=$(cat /etc/redhat-release |grep Stream|grep 8)
|
||||
if [ "${CentosStream8Check}" ];then
|
||||
MIRROR_CHECK=$(cat /etc/yum.repos.d/CentOS-Stream-AppStream.repo|grep "[^#]mirror.centos.org")
|
||||
if [ "${MIRROR_CHECK}" ] && [ "${is64bit}" == "64" ];then
|
||||
\cp -rpa /etc/yum.repos.d/ /etc/yumBak
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
fi
|
||||
fi
|
||||
|
||||
Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat')
|
||||
if [ "${Centos8Check}" ];then
|
||||
Set_Centos_Repo
|
||||
Set_Centos8_Repo
|
||||
fi
|
||||
Centos7Check=$(cat /etc/redhat-release | grep ' 7.' | grep -iE 'centos|Red Hat')
|
||||
if [ "${Centos7Check}" ];then
|
||||
Set_Centos7_Repo
|
||||
fi
|
||||
isExc=$(cat $yumPath|grep httpd)
|
||||
if [ "$isExc" = "" ];then
|
||||
echo "exclude=httpd nginx php mysql mairadb python-psutil python2-psutil" >> $yumPath
|
||||
@@ -403,7 +489,7 @@ Install_Deb_Pack(){
|
||||
apt-get install curl -y
|
||||
fi
|
||||
|
||||
debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git qrencode";
|
||||
debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git qrencode sqlite3";
|
||||
apt-get install -y $debPacks --force-yes
|
||||
|
||||
for debPack in ${debPacks}
|
||||
@@ -435,6 +521,24 @@ Get_Versions(){
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "/etc/os-release" ];then
|
||||
. /etc/os-release
|
||||
OS_V=${VERSION_ID%%.*}
|
||||
if [ "${ID}" == "opencloudos" ] && [[ "${OS_V}" =~ ^(9)$ ]];then
|
||||
os_type="opencloudos"
|
||||
os_version="9"
|
||||
pyenv_tt="true"
|
||||
elif { [ "${ID}" == "almalinux" ] || [ "${ID}" == "centos" ] || [ "${ID}" == "rocky" ]; } && [[ "${OS_V}" =~ ^(9)$ ]]; then
|
||||
os_type="el"
|
||||
os_version="9"
|
||||
pyenv_tt="true"
|
||||
fi
|
||||
if [ "${pyenv_tt}" ];then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $redhat_version_file ];then
|
||||
os_type='el'
|
||||
is_aliyunos=$(cat $redhat_version_file|grep Aliyun)
|
||||
@@ -581,7 +685,9 @@ Install_Python_Lib(){
|
||||
os_version=""
|
||||
rm -f /www/server/panel/pymake.pl
|
||||
fi
|
||||
|
||||
echo "==============================================="
|
||||
echo "正在下载面板运行环境,请稍等..............."
|
||||
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
|
||||
@@ -700,6 +806,9 @@ Install_Bt(){
|
||||
|
||||
wget -O /etc/init.d/bt ${download_Url}/install/src/bt6.init -T 15
|
||||
wget -O /www/server/panel/install/public.sh ${Btapi_Url}/install/public.sh -T 15
|
||||
echo "=============================================="
|
||||
echo "正在下载面板文件,请稍等..................."
|
||||
echo "=============================================="
|
||||
wget -O panel.zip ${Btapi_Url}/install/src/panel6.zip -T 15
|
||||
|
||||
if [ -f "${setup_path}/server/panel/data/default.db" ];then
|
||||
@@ -714,8 +823,8 @@ Install_Bt(){
|
||||
mv -f ${setup_path}/server/panel/data/port.pl ${setup_path}/server/panel/old_data/port.pl
|
||||
mv -f ${setup_path}/server/panel/data/admin_path.pl ${setup_path}/server/panel/old_data/admin_path.pl
|
||||
|
||||
if [ -f "${setup_path}/server/panel/data/db/default.db" ];then
|
||||
mv -f ${setup_path}/server/panel/data/db/ ${setup_path}/server/panel/old_data/
|
||||
if [ -d "${setup_path}/server/panel/data/db" ];then
|
||||
\cp -r ${setup_path}/server/panel/data/db ${setup_path}/server/panel/old_data/
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -737,8 +846,8 @@ Install_Bt(){
|
||||
mv -f ${setup_path}/server/panel/old_data/port.pl ${setup_path}/server/panel/data/port.pl
|
||||
mv -f ${setup_path}/server/panel/old_data/admin_path.pl ${setup_path}/server/panel/data/admin_path.pl
|
||||
|
||||
if [ -f "${setup_path}/server/panel/old_data/db/default.db" ];then
|
||||
mv -f ${setup_path}/server/panel/old_data/db/ ${setup_path}/server/panel/data/db
|
||||
if [ -d "${setup_path}/server/panel/old_data/db" ];then
|
||||
\cp -r ${setup_path}/server/panel/old_data/db ${setup_path}/server/panel/data/
|
||||
fi
|
||||
|
||||
if [ -d "/${setup_path}/server/panel/old_data" ];then
|
||||
@@ -812,16 +921,20 @@ Set_Bt_Panel(){
|
||||
echo "/${auth_path}" > ${admin_auth}
|
||||
fi
|
||||
chmod -R 700 $pyenv_path/pyenv/bin
|
||||
btpip install docxtpl==0.16.7
|
||||
/www/server/panel/pyenv/bin/pip3 install pymongo
|
||||
/www/server/panel/pyenv/bin/pip3 install psycopg2-binary
|
||||
/www/server/panel/pyenv/bin/pip3 install flask -U
|
||||
/www/server/panel/pyenv/bin/pip3 install flask-sock
|
||||
/www/server/panel/pyenv/bin/pip3 install -I gevent
|
||||
btpip install simple-websocket==0.10.0
|
||||
btpip install natsort
|
||||
btpip uninstall enum34 -y
|
||||
btpip install geoip2==4.7.0
|
||||
if [ ! -f "/www/server/panel/pyenv/n.pl" ];then
|
||||
btpip install docxtpl==0.16.7
|
||||
/www/server/panel/pyenv/bin/pip3 install pymongo
|
||||
/www/server/panel/pyenv/bin/pip3 install psycopg2-binary
|
||||
/www/server/panel/pyenv/bin/pip3 install flask -U
|
||||
/www/server/panel/pyenv/bin/pip3 install flask-sock
|
||||
/www/server/panel/pyenv/bin/pip3 install -I gevent
|
||||
btpip install simple-websocket==0.10.0
|
||||
btpip install natsort
|
||||
btpip uninstall enum34 -y
|
||||
btpip install geoip2==4.7.0
|
||||
btpip install brotli
|
||||
btpip install PyMySQL
|
||||
fi
|
||||
auth_path=$(cat ${admin_auth})
|
||||
cd ${setup_path}/server/panel/
|
||||
/etc/init.d/bt start
|
||||
@@ -836,14 +949,27 @@ Set_Bt_Panel(){
|
||||
chmod 600 ${setup_path}/server/panel/default.pl
|
||||
sleep 3
|
||||
if [ "$SET_SSL" == true ]; then
|
||||
btpip install -I pyOpenSSl 2>/dev/null
|
||||
btpython /www/server/panel/tools.py ssl
|
||||
if [ ! -f "/www/server/panel/pyenv/n.pl" ];then
|
||||
btpip install -I pyOpenSSl 2>/dev/null
|
||||
fi
|
||||
echo "========================================"
|
||||
echo "正在开启面板SSL,请稍等............ "
|
||||
echo "========================================"
|
||||
SSL_STATUS=$(btpython /www/server/panel/tools.py ssl)
|
||||
if [ "${SSL_STATUS}" == "0" ] ;then
|
||||
echo -n " -4 " > /www/server/panel/data/v4.pl
|
||||
btpython /www/server/panel/tools.py ssl
|
||||
fi
|
||||
echo "证书开启成功!"
|
||||
echo "========================================"
|
||||
fi
|
||||
/etc/init.d/bt restart
|
||||
sleep 3
|
||||
/etc/init.d/bt stop
|
||||
sleep 5
|
||||
/etc/init.d/bt start
|
||||
sleep 5
|
||||
isStart=$(ps aux |grep 'BT-Panel'|grep -v grep|awk '{print $2}')
|
||||
LOCAL_CURL=$(curl 127.0.0.1:${panelPort}/login 2>&1 |grep -i html)
|
||||
if [ -z "${isStart}" ] && [ -z "${LOCAL_CURL}" ];then
|
||||
if [ -z "${isStart}" ];then
|
||||
/etc/init.d/bt 22
|
||||
cd /www/server/panel/pyenv/bin
|
||||
touch t.pl
|
||||
@@ -857,6 +983,9 @@ Set_Bt_Panel(){
|
||||
btpython -c 'import tools;tools.set_panel_username("'$PANEL_USER'")'
|
||||
cd ~
|
||||
fi
|
||||
if [ -f "/usr/bin/sqlite3" ] ;then
|
||||
sqlite3 /www/server/panel/data/db/panel.db "UPDATE config SET status = '1' WHERE id = '1';" > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
Set_Firewall(){
|
||||
sshPort=$(cat /etc/ssh/sshd_config | grep 'Port '|awk '{print $2}')
|
||||
@@ -989,6 +1118,7 @@ Install_Main(){
|
||||
|
||||
Get_Ip_Address
|
||||
Setup_Count ${IDC_CODE}
|
||||
Add_lib_Install
|
||||
}
|
||||
|
||||
echo "
|
||||
@@ -1021,6 +1151,9 @@ while [ ${#} -gt 0 ]; do
|
||||
SAFE_PATH=$2
|
||||
shift 1
|
||||
;;
|
||||
--ssl-disable)
|
||||
SSL_PL="disable"
|
||||
;;
|
||||
-y)
|
||||
go="y"
|
||||
;;
|
||||
@@ -1040,6 +1173,29 @@ if [ "$go" == 'n' ];then
|
||||
exit;
|
||||
fi
|
||||
|
||||
if [ -f "/www/server/panel/BT-Panel" ];then
|
||||
AAPANEL_CHECK=$(grep www.aapanel.com /www/server/panel/BT-Panel)
|
||||
if [ "${AAPANEL_CHECK}" ];then
|
||||
echo -e "----------------------------------------------------"
|
||||
echo -e "检查已安装有aapanel,无法进行覆盖安装宝塔面板"
|
||||
echo -e "如继续执行安装将移去aapanel面板数据(备份至/www/server/aapanel路径) 全新安装宝塔面板"
|
||||
echo -e "aapanel is alreday installed,Can't install panel"
|
||||
echo -e "is install Baota panel, aapanel data will be removed (backed up to /www/server/aapanel)"
|
||||
echo -e "Beginning new Baota panel installation."
|
||||
echo -e "----------------------------------------------------"
|
||||
echo -e "已知风险/Enter yes to force installation"
|
||||
read -p "输入yes开始安装: " yes;
|
||||
if [ "$yes" != "yes" ];then
|
||||
echo -e "------------"
|
||||
echo "取消安装"
|
||||
exit;
|
||||
fi
|
||||
bt stop
|
||||
sleep 1
|
||||
mv /www/server/panel /www/server/aapanel
|
||||
fi
|
||||
fi
|
||||
|
||||
ARCH_LINUX=$(cat /etc/os-release |grep "Arch Linux")
|
||||
if [ "${ARCH_LINUX}" ] && [ -f "/usr/bin/pacman" ];then
|
||||
pacman -Sy
|
||||
@@ -1075,7 +1231,12 @@ echo -e ""
|
||||
echo -e "=================================================================="
|
||||
endTime=`date +%s`
|
||||
((outTime=($endTime-$startTime)/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
if [ "${outTime}" == "0" ];then
|
||||
((outTime=($endTime-$startTime)))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mseconds!"
|
||||
else
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -24,11 +24,6 @@ if [ "${Centos6Check}" ];then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
public_file=/www/server/panel/install/public.sh
|
||||
if [ ! -f $public_file ];then
|
||||
wget -O Tpublic.sh $Btapi_Url/install/public.sh -T 20;
|
||||
fi
|
||||
. $public_file
|
||||
|
||||
Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat')
|
||||
if [ "${Centos8Check}" ];then
|
||||
@@ -43,11 +38,20 @@ if [ -f $env_path ];then
|
||||
mypip="/www/server/panel/pyenv/bin/pip"
|
||||
fi
|
||||
|
||||
download_Url=$NODE_URL
|
||||
if [ -f "/www/server/panel/data/down_url.pl" ];then
|
||||
D_NODE_URL=$(cat /www/server/panel/data/down_url.pl|grep bt.cn)
|
||||
fi
|
||||
|
||||
if [ -z "${D_NODE_URL}" ];then
|
||||
D_NODE_URL="download.bt.cn"
|
||||
fi
|
||||
|
||||
download_Url=$D_NODE_URL
|
||||
|
||||
setup_path=/www
|
||||
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
|
||||
if [ "$version" = '' ];then
|
||||
version='8.0.5'
|
||||
if [ -z "$VERSION_CHECK" ];then
|
||||
version='9.1.0'
|
||||
fi
|
||||
armCheck=$(uname -m|grep arm)
|
||||
if [ "${armCheck}" ];then
|
||||
@@ -79,13 +83,18 @@ rm -f /www/server/panel/*.pyc
|
||||
rm -f /www/server/panel/class/*.pyc
|
||||
#pip install flask_sqlalchemy
|
||||
#pip install itsdangerous==0.24
|
||||
btpip install natsort
|
||||
pip_list=$($mypip list)
|
||||
|
||||
pip_list=$($mypip list 2>&1)
|
||||
request_v=$(btpip list 2>/dev/null|grep "requests "|awk '{print $2}'|cut -d '.' -f 2)
|
||||
if [ "$request_v" = "" ] || [ "${request_v}" -gt "28" ];then
|
||||
$mypip install requests==2.27.1
|
||||
fi
|
||||
|
||||
NATSORT_C=$(echo $pip_list|grep natsort)
|
||||
if [ -z "${NATSORT_C}" ];then
|
||||
btpip install natsort
|
||||
fi
|
||||
|
||||
openssl_v=$(echo "$pip_list"|grep pyOpenSSL)
|
||||
if [ "$openssl_v" = "" ];then
|
||||
$mypip install pyOpenSSL
|
||||
@@ -105,9 +114,40 @@ if [ "${GEVENT_V}" -le "1" ];then
|
||||
/www/server/panel/pyenv/bin/pip3 install -I gevent
|
||||
fi
|
||||
|
||||
BROTLI_C=$(btpip list 2> /dev/null |grep Brotli)
|
||||
if [ -z "$BROTLI_C" ]; then
|
||||
btpip install brotli
|
||||
fi
|
||||
|
||||
PYMYSQL_C=$(btpip list 2> /dev/null |grep PyMySQL)
|
||||
if [ -z "$PYMYSQL_C" ]; then
|
||||
btpip install PyMySQL
|
||||
fi
|
||||
|
||||
|
||||
PY_CRPYT=$(btpip list 2> /dev/null |grep cryptography|awk '{print $2}'|cut -f 1 -d '.')
|
||||
if [ "${PY_CRPYT}" -le "10" ];then
|
||||
btpip install pyOpenSSL==24.1.0
|
||||
btpip install cryptography==42.0.5
|
||||
fi
|
||||
|
||||
PYMYSQL_SSL_CHECK=$(btpython -c "import pymysql" 2>&1|grep "AttributeError: module 'cryptography.hazmat.bindings._rust.openssl'")
|
||||
if [ "${PYMYSQL_SSL_CHECK}" ];then
|
||||
btpip uninstall pyopenssl cryptography -y
|
||||
btpip install pyopenssl cryptography
|
||||
fi
|
||||
|
||||
btpip uninstall enum34 -y
|
||||
btpip install geoip2==4.7.0
|
||||
btpip install pandas
|
||||
|
||||
GEOIP_C=$(echo $pip_list|grep geoip2)
|
||||
if [ -z "${GEOIP_C}" ];then
|
||||
btpip install geoip2==4.7.0
|
||||
fi
|
||||
|
||||
PANDAS_C=$(echo $pip_list|grep pandas)
|
||||
if [ -z "${PANDAS_C}" ];then
|
||||
btpip install pandas
|
||||
fi
|
||||
|
||||
pymysql=$(echo "$pip_list"|grep pycryptodome)
|
||||
if [ "$pymysql" = "" ];then
|
||||
@@ -117,6 +157,11 @@ fi
|
||||
echo "修复面板依赖完成!"
|
||||
echo "==========================================="
|
||||
|
||||
RE_UPDATE=$(cat /www/server/panel/data/db/update)
|
||||
if [ "$RE_UPDATE" -ge "4" ];then
|
||||
echo "2" > /www/server/panel/data/db/update
|
||||
fi
|
||||
|
||||
#psutil=$(echo "$pip_list"|grep psutil|awk '{print $2}'|grep '5.7.')
|
||||
#if [ "$psutil" = "" ];then
|
||||
# $mypip install -U psutil
|
||||
@@ -145,6 +190,12 @@ if [ ! -f /www/server/panel/data/total_nps.pl ]; then
|
||||
echo "" > /www/server/panel/data/total_nps.pl
|
||||
fi
|
||||
|
||||
echo "==========================================="
|
||||
echo "正在更新面板文件..............."
|
||||
sleep 1
|
||||
echo "更新完成!"
|
||||
echo "==========================================="
|
||||
|
||||
chattr -i /etc/init.d/bt
|
||||
chmod +x /etc/init.d/bt
|
||||
echo "====================================="
|
||||
|
Binary file not shown.
@@ -57,8 +57,8 @@ Route::group('api', function () {
|
||||
Route::post('/Cert/get_product_list', 'api/return_success');
|
||||
Route::get('/Pluginother/get_file', 'api/download_plugin_other');
|
||||
|
||||
Route::post('/Pluginother/create_order', 'api/return_error');
|
||||
Route::post('/Pluginother/renew_order', 'api/return_error');
|
||||
Route::post('/Pluginother/create_order', 'api/return_success');
|
||||
Route::post('/Pluginother/renew_order', 'api/return_success');
|
||||
Route::post('/Pluginother/order_stat', 'api/return_empty');
|
||||
Route::post('/Pluginother/re_order_stat', 'api/return_empty');
|
||||
Route::post('/Pluginother/create_order_okey', 'api/return_empty');
|
||||
|
@@ -14,12 +14,14 @@
|
||||
|
||||
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
||||
|
||||
- 全局搜索替换 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、js文件)
|
||||
|
||||
- 全局搜索替换 http://www.bt.cn/api/ => http://www.example.com/api/(需排除js文件)
|
||||
|
||||
- 全局搜索替换 https://download.bt.cn/install/update6.sh => http://www.example.com/install/update6.sh
|
||||
|
||||
- 搜索并删除提交异常报告的代码 bt_error/index.php
|
||||
|
||||
- class/ajax.py 文件 \# 是否执行升级程序 下面的 public.get_url() 改成 public.GetConfigValue('home')
|
||||
|
||||
class/jobs.py 文件 \#尝试升级到独立环境 下面的 public.get_url() 改成 public.GetConfigValue('home')
|
||||
@@ -42,6 +44,8 @@
|
||||
|
||||
在 def check_domain_cloud(domain): 这一行下面加上 return
|
||||
|
||||
在 def err_collect 这一行下面加上 return
|
||||
|
||||
在 def get_improvement(): 这一行下面加上 return False
|
||||
|
||||
在free_login_area方法内get_free_ips_area替换成get_ips_area
|
||||
@@ -50,9 +54,7 @@
|
||||
|
||||
在login_send_body方法内,free_login_area(login_ip=server_ip_area的server_ip_area改成login_ip
|
||||
|
||||
- class/panelPlugin.py 文件,download_icon方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
||||
|
||||
删除public.total_keyword(get.query)这一行
|
||||
- class/panelPlugin.py 文件,删除public.total_keyword(get.query)这一行
|
||||
|
||||
__set_pyenv方法内,temp_file = public.readFile(filename)这行代码下面加上
|
||||
|
||||
@@ -61,17 +63,30 @@
|
||||
temp_file = temp_file.replace('https://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
|
||||
```
|
||||
|
||||
def check_status(self, softInfo): 方法最后一行加上
|
||||
|
||||
```python
|
||||
if 'endtime' in softInfo:
|
||||
softInfo['endtime'] = time.time() + 86400 * 3650
|
||||
```
|
||||
|
||||
plugin_bin.pl 改成 plugin_list.json
|
||||
|
||||
- class/plugin_deployment.py 文件,SetupPackage方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
||||
|
||||
- class/config.py 文件,get_nps方法内data['nps'] = False改成True,get_nps_new方法下面加上 return public.returnMsg(False, "获取问卷失败")
|
||||
|
||||
def err_collection(self, get): 这一行下面加上 return public.returnMsg(True, "OK")
|
||||
|
||||
- class/push/site_push.py 文件,'https://www.bt.cn' => 'http://www.example.com'
|
||||
|
||||
- script/flush_plugin.py 文件,删除clear_hosts()一行
|
||||
|
||||
- script/reload_check.py 文件,在第2行插入sys.exit()
|
||||
|
||||
- script/local_fix.sh 文件,${D_NODE_URL}替换成www.example.com
|
||||
|
||||
- tools.py 文件,u_input == 16下面的public.get_url()替换成'http://www.example.com'
|
||||
- tools.py 文件,u_input == 16下面的public.get_url()替换成public.GetConfigValue('home')
|
||||
|
||||
- install/install_soft.sh 在. 执行之前加入以下代码
|
||||
|
||||
@@ -84,7 +99,9 @@
|
||||
|
||||
- 去除无用的定时任务:task.py 文件 删除以下几行
|
||||
|
||||
"check_panel_msg": check_panel_msg,
|
||||
"check_panel_msg": self.check_panel_msg,
|
||||
|
||||
"update_software_list": self.update_software_list,
|
||||
|
||||
PluginLoader.daemon_panel()
|
||||
|
||||
@@ -92,10 +109,6 @@
|
||||
|
||||
- 去除WebRTC连接:BTPanel/static/js/public.js 删除stun.start();这一行
|
||||
|
||||
- 去除首页广告:BTPanel/static/js/index.js 文件删除两处index.recommend_paid_version()
|
||||
|
||||
- 去除首页自动检测更新,避免频繁请求云端:BTPanel/static/js/index.js 文件注释掉bt.system.check_update这一段代码外的setTimeout
|
||||
|
||||
- 去除内页广告:BTPanel/templates/default/layout.html 删除两处getPaymentStatus();
|
||||
|
||||
- 删除问卷调查:BTPanel/templates/default/layout.html 删除if(window.localStorage.getItem('panelNPS') == null)以及下面的行
|
||||
@@ -120,9 +133,7 @@
|
||||
|
||||
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log这一行
|
||||
|
||||
- [可选]删除小图标广告:在BTPanel/static/js/site.js,删除“WAF防火墙”对应的span标签
|
||||
|
||||
- [可选]上传文件默认选中覆盖,在BTPanel/static/js/upload-drog.js,id="all_operation"加checked属性
|
||||
- [可选]新版vite页面去除需求反馈、各种广告、计算题等,执行 php think cleanvitejs <面板BTPanel/static/vite/js路径>
|
||||
|
||||
|
||||
解压安装包[panel6.zip](http://download.bt.cn/install/src/panel6.zip),将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(
|
||||
|
@@ -1,78 +1,80 @@
|
||||
# Windows面板官方更新包修改记录
|
||||
|
||||
查询最新版本号:https://www.bt.cn/api/wpanel/get_version?is_version=1
|
||||
|
||||
官方更新包下载链接:http://download.bt.cn/win/panel/panel_版本号.zip
|
||||
|
||||
假设搭建的宝塔第三方云端网址是 http://www.example.com
|
||||
|
||||
Windows版宝塔由于加密文件太多,无法全部解密,因此无法做到全开源。
|
||||
|
||||
- 删除PluginLoader.pyd,将win/PluginLoader.py复制到class文件夹
|
||||
|
||||
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
||||
|
||||
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除ipsModel.py)
|
||||
|
||||
- 全局搜索替换 http://www.bt.cn/api/ => http://www.example.com/api/
|
||||
|
||||
- 全局搜索替换 https://download.bt.cn/win/panel/data/setup.py => http://www.example.com/win/panel/data/setup.py
|
||||
|
||||
- class/panel_update.py 文件 public.get_url() => 'http://www.example.com'
|
||||
|
||||
- class/public.py 在
|
||||
|
||||
```python
|
||||
def GetConfigValue(key):
|
||||
```
|
||||
|
||||
这一行下面加上
|
||||
|
||||
```python
|
||||
if key == 'home': return 'http://www.example.com'
|
||||
```
|
||||
|
||||
在 def is_bind(): 这一行下面加上 return True
|
||||
|
||||
在 def check_domain_cloud(domain): 这一行下面加上 return
|
||||
|
||||
在 get_update_file() 方法里面 get_url() => GetConfigValue('home')
|
||||
|
||||
- class/plugin_deployment.py 文件 get_icon 和 SetupPackage 方法内,替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
||||
|
||||
- 去除无用的定时任务:task.py 文件
|
||||
|
||||
删除 p = threading.Thread(target=check_files_panel) 以及下面2行
|
||||
|
||||
删除 p = threading.Thread(target=check_panel_msg) 以及下面2行
|
||||
|
||||
删除 p = threading.Thread(target=update_software_list) 以及下面2行
|
||||
|
||||
- 去除面板日志上报:script/site_task.py 文件
|
||||
|
||||
- 删除最下面 logs_analysis() 这1行
|
||||
|
||||
- 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行以及index.consultancy_services()这一行
|
||||
|
||||
- 去除首页自动检测更新,避免频繁请求云端:BTPanel/static/js/index.js 文件注释掉bt.system.check_update这一段代码外的setTimeout
|
||||
|
||||
- 去除内页广告:BTPanel/templates/default/layout.html 删除getPaymentStatus();这一行
|
||||
|
||||
- [可选]去除各种计算题:复制win/bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的尾部加入
|
||||
|
||||
```javascript
|
||||
<script src="/static/bt.js"></script>
|
||||
```
|
||||
|
||||
- [可选]去除创建网站自动创建的垃圾文件:class/panelSite.py 文件
|
||||
|
||||
删除 htaccess = self.sitePath + '/.htaccess' 以及下面2行
|
||||
|
||||
删除 index = self.sitePath + '/index.html' 以及下面6行
|
||||
|
||||
删除 doc404 = self.sitePath + '/404.html' 以及下面6行
|
||||
|
||||
删除 if not os.path.exists(self.sitePath + '/.htaccess') 这一行
|
||||
|
||||
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行
|
||||
|
||||
# Windows面板官方更新包修改记录
|
||||
|
||||
查询最新版本号:https://www.bt.cn/api/wpanel/get_version?is_version=1
|
||||
|
||||
官方更新包下载链接:http://download.bt.cn/win/panel/panel_版本号.zip
|
||||
|
||||
假设搭建的宝塔第三方云端网址是 http://www.example.com
|
||||
|
||||
Windows版宝塔由于加密文件太多,无法全部解密,因此无法做到全开源。
|
||||
|
||||
- 删除PluginLoader.pyd,将win/PluginLoader.py复制到class文件夹
|
||||
|
||||
- 批量解密模块文件:执行 php think decrypt classdir <面板class文件夹路径>
|
||||
|
||||
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
||||
|
||||
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除ipsModel.py)
|
||||
|
||||
- 全局搜索替换 https://download.bt.cn/win/panel/data/setup.py => http://www.example.com/win/panel/data/setup.py
|
||||
|
||||
- class/panel_update.py 文件 public.get_url() => 'http://www.example.com'
|
||||
|
||||
- class/public.py 在
|
||||
|
||||
```python
|
||||
def GetConfigValue(key):
|
||||
```
|
||||
|
||||
这一行下面加上
|
||||
|
||||
```python
|
||||
if key == 'home': return 'http://www.example.com'
|
||||
```
|
||||
|
||||
在 def is_bind(): 这一行下面加上 return True
|
||||
|
||||
在 def check_domain_cloud(domain): 这一行下面加上 return
|
||||
|
||||
在 get_update_file() 方法里面 get_url() => GetConfigValue('home')
|
||||
|
||||
- class/plugin_deployment.py 文件 get_icon 和 SetupPackage 方法内,替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
||||
|
||||
- 去除无用的定时任务:task.py 文件
|
||||
|
||||
删除 p = threading.Thread(target=check_files_panel) 以及下面2行
|
||||
|
||||
删除 p = threading.Thread(target=check_panel_msg) 以及下面2行
|
||||
|
||||
删除 p = threading.Thread(target=update_software_list) 以及下面2行
|
||||
|
||||
- 去除面板日志上报:script/site_task.py 文件
|
||||
|
||||
- 删除最下面 logs_analysis() 这1行
|
||||
|
||||
- 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行以及index.consultancy_services()这一行
|
||||
|
||||
- 去除首页自动检测更新,避免频繁请求云端:BTPanel/static/js/index.js 文件注释掉bt.system.check_update这一段代码外的setTimeout
|
||||
|
||||
- 去除内页广告:BTPanel/templates/default/layout.html 删除getPaymentStatus();这一行
|
||||
|
||||
- [可选]去除各种计算题:复制win/bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的尾部加入
|
||||
|
||||
```javascript
|
||||
<script src="/static/bt.js"></script>
|
||||
```
|
||||
|
||||
- [可选]去除创建网站自动创建的垃圾文件:class/panelSite.py 文件
|
||||
|
||||
删除 htaccess = self.sitePath + '/.htaccess' 以及下面2行
|
||||
|
||||
删除 index = self.sitePath + '/index.html' 以及下面6行
|
||||
|
||||
删除 doc404 = self.sitePath + '/404.html' 以及下面6行
|
||||
|
||||
删除 if not os.path.exists(self.sitePath + '/.htaccess') 这一行
|
||||
|
||||
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行
|
||||
|
||||
- [可选]上传文件默认选中覆盖,在BTPanel/static/js/upload-drog.js,id="all_operation"加checked属性
|
||||
|
||||
|
Reference in New Issue
Block a user