mirror of
https://github.com/flucont/btcloud.git
synced 2025-02-02 09:48:13 -05:00
update
This commit is contained in:
parent
6a66f3db07
commit
1fc393c8e9
@ -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']);
|
||||
}
|
||||
}
|
@ -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{
|
||||
|
49
app/view/admin/deplist.html
Normal file
49
app/view/admin/deplist.html
Normal file
@ -0,0 +1,49 @@
|
||||
{extend name="admin/layout" /}
|
||||
{block name="title"}一键部署列表{/block}
|
||||
{block name="main"}
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-sm-12 col-md-10 col-lg-8 center-block" style="float: none;">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">一键部署列表</h3></div>
|
||||
<div class="panel-body">
|
||||
<div class="list-group">
|
||||
<div class="list-group-item list-group-item-warning">Linux面板</div>
|
||||
<div class="list-group-item" style="line-height:35px">列表文件更新时间:<font color="blue">{$deplist_linux_time}</font><a href="javascript:refresh_deplist('Linux')" class="btn btn-success pull-right"><i class="fa fa-refresh"></i>重新获取</a></div>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<div class="list-group-item list-group-item-warning">Windows面板</div>
|
||||
<div class="list-group-item" style="line-height:35px">列表文件更新时间:<font color="blue">{$deplist_win_time}</font><a href="javascript:refresh_deplist('Windows')" class="btn btn-success pull-right"><i class="fa fa-refresh"></i>重新获取</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
|
||||
<script>
|
||||
function refresh_deplist(os){
|
||||
var confirm = layer.confirm('是否确定从宝塔官方获取最新一键部署列表?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
layer.close(confirm)
|
||||
var ii = layer.msg('正在获取一键部署列表,请稍候...', {icon: 16, shade:0.1, time: 0});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : '/admin/refresh_deplist?os='+os,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii)
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon:2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii)
|
||||
layer.msg('服务器错误', {icon:2});
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirm)
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
@ -34,11 +34,12 @@
|
||||
<li class="{:checkIfActive('index')}">
|
||||
<a href="/admin"><i class="fa fa-home"></i> 后台首页</a>
|
||||
</li>
|
||||
<li class="{:checkIfActive('plugins,pluginswin')}">
|
||||
<li class="{:checkIfActive('plugins,pluginswin,deplist')}">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cubes"></i> 插件列表<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="{:checkIfActive('plugins')}"><a href="/admin/plugins">Linux面板</a></li>
|
||||
<li class="{:checkIfActive('pluginswin')}"><a href="/admin/pluginswin">Windows面板</a></li>
|
||||
<li class="{:checkIfActive('deplist')}"><a href="/admin/deplist">一键部署列表</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="{:checkIfActive('record')}">
|
||||
|
@ -160,6 +160,7 @@
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
|
||||
</div>
|
||||
<a href="javascript:cleancache()" class="btn btn-default btn-sm btn-block">清理缓存</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -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('服务器错误');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
@ -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!"
|
||||
|
||||
|
||||
|
||||
|
@ -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}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
|
||||
|
@ -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,将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user