Browse Source

update

tags/2.8 2.8
flucout 2 months ago
parent
commit
d80c0e9e44
  1. 15
      app/command/CleanViteJs.php
  2. 12
      app/controller/Api.php
  3. 2
      app/script/convert.sh
  4. 6
      install.sql
  5. 10
      public/install/install_6.0.sh
  6. BIN
      public/install/src/panel6.zip
  7. BIN
      public/install/update/LinuxPanel-9.2.0.zip
  8. 82
      public/install/update6.sh
  9. BIN
      public/static/file/kaixin.zip
  10. 4
      route/app.php
  11. 6
      wiki/files/linux/PluginLoader.py
  12. 8
      wiki/update.md

15
app/command/CleanViteJs.php

@ -73,6 +73,7 @@ class CleanViteJs extends Command
}
}
if(substr($content,$start-1,1) == ',') $start--;
else if(substr($content,$end+1,1) == ',') $end++;
return substr($content, $start, $end - $start + 1);
}
@ -91,6 +92,14 @@ class CleanViteJs extends Command
}
}
private function str_replace_once($needle, $replace, $haystack) {
$pos = strpos($haystack, $needle);
if ($pos === false) {
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
private function handlefile($filepath){
$file = file_get_contents($filepath);
if(!$file)return;
@ -132,7 +141,6 @@ class CleanViteJs extends Command
$file = preg_replace('!,isCalc:\w+,isInput:\w+,!', ',isCalc:!1,isInput:!1,', $file);
$file = preg_replace('!"calc"===\w+\.type!', '!1', $file);
$file = preg_replace('!\w+\(\(\(\)=>"input"===\w+\.type\)\)!', '!1', $file);
$file = preg_replace('!"calc"===\w+\.type!', '!1', $file);
$file = preg_replace('!\w+\(\(function\(\)\{return"input"===\w+\.type\}\)\)!', '!1', $file);
$flag = true;
}
@ -165,6 +173,7 @@ class CleanViteJs extends Command
$file = str_replace($code, '', $file);
$file = str_replace('"currentCertInfo":"busSslList"', '"currentCertInfo":"currentCertInfo"', $file);
$file = preg_replace('!\{(\w+)\.value="busSslList",\w+\(\)\}!', '{$1.value="letsEncryptList"}', $file);
$file = preg_replace('!defaultActive:(\w+)\("sslCertificate"\)!', 'defaultActive:$1("EncryptCertificate")', $file);
$flag = true;
}
@ -203,9 +212,9 @@ class CleanViteJs extends Command
$code = $this->getExtendFunction($file, $code);
$start = strpos($file, $code);
if(substr($file,$start-1,1) == ':'){
$file = str_replace($code, '{}', $file);
$file = $this->str_replace_once($code, '{}', $file);
}else{
$file = str_replace($code, '', $file);
$file = $this->str_replace_once($code, '', $file);
}
$flag = true;
}

12
app/controller/Api.php

@ -139,6 +139,18 @@ class Api extends BaseController
return $version;
}
public function get_panel_version(){
$version = config_get('new_version');
$file = app()->getRootPath().'public/install/update/LinuxPanel-'.$version.'.zip';
$hash = hash_file('sha256', $file);
$data = [
'version' => $version,
'hash' => $hash,
'update_time' => filemtime($file),
];
return json($data);
}
//安装统计
public function setup_count(){
return 'ok';

2
app/script/convert.sh

@ -1,6 +1,6 @@
#!/bin/bash
Linux_Version="9.1.0"
Linux_Version="9.2.0"
Windows_Version="8.2.0"
Btm_Version="2.3.0"

6
install.sql

@ -12,9 +12,9 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''),
('whitelist', '0'),
('download_page', '1'),
('new_version', '9.1.0'),
('new_version', '9.2.0'),
('update_msg', '暂无更新日志'),
('update_date', '2024-07-15'),
('update_date', '2024-09-13'),
('new_version_win', '8.1.0'),
('update_msg_win', '暂无更新日志'),
('update_date_win', '2024-07-17'),
@ -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(200) NOT NULL,
`ip` varchar(20) NOT NULL,
`addtime` datetime NOT NULL,
`usetime` datetime NOT NULL,
PRIMARY KEY (`id`),

10
public/install/install_6.0.sh

@ -235,6 +235,12 @@ Set_Centos7_Repo(){
tar -xvzf el7repo.tar.gz -C /etc/yum.repos.d/
fi
fi
yum install unzip -y
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
@ -280,6 +286,10 @@ 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
if [ "$?" != "0" ] ;then
sed -i "s/vault.epel.cloud/mirrors.cloud.tencent.com/g" /etc/yum.repos.d/*.repo
fi
}
get_node_url(){
if [ ! -f /bin/curl ];then

BIN
public/install/src/panel6.zip

BIN
public/install/update/LinuxPanel-9.1.0.zip → public/install/update/LinuxPanel-9.2.0.zip

82
public/install/update6.sh

@ -18,17 +18,18 @@ if [ ! -f "/www/server/panel/pyenv/bin/python3" ];then
echo "请截图发帖至论坛www.bt.cn/bbs求助"
exit 0;
fi
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
if [ "${Centos6Check}" ];then
echo "Centos6不支持升级宝塔面板,建议备份数据重装更换Centos7/8安装宝塔面板"
exit 1
fi
Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat')
if [ "${Centos8Check}" ];then
if [ ! -f "/usr/bin/python" ] && [ -f "/usr/bin/python3" ] && [ ! -d "/www/server/panel/pyenv" ]; then
ln -sf /usr/bin/python3 /usr/bin/python
if [ -f "/etc/redhat-release" ];then
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
if [ "${Centos6Check}" ];then
echo "Centos6不支持升级宝塔面板,建议备份数据重装更换Centos7/8安装宝塔面板"
exit 1
fi
Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat')
if [ "${Centos8Check}" ];then
if [ ! -f "/usr/bin/python" ] && [ -f "/usr/bin/python3" ] && [ ! -d "/www/server/panel/pyenv" ]; then
ln -sf /usr/bin/python3 /usr/bin/python
fi
fi
fi
@ -48,10 +49,61 @@ fi
download_Url=$D_NODE_URL
Set_Centos7_Repo(){
if [ -f "/etc/yum.repos.d/docker-ce.repo" ];then
mv /etc/yum.repos.d/docker-ce.repo /etc/yum.repos.d/docker-ce.repo_backup
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
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 tree -y
if [ "$?" != "0" ] ;then
TAR_CHECK=$(which tree)
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
yum install tree -y
if [ "$?" != "0" ] ;then
sed -i "s/vault.epel.cloud/mirrors.cloud.tencent.com/g" /etc/yum.repos.d/*.repo
fi
}
if [ -f "/etc/redhat-release" ];then
Centos7Check=$(cat /etc/redhat-release | grep ' 7.' | grep -iE 'centos|Red Hat')
if [ "${Centos7Check}" ];then
Set_Centos7_Repo
fi
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.1.0'
version='9.2.0'
fi
armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then
@ -144,10 +196,10 @@ 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
# 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

BIN
public/static/file/kaixin.zip

4
route/app.php

@ -39,6 +39,7 @@ Route::group('api', function () {
Route::get('/getUpdateLogs', 'api/get_update_logs');
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::get('/SetupCount', 'api/setup_count');
Route::any('/panel/updateLinux', 'api/check_update');
Route::any('/wpanel/updateWindows', 'api/check_update_win');
@ -123,6 +124,9 @@ Route::group('api', function () {
Route::post('/Auth/SetSocre', 'api/get_ssl_list');
Route::post('/Auth/SubmitScore', 'api/get_ssl_list');
Route::post('/Cert_cloud_deploy/get_cert_list', 'api/return_success');
Route::post('/Cert_cloud_deploy/del_cert', 'api/return_success');
Route::miss('api/return_error');
});

6
wiki/files/linux/PluginLoader.py

@ -132,14 +132,14 @@ def module_run(module_name,def_name,args):
return public.returnMsg(False,'模块路径不合法')
def_object = public.get_script_object(module_file)
if not def_object: return public.returnMsg(False,'模块[%s]不存在' % module_file)
if not def_object: return public.returnMsg(False,'模块[%s]不存在' % module_name)
# 模块实例化并返回方法对象
try:
run_object = getattr(def_object.main(),def_name,None)
except:
return public.returnMsg(False,'模块[%s]入口实例化失败' % module_file)
if not run_object: return public.returnMsg(False,'在[%s]模块中找不到[%s]方法' % (module_file,def_name))
return public.returnMsg(False,'模块[%s]入口实例化失败' % module_name)
if not run_object: return public.returnMsg(False,'在[%s]模块中找不到[%s]方法' % (module_name,def_name))
if 'module_get_object' in args and args.module_get_object == 1:
return run_object

8
wiki/update.md

@ -20,6 +20,10 @@
- 全局搜索替换 https://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
http://download.bt.cn/install/update/ => http://www.example.com/install/update/
- 搜索并删除提交异常报告的代码 bt_error/index.php
- class/ajax.py 文件 \# 是否执行升级程序 下面的 public.get_url() 改成 public.GetConfigValue('home')
@ -72,7 +76,7 @@
plugin_bin.pl 改成 plugin_list.json
- class/plugin_deployment.py 文件,SetupPackage方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
- class/plugin_deployment.py 文件,__setup_php_environment方法和GetJarPath方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
- class/config.py 文件,get_nps方法内data['nps'] = False改成True,get_nps_new方法下面加上 return public.returnMsg(False, "获取问卷失败")
@ -119,7 +123,7 @@
<script src="/static/bt.js"></script>
```
在 BTPanel/templates/default/software.html 的 <script>window.vite_public_request_token
在 BTPanel/templates/default/software.html 的 \<script\>window.vite_public_request_token 前面加入
- [可选]去除创建网站自动创建的垃圾文件:在class/panelSite.py,分别删除

Loading…
Cancel
Save