diff --git a/app/controller/Admin.php b/app/controller/Admin.php index 5fc6322..1474da9 100644 --- a/app/controller/Admin.php +++ b/app/controller/Admin.php @@ -6,6 +6,7 @@ use app\BaseController; use think\facade\Db; use think\facade\View; use think\facade\Request; +use think\facade\Cache; use app\lib\Btapi; use app\lib\Plugins; @@ -357,4 +358,31 @@ class Admin extends BaseController } return json(['code'=>-1, 'msg'=>'no act']); } + + public function deplist(){ + $deplist_linux = get_data_dir().'config/deployment_list.json'; + $deplist_win = get_data_dir('Windows').'config/deployment_list.json'; + $deplist_linux_time = file_exists($deplist_linux) ? date("Y-m-d H:i:s", filemtime($deplist_linux)) : '不存在'; + $deplist_win_time = file_exists($deplist_win) ? date("Y-m-d H:i:s", filemtime($deplist_win)) : '不存在'; + View::assign('deplist_linux_time', $deplist_linux_time); + View::assign('deplist_win_time', $deplist_win_time); + return view(); + } + + public function refresh_deplist(){ + $os = input('get.os'); + if(!$os) $os = 'Linux'; + try{ + Plugins::refresh_deplist($os); + Db::name('log')->insert(['uid' => 0, 'action' => '刷新一键部署列表', 'data' => '刷新'.$os.'一键部署列表成功', 'addtime' => date("Y-m-d H:i:s")]); + return json(['code'=>0,'msg'=>'获取最新一键部署列表成功!']); + }catch(\Exception $e){ + return json(['code'=>-1, 'msg'=>$e->getMessage()]); + } + } + + public function cleancache(){ + Cache::clear(); + return json(['code'=>0,'msg'=>'succ']); + } } \ No newline at end of file diff --git a/app/lib/Plugins.php b/app/lib/Plugins.php index ee42e24..cc3f60a 100644 --- a/app/lib/Plugins.php +++ b/app/lib/Plugins.php @@ -48,8 +48,7 @@ class Plugins $list[] = $plugin; } $data['list'] = $list; - if($data['pro']>-1) $data['pro'] = 0; - if($data['ltd']>-1) $data['ltd'] = strtotime('+10 year'); + $data['ltd'] = strtotime('+10 year'); $json_file = get_data_dir($os).'config/plugin_list.json'; if(!file_put_contents($json_file, json_encode($data))){ throw new Exception('保存插件列表失败,文件无写入权限'); @@ -247,8 +246,9 @@ class Plugins self::download_file($btapi, $filename, $filepath); if(file_exists($filepath)){ if($filemd5 && md5_file($filepath) != $filemd5){ + $msg = filesize($filepath) < 300 ? file_get_contents($filepath) : '插件文件MD5校验失败'; @unlink($filepath); - throw new Exception('插件文件MD5校验失败'); + throw new Exception($msg); } return true; }else{ diff --git a/app/view/admin/deplist.html b/app/view/admin/deplist.html new file mode 100644 index 0000000..10d0f86 --- /dev/null +++ b/app/view/admin/deplist.html @@ -0,0 +1,49 @@ +{extend name="admin/layout" /} +{block name="title"}一键部署列表{/block} +{block name="main"} +
+
+
+

一键部署列表

+
+
+
Linux面板
+
列表文件更新时间:{$deplist_linux_time}重新获取
+
+
+
Windows面板
+
列表文件更新时间:{$deplist_win_time}重新获取
+
+
+
+ + +{/block} \ No newline at end of file diff --git a/app/view/admin/layout.html b/app/view/admin/layout.html index a01a748..b5a3c09 100644 --- a/app/view/admin/layout.html +++ b/app/view/admin/layout.html @@ -34,11 +34,12 @@
  • 后台首页
  • -
  • +
  • 插件列表
  • diff --git a/app/view/admin/set.html b/app/view/admin/set.html index 7c3a351..592c93d 100644 --- a/app/view/admin/set.html +++ b/app/view/admin/set.html @@ -160,6 +160,7 @@
    + 清理缓存
  • @@ -301,5 +302,21 @@ function saveAccount(obj){ }); return false; } +function cleancache(){ + var ii = layer.load(2, {shade:[0.1,'#fff']}); + $.ajax({ + type : 'GET', + url : '/admin/cleancache', + dataType : 'json', + success : function(data) { + layer.close(ii); + layer.msg('清理缓存成功', {icon: 1}); + }, + error:function(data){ + layer.close(ii); + layer.msg('服务器错误'); + } + }); +} {/block} \ No newline at end of file diff --git a/public/install/install_6.0.sh b/public/install/install_6.0.sh index 1a4b7ea..1426abb 100644 --- a/public/install/install_6.0.sh +++ b/public/install/install_6.0.sh @@ -184,6 +184,11 @@ get_node_url(){ echo '---------------------------------------------'; 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); + + if [ "$1" ];then + nodes=($(echo ${nodes[*]}|sed "s#${1}##")) + fi + tmp_file1=/dev/shm/net_test1.pl tmp_file2=/dev/shm/net_test2.pl [ -f "${tmp_file1}" ] && rm -f ${tmp_file1} @@ -304,6 +309,10 @@ Install_RPM_Pack(){ } Install_Deb_Pack(){ ln -sf bash /bin/sh + UBUNTU_22=$(cat /etc/issue|grep "Ubuntu 22") + if [ "${UBUNTU_22}" ];then + apt-get remove needrestart -y + fi apt-get update -y apt-get install ruby -y apt-get install lsb-release -y @@ -329,7 +338,7 @@ Install_Deb_Pack(){ for debPack in ${debPacks} do - packCheck=$(dpkg -l ${debPack}) + packCheck=$(dpkg -l|grep ${debPack}) if [ "$?" -ne "0" ] ;then apt-get install -y $debPack fi @@ -484,6 +493,10 @@ Install_Python_Lib(){ 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 10 + 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 10 + fi tmp_size=$(du -b $pyenv_file|awk '{print $1}') if [ $tmp_size -lt 703460 ];then rm -f $pyenv_file @@ -836,7 +849,14 @@ if [ "$go" == 'n' ];then exit; fi +ARCH_LINUX=$(cat /etc/os-release |grep "Arch Linux") +if [ "${ARCH_LINUX}" ] && [ -f "/usr/bin/pacman" ];then + pacman -Sy + pacman -S curl wget unzip firewalld openssl pkg-config make gcc cmake libxml2 libxslt libvpx gd libsodium oniguruma sqlite libzip autoconf inetutils sudo --noconfirm +fi + Install_Main + echo > /www/server/panel/data/bind.pl echo -e "==================================================================" echo -e "\033[32mCongratulations! Installed successfully!\033[0m" @@ -855,4 +875,3 @@ endTime=`date +%s` echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" - diff --git a/public/install/public.sh b/public/install/public.sh index 04750de..4c0e376 100644 --- a/public/install/public.sh +++ b/public/install/public.sh @@ -11,6 +11,11 @@ export LANGUAGE=en_US:en 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); + + if [ "$1" ];then + nodes=($(echo ${nodes[*]}|sed "s#${1}##")) + fi + tmp_file1=/dev/shm/net_test1.pl tmp_file2=/dev/shm/net_test2.pl [ -f "${tmp_file1}" ] && rm -f ${tmp_file1} diff --git a/public/install/src/panel6.zip b/public/install/src/panel6.zip index 7e00761..08e6df8 100644 Binary files a/public/install/src/panel6.zip and b/public/install/src/panel6.zip differ diff --git a/public/install/update/LinuxPanel-7.9.3.zip b/public/install/update/LinuxPanel-7.9.3.zip index 558a410..e08e508 100644 Binary files a/public/install/update/LinuxPanel-7.9.3.zip and b/public/install/update/LinuxPanel-7.9.3.zip differ diff --git a/route/app.php b/route/app.php index 6ff72c9..8f1b3f1 100644 --- a/route/app.php +++ b/route/app.php @@ -114,6 +114,9 @@ Route::group('admin', function () { Route::get('/list', 'admin/list'); Route::post('/list_data', 'admin/list_data'); Route::post('/list_op', 'admin/list_op'); + Route::get('/deplist', 'admin/deplist'); + Route::get('/refresh_deplist', 'admin/refresh_deplist'); + Route::get('/cleancache', 'admin/cleancache'); })->middleware(\app\middleware\CheckAdmin::class); diff --git a/wiki/update.md b/wiki/update.md index 3ab0bea..818075e 100644 --- a/wiki/update.md +++ b/wiki/update.md @@ -91,9 +91,8 @@ - [可选]关闭未绑定域名提示页面:在class/panelSite.py,root /www/server/nginx/html改成return 400 -- [可选]关闭自动生成访问日志:在 BT-Panel,WSGIServer((HOST, PORT)里面增加参数 log=None +- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行 - 在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行 解压安装包panel6.zip,将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(