mirror of
https://github.com/flucont/btcloud.git
synced 2025-10-16 15:53:56 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
50cfdaa06f | ||
![]() |
ae4ed95573 | ||
![]() |
e98206ce0c | ||
![]() |
8946b4fd11 | ||
![]() |
5bd1670955 | ||
![]() |
1fc393c8e9 |
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
网站后台管理可一键同步宝塔官方的插件列表与增量更新插件包,还有云端使用记录、IP黑白名单、操作日志、定时任务等功能。
|
网站后台管理可一键同步宝塔官方的插件列表与增量更新插件包,还有云端使用记录、IP黑白名单、操作日志、定时任务等功能。
|
||||||
|
|
||||||
本项目自带的宝塔安装包和更新包是7.9.3最新版,已修改适配此第三方云端,并且全开源,无so等加密文件。
|
本项目自带的宝塔安装包和更新包是7.9.5最新版,已修改适配此第三方云端,并且全开源,无so等加密文件。
|
||||||
|
|
||||||
觉得该项目不错的可以给个Star~
|
觉得该项目不错的可以给个Star~
|
||||||
|
|
||||||
|
115
app/command/DecryptFile.php
Normal file
115
app/command/DecryptFile.php
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<?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 DecryptFile extends Command
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this->setName('decrypt')
|
||||||
|
->addArgument('type', Argument::REQUIRED, '文件类型,plugin:插件文件,module:模块文件,classdir:宝塔class目录,all:所有py文件')
|
||||||
|
->addArgument('file', Argument::REQUIRED, '文件路径')
|
||||||
|
->addArgument('os', Argument::OPTIONAL, '操作系统:Windows/Linux')
|
||||||
|
->setDescription('解密宝塔面板python文件');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(Input $input, Output $output)
|
||||||
|
{
|
||||||
|
$type = trim($input->getArgument('type'));
|
||||||
|
$file = trim($input->getArgument('file'));
|
||||||
|
|
||||||
|
if(!file_exists($file)){
|
||||||
|
$output->writeln('文件不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 'plugin'){
|
||||||
|
$os = trim($input->getArgument('os'));
|
||||||
|
try{
|
||||||
|
if(Plugins::decode_plugin_main_local($file, $os)){
|
||||||
|
$output->writeln('文件解密成功!');
|
||||||
|
}else{
|
||||||
|
$output->writeln('文件解密失败!');
|
||||||
|
}
|
||||||
|
}catch(\Exception $e){
|
||||||
|
$output->writeln($e->getMessage());
|
||||||
|
}
|
||||||
|
}elseif($type == 'module'){
|
||||||
|
try{
|
||||||
|
$res = Plugins::decode_module_file($file);
|
||||||
|
if($res == 2){
|
||||||
|
$output->writeln('文件解密失败!');
|
||||||
|
}elseif($res == 1){
|
||||||
|
$output->writeln('文件解密成功!');
|
||||||
|
}
|
||||||
|
}catch(\Exception $e){
|
||||||
|
$output->writeln($e->getMessage());
|
||||||
|
}
|
||||||
|
}elseif($type == 'classdir'){
|
||||||
|
$file = rtrim($file, '/');
|
||||||
|
if(!file_exists($file.'/common.py')){
|
||||||
|
$output->writeln('当前路径非宝塔面板class目录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$dirs = glob($file.'/*Model');
|
||||||
|
foreach($dirs as $dir){
|
||||||
|
if(!is_dir($dir))continue;
|
||||||
|
$files = glob($dir.'/*Model.py');
|
||||||
|
foreach($files as $file){
|
||||||
|
try{
|
||||||
|
$res = Plugins::decode_module_file($file);
|
||||||
|
if($res == 2){
|
||||||
|
$output->writeln('文件解密失败:'.$file);
|
||||||
|
}elseif($res == 1){
|
||||||
|
$output->writeln('文件解密成功:'.$file);
|
||||||
|
}
|
||||||
|
}catch(\Exception $e){
|
||||||
|
$output->writeln($e->getMessage().':'.$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}elseif($type == 'all'){
|
||||||
|
$file = rtrim($file, '/');
|
||||||
|
$this->scan_all_file($input, $output, $file);
|
||||||
|
}else{
|
||||||
|
$output->writeln('未知文件类型');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function scan_all_file(Input $input, Output $output, $path) {
|
||||||
|
$dir = opendir($path);
|
||||||
|
while(false !== ( $file = readdir($dir)) ) {
|
||||||
|
if (( $file != '.' ) && ( $file != '..' )) {
|
||||||
|
$filepath = $path . '/' . $file;
|
||||||
|
if ( is_dir($filepath) ) {
|
||||||
|
$this->scan_all_file($input, $output, $filepath);
|
||||||
|
}
|
||||||
|
elseif(substr($filepath, -3) == '.py') {
|
||||||
|
try{
|
||||||
|
$res = Plugins::decode_module_file($filepath);
|
||||||
|
if($res == 2){
|
||||||
|
$output->writeln('文件解密失败:'.$filepath);
|
||||||
|
}elseif($res == 1){
|
||||||
|
$output->writeln('文件解密成功:'.$filepath);
|
||||||
|
}
|
||||||
|
}catch(\Exception $e){
|
||||||
|
$output->writeln($e->getMessage().':'.$filepath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -6,6 +6,7 @@ use app\BaseController;
|
|||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
|
use think\facade\Cache;
|
||||||
use app\lib\Btapi;
|
use app\lib\Btapi;
|
||||||
use app\lib\Plugins;
|
use app\lib\Plugins;
|
||||||
|
|
||||||
@@ -357,4 +358,31 @@ class Admin extends BaseController
|
|||||||
}
|
}
|
||||||
return json(['code'=>-1, 'msg'=>'no act']);
|
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']);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -272,6 +272,12 @@ class Api extends BaseController
|
|||||||
return json($json_arr);
|
return json($json_arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取宝塔SSL列表
|
||||||
|
public function get_ssl_list(){
|
||||||
|
$data = bin2hex('[]');
|
||||||
|
return json(['status'=>true, 'msg'=>'', 'data'=>$data]);
|
||||||
|
}
|
||||||
|
|
||||||
public function return_success(){
|
public function return_success(){
|
||||||
return json(['status'=>true, 'msg'=>1, 'data'=>(object)[]]);
|
return json(['status'=>true, 'msg'=>1, 'data'=>(object)[]]);
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,8 @@ class Install extends BaseController
|
|||||||
$sqls=file_get_contents(app()->getRootPath().'install.sql');
|
$sqls=file_get_contents(app()->getRootPath().'install.sql');
|
||||||
$sqls=explode(';', $sqls);
|
$sqls=explode(';', $sqls);
|
||||||
$sqls[]="REPLACE INTO `".$mysql_prefix."config` VALUES ('syskey', '".random(16)."')";
|
$sqls[]="REPLACE INTO `".$mysql_prefix."config` VALUES ('syskey', '".random(16)."')";
|
||||||
|
$sqls[]="REPLACE INTO `".$mysql_prefix."config` VALUES ('admin_username', '".addslashes($admin_username)."')";
|
||||||
|
$sqls[]="REPLACE INTO `".$mysql_prefix."config` VALUES ('admin_password', '".addslashes($admin_password)."')";
|
||||||
$success=0;$error=0;$errorMsg=null;
|
$success=0;$error=0;$errorMsg=null;
|
||||||
foreach ($sqls as $value) {
|
foreach ($sqls as $value) {
|
||||||
$value=trim($value);
|
$value=trim($value);
|
||||||
|
@@ -48,8 +48,7 @@ class Plugins
|
|||||||
$list[] = $plugin;
|
$list[] = $plugin;
|
||||||
}
|
}
|
||||||
$data['list'] = $list;
|
$data['list'] = $list;
|
||||||
if($data['pro']>-1) $data['pro'] = 0;
|
$data['ltd'] = strtotime('+10 year');
|
||||||
if($data['ltd']>-1) $data['ltd'] = strtotime('+10 year');
|
|
||||||
$json_file = get_data_dir($os).'config/plugin_list.json';
|
$json_file = get_data_dir($os).'config/plugin_list.json';
|
||||||
if(!file_put_contents($json_file, json_encode($data))){
|
if(!file_put_contents($json_file, json_encode($data))){
|
||||||
throw new Exception('保存插件列表失败,文件无写入权限');
|
throw new Exception('保存插件列表失败,文件无写入权限');
|
||||||
@@ -188,6 +187,8 @@ class Plugins
|
|||||||
$userinfo = $btapi->get_user_info();
|
$userinfo = $btapi->get_user_info();
|
||||||
if(isset($userinfo['uid'])){
|
if(isset($userinfo['uid'])){
|
||||||
$src = file_get_contents($main_filepath);
|
$src = file_get_contents($main_filepath);
|
||||||
|
if($src===false)throw new Exception('文件打开失败');
|
||||||
|
if(!$src || strpos($src, 'import ')!==false)return true;
|
||||||
$uid = $userinfo['uid'];
|
$uid = $userinfo['uid'];
|
||||||
$serverid = $userinfo['serverid'];
|
$serverid = $userinfo['serverid'];
|
||||||
$key = md5(substr($serverid, 10, 16).$uid.$serverid);
|
$key = md5(substr($serverid, 10, 16).$uid.$serverid);
|
||||||
@@ -203,7 +204,7 @@ class Plugins
|
|||||||
if($tmp) $de_text .= $tmp;
|
if($tmp) $de_text .= $tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!empty($de_text)){
|
if(!empty($de_text) && strpos($de_text, 'import ')!==false){
|
||||||
file_put_contents($main_filepath, $de_text);
|
file_put_contents($main_filepath, $de_text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -213,6 +214,28 @@ class Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function decode_module_file($filepath){
|
||||||
|
$src = file_get_contents($filepath);
|
||||||
|
if($src===false)throw new Exception('文件打开失败');
|
||||||
|
if(!$src || strpos($src, 'import ')!==false)return 0;
|
||||||
|
$key = 'Z2B87NEAS2BkxTrh';
|
||||||
|
$iv = 'WwadH66EGWpeeTT6';
|
||||||
|
$data_arr = explode("\n", $src);
|
||||||
|
$de_text = '';
|
||||||
|
foreach($data_arr as $data){
|
||||||
|
$data = trim($data);
|
||||||
|
if(!empty($data)){
|
||||||
|
$tmp = openssl_decrypt($data, 'aes-128-cbc', $key, 0, $iv);
|
||||||
|
if($tmp) $de_text .= $tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!empty($de_text) && strpos($de_text, 'import ')!==false){
|
||||||
|
file_put_contents($filepath, $de_text);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
//去除插件主程序文件授权校验
|
//去除插件主程序文件授权校验
|
||||||
public static function noauth_plugin_main($main_filepath){
|
public static function noauth_plugin_main($main_filepath){
|
||||||
$data = file_get_contents($main_filepath);
|
$data = file_get_contents($main_filepath);
|
||||||
@@ -247,8 +270,9 @@ class Plugins
|
|||||||
self::download_file($btapi, $filename, $filepath);
|
self::download_file($btapi, $filename, $filepath);
|
||||||
if(file_exists($filepath)){
|
if(file_exists($filepath)){
|
||||||
if($filemd5 && md5_file($filepath) != $filemd5){
|
if($filemd5 && md5_file($filepath) != $filemd5){
|
||||||
|
$msg = filesize($filepath) < 300 ? file_get_contents($filepath) : '插件文件MD5校验失败';
|
||||||
@unlink($filepath);
|
@unlink($filepath);
|
||||||
throw new Exception('插件文件MD5校验失败');
|
throw new Exception($msg);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
Linux_Version="7.9.3"
|
Linux_Version="7.9.5"
|
||||||
Windows_Version="7.6.0"
|
Windows_Version="7.7.0"
|
||||||
|
|
||||||
FILES=(
|
FILES=(
|
||||||
public/install/src/panel6.zip
|
public/install/src/panel6.zip
|
||||||
|
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}
|
@@ -2,6 +2,7 @@
|
|||||||
{block name="title"}宝塔第三方云端管理中心{/block}
|
{block name="title"}宝塔第三方云端管理中心{/block}
|
||||||
{block name="main"}
|
{block name="main"}
|
||||||
<style>
|
<style>
|
||||||
|
.table>tbody>tr>td{white-space: normal;}
|
||||||
.query-title {
|
.query-title {
|
||||||
background-color:#f5fafe;
|
background-color:#f5fafe;
|
||||||
word-break: keep-all;
|
word-break: keep-all;
|
||||||
|
@@ -34,11 +34,12 @@
|
|||||||
<li class="{:checkIfActive('index')}">
|
<li class="{:checkIfActive('index')}">
|
||||||
<a href="/admin"><i class="fa fa-home"></i> 后台首页</a>
|
<a href="/admin"><i class="fa fa-home"></i> 后台首页</a>
|
||||||
</li>
|
</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>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cubes"></i> 插件列表<b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li class="{:checkIfActive('plugins')}"><a href="/admin/plugins">Linux面板</a></li>
|
<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('pluginswin')}"><a href="/admin/pluginswin">Windows面板</a></li>
|
||||||
|
<li class="{:checkIfActive('deplist')}"><a href="/admin/deplist">一键部署列表</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="{:checkIfActive('record')}">
|
<li class="{:checkIfActive('record')}">
|
||||||
|
@@ -70,12 +70,14 @@ function submitlogin(){
|
|||||||
var pass = $("input[name='pass']").val();
|
var pass = $("input[name='pass']").val();
|
||||||
var code = $("input[name='code']").val();
|
var code = $("input[name='code']").val();
|
||||||
if(user=='' || pass==''){layer.alert('用户名或密码不能为空!');return false;}
|
if(user=='' || pass==''){layer.alert('用户名或密码不能为空!');return false;}
|
||||||
$.ajax({
|
var ii = layer.load(2);
|
||||||
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : '{:request()->url()}',
|
url : '{:request()->url()}',
|
||||||
data: {username:user, password:pass, code:code},
|
data: {username:user, password:pass, code:code},
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
|
layer.close(ii);
|
||||||
if(data.code == 0){
|
if(data.code == 0){
|
||||||
layer.msg('登录成功,正在跳转', {icon: 1,shade: 0.01,time: 15000});
|
layer.msg('登录成功,正在跳转', {icon: 1,shade: 0.01,time: 15000});
|
||||||
window.location.href='/admin';
|
window.location.href='/admin';
|
||||||
@@ -87,6 +89,7 @@ function submitlogin(){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error:function(data){
|
error:function(data){
|
||||||
|
layer.close(ii);
|
||||||
layer.msg('服务器错误');
|
layer.msg('服务器错误');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -160,6 +160,7 @@
|
|||||||
<div class="form-group text-center">
|
<div class="form-group text-center">
|
||||||
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
|
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
|
||||||
</div>
|
</div>
|
||||||
|
<a href="javascript:cleancache()" class="btn btn-default btn-sm btn-block">清理缓存</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -301,5 +302,21 @@ function saveAccount(obj){
|
|||||||
});
|
});
|
||||||
return false;
|
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>
|
</script>
|
||||||
{/block}
|
{/block}
|
@@ -6,5 +6,6 @@ return [
|
|||||||
// 指令定义
|
// 指令定义
|
||||||
'commands' => [
|
'commands' => [
|
||||||
'updateall' => 'app\command\UpdateAll',
|
'updateall' => 'app\command\UpdateAll',
|
||||||
|
'decrypt' => 'app\command\DecryptFile',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
0
data/plugins/folder/.gitkeep
Normal file
0
data/plugins/folder/.gitkeep
Normal file
0
data/plugins/main/.gitkeep
Normal file
0
data/plugins/main/.gitkeep
Normal file
0
data/plugins/other/other/.gitkeep
Normal file
0
data/plugins/other/other/.gitkeep
Normal file
0
data/plugins/package/.gitkeep
Normal file
0
data/plugins/package/.gitkeep
Normal file
0
data/win/plugins/folder/.gitkeep
Normal file
0
data/win/plugins/folder/.gitkeep
Normal file
0
data/win/plugins/main/.gitkeep
Normal file
0
data/win/plugins/main/.gitkeep
Normal file
0
data/win/plugins/package/.gitkeep
Normal file
0
data/win/plugins/package/.gitkeep
Normal file
@@ -12,12 +12,12 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
|
|||||||
('bt_key', ''),
|
('bt_key', ''),
|
||||||
('whitelist', '0'),
|
('whitelist', '0'),
|
||||||
('download_page', '1'),
|
('download_page', '1'),
|
||||||
('new_version', '7.9.3'),
|
('new_version', '7.9.5'),
|
||||||
('update_msg', '暂无更新日志'),
|
('update_msg', '暂无更新日志'),
|
||||||
('update_date', '2022-07-13'),
|
('update_date', '2022-11-02'),
|
||||||
('new_version_win', '7.6.0'),
|
('new_version_win', '7.7.0'),
|
||||||
('update_msg_win', '暂无更新日志'),
|
('update_msg_win', '暂无更新日志'),
|
||||||
('update_date_win', '2022-06-01'),
|
('update_date_win', '2022-09-09'),
|
||||||
('updateall_type', '0'),
|
('updateall_type', '0'),
|
||||||
('syskey', 'UqP94LtI8eWAIgCP');
|
('syskey', 'UqP94LtI8eWAIgCP');
|
||||||
|
|
||||||
|
@@ -184,6 +184,11 @@ get_node_url(){
|
|||||||
echo '---------------------------------------------';
|
echo '---------------------------------------------';
|
||||||
echo "Selected download node...";
|
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);
|
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_file1=/dev/shm/net_test1.pl
|
||||||
tmp_file2=/dev/shm/net_test2.pl
|
tmp_file2=/dev/shm/net_test2.pl
|
||||||
[ -f "${tmp_file1}" ] && rm -f ${tmp_file1}
|
[ -f "${tmp_file1}" ] && rm -f ${tmp_file1}
|
||||||
@@ -282,7 +287,7 @@ Install_RPM_Pack(){
|
|||||||
|
|
||||||
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
|
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
|
||||||
#yum remove -y python-requests python3-requests python-greenlet python3-greenlet
|
#yum remove -y python-requests python3-requests python-greenlet python3-greenlet
|
||||||
yumPacks="libcurl-devel wget tar gcc make zip unzip openssl openssl-devel gcc libxml2 libxml2-devel libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares libffi-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel"
|
yumPacks="libcurl-devel wget tar gcc make zip unzip openssl openssl-devel gcc libxml2 libxml2-devel libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares libffi-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel qrencode"
|
||||||
yum install -y ${yumPacks}
|
yum install -y ${yumPacks}
|
||||||
|
|
||||||
for yumPack in ${yumPacks}
|
for yumPack in ${yumPacks}
|
||||||
@@ -304,7 +309,19 @@ Install_RPM_Pack(){
|
|||||||
}
|
}
|
||||||
Install_Deb_Pack(){
|
Install_Deb_Pack(){
|
||||||
ln -sf bash /bin/sh
|
ln -sf bash /bin/sh
|
||||||
|
UBUNTU_22=$(cat /etc/issue|grep "Ubuntu 22")
|
||||||
|
if [ "${UBUNTU_22}" ];then
|
||||||
|
apt-get remove needrestart -y
|
||||||
|
fi
|
||||||
|
ALIYUN_CHECK=$(cat /etc/motd|grep "Alibaba Cloud ")
|
||||||
|
if [ "${ALIYUN_CHECK}" ] && [ "${UBUNTU_22}" ];then
|
||||||
|
apt-get remove libicu70 -y
|
||||||
|
fi
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
apt-get install bash -y
|
||||||
|
if [ -f "/usr/bin/bash" ];then
|
||||||
|
ln -sf /usr/bin/bash /bin/sh
|
||||||
|
fi
|
||||||
apt-get install ruby -y
|
apt-get install ruby -y
|
||||||
apt-get install lsb-release -y
|
apt-get install lsb-release -y
|
||||||
#apt-get install ntp ntpdate -y
|
#apt-get install ntp ntpdate -y
|
||||||
@@ -324,12 +341,12 @@ Install_Deb_Pack(){
|
|||||||
apt-get install curl -y
|
apt-get install curl -y
|
||||||
fi
|
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";
|
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";
|
||||||
apt-get install -y $debPacks --force-yes
|
apt-get install -y $debPacks --force-yes
|
||||||
|
|
||||||
for debPack in ${debPacks}
|
for debPack in ${debPacks}
|
||||||
do
|
do
|
||||||
packCheck=$(dpkg -l ${debPack})
|
packCheck=$(dpkg -l|grep ${debPack})
|
||||||
if [ "$?" -ne "0" ] ;then
|
if [ "$?" -ne "0" ] ;then
|
||||||
apt-get install -y $debPack
|
apt-get install -y $debPack
|
||||||
fi
|
fi
|
||||||
@@ -484,6 +501,10 @@ Install_Python_Lib(){
|
|||||||
if [ "${os_version}" != "" ];then
|
if [ "${os_version}" != "" ];then
|
||||||
pyenv_file="/www/pyenv.tar.gz"
|
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
|
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}')
|
tmp_size=$(du -b $pyenv_file|awk '{print $1}')
|
||||||
if [ $tmp_size -lt 703460 ];then
|
if [ $tmp_size -lt 703460 ];then
|
||||||
rm -f $pyenv_file
|
rm -f $pyenv_file
|
||||||
@@ -555,7 +576,7 @@ Install_Bt(){
|
|||||||
if [ -f ${setup_path}/server/panel/data/port.pl ];then
|
if [ -f ${setup_path}/server/panel/data/port.pl ];then
|
||||||
panelPort=$(cat ${setup_path}/server/panel/data/port.pl)
|
panelPort=$(cat ${setup_path}/server/panel/data/port.pl)
|
||||||
else
|
else
|
||||||
RE_NUM=$(expr $RANDOM % 5)
|
RE_NUM=$(expr $RANDOM % 3)
|
||||||
if [ "${RE_NUM}" == "1" ];then
|
if [ "${RE_NUM}" == "1" ];then
|
||||||
panelPort=$(expr $RANDOM % 55535 + 10000)
|
panelPort=$(expr $RANDOM % 55535 + 10000)
|
||||||
fi
|
fi
|
||||||
@@ -660,6 +681,8 @@ Set_Bt_Panel(){
|
|||||||
echo "/${auth_path}" > ${admin_auth}
|
echo "/${auth_path}" > ${admin_auth}
|
||||||
fi
|
fi
|
||||||
chmod -R 700 $pyenv_path/pyenv/bin
|
chmod -R 700 $pyenv_path/pyenv/bin
|
||||||
|
/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 -U
|
||||||
/www/server/panel/pyenv/bin/pip3 install flask-sock
|
/www/server/panel/pyenv/bin/pip3 install flask-sock
|
||||||
auth_path=$(cat ${admin_auth})
|
auth_path=$(cat ${admin_auth})
|
||||||
@@ -826,6 +849,8 @@ echo "
|
|||||||
+----------------------------------------------------------------------
|
+----------------------------------------------------------------------
|
||||||
| The WebPanel URL will be http://SERVER_IP:8888 when installed.
|
| The WebPanel URL will be http://SERVER_IP:8888 when installed.
|
||||||
+----------------------------------------------------------------------
|
+----------------------------------------------------------------------
|
||||||
|
| 为了您的正常使用,请确保使用全新或纯净的系统安装宝塔面板,不支持已部署项目/环境的系统安装
|
||||||
|
+----------------------------------------------------------------------
|
||||||
"
|
"
|
||||||
while [ "$go" != 'y' ] && [ "$go" != 'n' ]
|
while [ "$go" != 'y' ] && [ "$go" != 'n' ]
|
||||||
do
|
do
|
||||||
@@ -836,7 +861,14 @@ if [ "$go" == 'n' ];then
|
|||||||
exit;
|
exit;
|
||||||
fi
|
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
|
Install_Main
|
||||||
|
|
||||||
echo > /www/server/panel/data/bind.pl
|
echo > /www/server/panel/data/bind.pl
|
||||||
echo -e "=================================================================="
|
echo -e "=================================================================="
|
||||||
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
|
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
|
||||||
@@ -854,5 +886,3 @@ endTime=`date +%s`
|
|||||||
((outTime=($endTime-$startTime)/60))
|
((outTime=($endTime-$startTime)/60))
|
||||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -11,6 +11,11 @@ export LANGUAGE=en_US:en
|
|||||||
|
|
||||||
get_node_url(){
|
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);
|
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_file1=/dev/shm/net_test1.pl
|
||||||
tmp_file2=/dev/shm/net_test2.pl
|
tmp_file2=/dev/shm/net_test2.pl
|
||||||
[ -f "${tmp_file1}" ] && rm -f ${tmp_file1}
|
[ -f "${tmp_file1}" ] && rm -f ${tmp_file1}
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -42,7 +42,7 @@ download_Url=$NODE_URL
|
|||||||
setup_path=/www
|
setup_path=/www
|
||||||
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
|
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
|
||||||
if [ "$version" = '' ];then
|
if [ "$version" = '' ];then
|
||||||
version='7.9.3'
|
version='7.9.5'
|
||||||
fi
|
fi
|
||||||
armCheck=$(uname -m|grep arm)
|
armCheck=$(uname -m|grep arm)
|
||||||
if [ "${armCheck}" ];then
|
if [ "${armCheck}" ];then
|
||||||
|
@@ -70,7 +70,7 @@ select_node(){
|
|||||||
get_version(){
|
get_version(){
|
||||||
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
|
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
|
||||||
if [ "$version" = '' ];then
|
if [ "$version" = '' ];then
|
||||||
version='7.9.3'
|
version='7.9.5'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -36,6 +36,9 @@ Route::group('api', function () {
|
|||||||
Route::get('/getIpAddress', 'api/get_ip_address');
|
Route::get('/getIpAddress', 'api/get_ip_address');
|
||||||
Route::post('/Auth/GetAuthToken', 'api/get_auth_token');
|
Route::post('/Auth/GetAuthToken', 'api/get_auth_token');
|
||||||
Route::post('/Auth/GetBindCode', 'api/return_error');
|
Route::post('/Auth/GetBindCode', 'api/return_error');
|
||||||
|
Route::post('/Auth/GetSSLList', 'api/get_ssl_list');
|
||||||
|
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('/Pluginother/get_file', 'api/download_plugin_other');
|
||||||
|
|
||||||
Route::post('/Pluginother/create_order', 'api/return_error');
|
Route::post('/Pluginother/create_order', 'api/return_error');
|
||||||
@@ -114,6 +117,9 @@ Route::group('admin', function () {
|
|||||||
Route::get('/list', 'admin/list');
|
Route::get('/list', 'admin/list');
|
||||||
Route::post('/list_data', 'admin/list_data');
|
Route::post('/list_data', 'admin/list_data');
|
||||||
Route::post('/list_op', 'admin/list_op');
|
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);
|
})->middleware(\app\middleware\CheckAdmin::class);
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@ def get_auth_state():
|
|||||||
#执行插件方法(插件名,方法名,参数)
|
#执行插件方法(插件名,方法名,参数)
|
||||||
def plugin_run(plugin_name, def_name, args):
|
def plugin_run(plugin_name, def_name, args):
|
||||||
if not plugin_name or not def_name: return public.returnMsg(False,'插件名称和插件方法名称不能为空!')
|
if not plugin_name or not def_name: return public.returnMsg(False,'插件名称和插件方法名称不能为空!')
|
||||||
|
if not path_check(plugin_name) or not path_check(def_name): return public.returnMsg(False,'插件名或方法名不能包含特殊符号!')
|
||||||
p_path = public.get_plugin_path(plugin_name)
|
p_path = public.get_plugin_path(plugin_name)
|
||||||
if not os.path.exists(p_path + '/index.php') and not os.path.exists(p_path + '/%s_main.py' % plugin_name): return public.returnMsg(False,'插件不存在!')
|
if not os.path.exists(p_path + '/index.php') and not os.path.exists(p_path + '/%s_main.py' % plugin_name): return public.returnMsg(False,'插件不存在!')
|
||||||
|
|
||||||
@@ -73,12 +74,21 @@ def plugin_run(plugin_name, def_name, args):
|
|||||||
#执行模块方法(模块名,方法名,参数)
|
#执行模块方法(模块名,方法名,参数)
|
||||||
def module_run(mod_name, def_name, args):
|
def module_run(mod_name, def_name, args):
|
||||||
if not mod_name or not def_name: return public.returnMsg(False,'模块名称和模块方法名称不能为空!')
|
if not mod_name or not def_name: return public.returnMsg(False,'模块名称和模块方法名称不能为空!')
|
||||||
|
if not path_check(mod_name) or not path_check(def_name): return public.returnMsg(False,'模块名或方法名不能包含特殊符号!')
|
||||||
|
|
||||||
|
if 'model_index' in args:
|
||||||
|
if args.model_index:
|
||||||
|
mod_file = "{}/{}Model/{}Model.py".format(public.get_class_path(),args.model_index,mod_name)
|
||||||
|
else:
|
||||||
|
mod_file = "{}/projectModel/{}Model.py".format(public.get_class_path(),mod_name)
|
||||||
|
else:
|
||||||
|
module_list = get_module_list()
|
||||||
|
for module_dir in module_list:
|
||||||
|
mod_file = "{}/{}/{}Model.py".format(public.get_class_path(),module_dir,mod_name)
|
||||||
|
if os.path.exists(mod_file): break
|
||||||
|
|
||||||
mod_file = "{}/projectModel/{}Model.py".format(public.get_class_path(),mod_name)
|
|
||||||
if not os.path.exists(mod_file):
|
if not os.path.exists(mod_file):
|
||||||
mod_file = "{}/databaseModel/{}Model.py".format(public.get_class_path(),mod_name)
|
return public.returnMsg(False,'模块[%s]不存在' % mod_name)
|
||||||
if not os.path.exists(mod_file):
|
|
||||||
return public.returnMsg(False,'模块[%s]不存在' % mod_name)
|
|
||||||
|
|
||||||
def_object = public.get_script_object(mod_file)
|
def_object = public.get_script_object(mod_file)
|
||||||
if not def_object: return public.returnMsg(False,'模块[%s]不存在!' % mod_name)
|
if not def_object: return public.returnMsg(False,'模块[%s]不存在!' % mod_name)
|
||||||
@@ -92,3 +102,21 @@ def module_run(mod_name, def_name, args):
|
|||||||
result = run_object(args)
|
result = run_object(args)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
#获取模块文件夹列表
|
||||||
|
def get_module_list():
|
||||||
|
list = []
|
||||||
|
class_path = public.get_class_path()
|
||||||
|
f_list = os.listdir(class_path)
|
||||||
|
for fname in f_list:
|
||||||
|
f_path = class_path+'/'+fname
|
||||||
|
if os.path.isdir(f_path) and len(fname) > 6 and fname.find('.') == -1 and fname.find('Model') != -1:
|
||||||
|
list.append(fname)
|
||||||
|
return list
|
||||||
|
|
||||||
|
#检查路径是否合法
|
||||||
|
def path_check(path):
|
||||||
|
list = ["./","..",",",";",":","?","'","\"","<",">","|","\\","\n","\r","\t","\b","\a","\f","\v","*","%","&","$","#","@","!","~","`","^","(",")","+","=","{","}","[","]"]
|
||||||
|
for i in path:
|
||||||
|
if i in list:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
363
wiki/files/bt.js
363
wiki/files/bt.js
@@ -39,86 +39,231 @@ if("undefined" != typeof bt && bt.hasOwnProperty("prompt_confirm")){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if("undefined" != typeof database && database.hasOwnProperty("del_database")){
|
if("undefined" != typeof database && database.hasOwnProperty("del_database")){
|
||||||
database.del_database = function (wid, dbname,obj, callback) {
|
database.del_database = function (wid, dbname, obj, callback) {
|
||||||
title = '',
|
var is_db_type = false, del_data = []
|
||||||
tips = '是否确认【删除数据库】,删除后可能会影响业务使用!';
|
if (typeof wid === 'object') {
|
||||||
if(obj && obj.db_type > 0) tips = '远程数据库不支持数据库回收站,删除后将无法恢复,请谨慎操作';
|
del_data = wid
|
||||||
var title = typeof dbname === "function" ?'批量删除数据库':'删除数据库 [ '+ dbname +' ]';
|
is_db_type = wid.some(function (item) {
|
||||||
layer.open({
|
return item.db_type > 0
|
||||||
type:1,
|
})
|
||||||
title:title,
|
var ids = [];
|
||||||
icon:0,
|
for (var i = 0; i < wid.length; i++) {
|
||||||
skin:'delete_site_layer',
|
ids.push(wid[i].id);
|
||||||
area: "530px",
|
}
|
||||||
closeBtn: 2,
|
wid = ids
|
||||||
shadeClose: true,
|
}
|
||||||
content:"<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
var type = $('.database-pos .tabs-item.active').data('type'),
|
||||||
"<i class=\'layui-layer-ico layui-layer-ico0\'></i>" +
|
title = '',
|
||||||
"<div class=\'f13 check_title\' style=\'margin-bottom: 20px;\'>"+tips+"</div>" +
|
tips = '';
|
||||||
"<div style=\'color:red;margin:18px 0 18px 18px;font-size:14px;font-weight: bold;\'>注意:数据无价,请谨慎操作!!!"+(!recycle_bin_db_open?'<br>风险操作:当前数据库回收站未开启,删除数据库将永久消失!':'')+"</div>" +
|
title = typeof dbname === "function" ? '批量删除数据库' : '删除数据库 - [ ' + dbname + ' ]';
|
||||||
"</div>",
|
tips = is_db_type || !recycle_bin_db_open || type !== 'mysql' ? '<span class="color-red">当前列表存在彻底删除后无法恢复的数据库</span>,请仔细查看列表,以防误删,是否继续操作?' : '当前列表数据库将迁移至数据库回收站,如需彻底删除请前往数据库回收站,是否继续操作?'
|
||||||
btn:[lan.public.ok,lan.public.cancel],
|
var arrs = wid instanceof Array ? wid : [wid]
|
||||||
yes:function(indexs){
|
var ids = JSON.stringify(arrs),
|
||||||
var data = {id: wid,name: dbname};
|
countDown = 9;
|
||||||
if(typeof dbname === "function"){
|
if (arrs.length == 1) countDown = 4
|
||||||
delete data.id;
|
var loadT = bt.load('正在检测数据库数据信息,请稍候...'),
|
||||||
delete data.name;
|
param = { url: 'database/' + bt.data.db_tab_name + '/check_del_data', data: { data: JSON.stringify({ ids: ids }) } }
|
||||||
}
|
if (bt.data.db_tab_name == 'mysql') param = { url: 'database?action=check_del_data', data: { ids: ids } }
|
||||||
layer.close(indexs)
|
bt_tools.send(param, function (res) {
|
||||||
if(typeof dbname === "function"){
|
loadT.close()
|
||||||
dbname(data)
|
layer.open({
|
||||||
}else{
|
type: 1,
|
||||||
bt.database.del_database(data, function (rdata) {
|
title: title,
|
||||||
layer.closeAll()
|
area: '740px',
|
||||||
if (callback) callback(rdata);
|
skin: 'verify_site_layer_info',
|
||||||
bt.msg(rdata);
|
closeBtn: 2,
|
||||||
|
shadeClose: true,
|
||||||
|
content: '<div class="check_delete_site_main hint_confirm pd30">' +
|
||||||
|
"<div class='hint_title'>\
|
||||||
|
<i class=\'hint-confirm-icon\'></i>\
|
||||||
|
<div class=\'hint_con\'>"+ tips + "</div>\
|
||||||
|
</div>"+
|
||||||
|
'<div id="check_layer_content" class="ptb15">' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="check_layer_message">' +
|
||||||
|
(is_db_type ? '<span class="color-red">注意:远程数据库暂不支持数据库回收站,选中的数据库将彻底删除</span><br>' : '') +
|
||||||
|
(!recycle_bin_db_open ? '<span class="color-red">风险操作:当前数据库回收站未开启,删除数据库将永久消失</span><br>' : '')
|
||||||
|
+ '<span class="color-red">请仔细阅读以上要删除信息,防止数据库被误删</span></div>' +
|
||||||
|
'</div>',
|
||||||
|
btn: ['下一步', lan.public.cancel],
|
||||||
|
success: function (layers) {
|
||||||
|
setTimeout(function () { $(layers).css('top', ($(window).height() - $(layers).height()) / 2); }, 50)
|
||||||
|
var rdata = res.data,
|
||||||
|
newTime = parseInt(new Date().getTime() / 1000),
|
||||||
|
t_icon = ' <span class="glyphicon glyphicon-info-sign" style="color: red;width:15px;height: 15px;;vertical-align: middle;"></span>';
|
||||||
|
for (var j = 0; j < rdata.length; j++) {
|
||||||
|
for (var i = 0; i < del_data.length; i++) {
|
||||||
|
if (rdata[j].id == del_data[i].id) {
|
||||||
|
var is_time_rule = (newTime - rdata[j].st_time) > (86400 * 30) && (rdata[j].total > 1024 * 10),
|
||||||
|
is_database_rule = res.db_size <= rdata[j].total,
|
||||||
|
database_time = bt.format_data(rdata[j].st_time, 'yyyy-MM-dd'),
|
||||||
|
database_size = bt.format_size(rdata[j].total);
|
||||||
|
var f_size = database_size
|
||||||
|
var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
||||||
|
if (rdata[j].total < 2048) t_size = '注意事项:当前数据库不为空,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
||||||
|
if (rdata[j].total === 0) t_size = '';
|
||||||
|
rdata[j]['t_size'] = t_size
|
||||||
|
rdata[j]['f_size'] = f_size
|
||||||
|
rdata[j]['database_time'] = database_time
|
||||||
|
rdata[j]['is_time_rule'] = is_time_rule
|
||||||
|
rdata[j]['is_database_rule'] = is_database_rule
|
||||||
|
rdata[j]['db_type'] = del_data[i].db_type
|
||||||
|
rdata[j]['conn_config'] = del_data[i].conn_config
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var filterData = rdata.filter(function (el) {
|
||||||
|
return ids.indexOf(el.id) != -1
|
||||||
|
})
|
||||||
|
bt_tools.table({
|
||||||
|
el: '#check_layer_content',
|
||||||
|
data: filterData,
|
||||||
|
height: '300px',
|
||||||
|
column: [
|
||||||
|
{ fid: 'name', title: '数据库名称' },
|
||||||
|
{
|
||||||
|
title: '数据库大小', template: function (row) {
|
||||||
|
return '<span class="' + (row.is_database_rule ? 'warning' : '') + '" style="width: 110px;" title="' + row.t_size + '">' + row.f_size + (row.is_database_rule ? t_icon : '') + '</span>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据库位置', template: function (row) {
|
||||||
|
var type_column = '-'
|
||||||
|
switch (row.db_type) {
|
||||||
|
case 0:
|
||||||
|
type_column = '本地数据库'
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
type_column = '远程数据库'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return '<span style="width: 110px;" title="' + type_column + '">' + type_column + '</span>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间', template: function (row) {
|
||||||
|
return '<span ' + (is_time_rule && row.total != 0 ? 'class="warning"' : '') + ' title="' + (row.is_time_rule && row.total != 0 ? '重要:此数据库创建时间较早,可能为重要数据,请谨慎操作.' : '') + '时间:' + row.database_time + '">' + row.database_time + '</span>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '删除结果', align: 'right', template: function (row, index, ev, _that) {
|
||||||
|
var _html = ''
|
||||||
|
switch (row.db_type) {
|
||||||
|
case 0:
|
||||||
|
_html = type !== 'mysql' ? '彻底删除' : (!recycle_bin_db_open ? '彻底删除' : '移至回收站')
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
_html = '彻底删除'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return '<span style="width: 110px;" class="' + (_html === '彻底删除' ? 'warning' + (row.db_type > 0 ? ' remote_database' : '') : '') + '">' + _html + '</span>'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
success: function () {
|
||||||
|
if ($('.remote_database').length) {
|
||||||
|
$('.remote_database').each(function (index, el) {
|
||||||
|
var id = $(el).parent().parent().parent().index()
|
||||||
|
$('#check_layer_content tbody tr').eq(id).css('background-color', '#ff00000a')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
yes: function (indes, layers) {
|
||||||
|
title = typeof dbname === "function" ? '二次验证信息,批量删除数据库' : '二次验证信息,删除数据库 - [ ' + dbname + ' ]';
|
||||||
|
if (type !== 'mysql') {
|
||||||
|
tips = '<span class="color-red">当前数据库暂不支持数据库回收站,删除后将无法恢复</span>,此操作不可逆,是否继续操作?';
|
||||||
|
} else {
|
||||||
|
tips = is_db_type ? '<span class="color-red">远程数据库不支持数据库回收站,删除后将无法恢复</span>,此操作不可逆,是否继续操作?' : recycle_bin_db_open ? '删除后如需彻底删除请前往数据库回收站,是否继续操作?' : '删除后可能会影响业务使用,此操作不可逆,是否继续操作?'
|
||||||
|
}
|
||||||
|
layer.open({
|
||||||
|
type: 1,
|
||||||
|
title: title,
|
||||||
|
icon: 0,
|
||||||
|
skin: 'delete_site_layer',
|
||||||
|
area: "530px",
|
||||||
|
closeBtn: 2,
|
||||||
|
shadeClose: true,
|
||||||
|
content: "<div class=\'bt-form webDelete hint_confirm pd30\' id=\'site_delete_form\'>" +
|
||||||
|
"<div class='hint_title'>\
|
||||||
|
<i class=\'hint-confirm-icon\'></i>\
|
||||||
|
<div class=\'hint_con\'>"+ tips + "</div>\
|
||||||
|
</div>"+
|
||||||
|
"<div style=\'color:red;margin:18px 0 18px 18px;font-size:14px;font-weight: bold;\'>注意:数据无价,请谨慎操作!!!" + (type === 'mysql' && !recycle_bin_db_open ? '<br>风险操作:当前数据库回收站未开启,删除数据库将永久消失!' : '') + "</div>"+
|
||||||
|
"</div>",
|
||||||
|
btn: ['确认删除', '取消删除'],
|
||||||
|
yes: function (indexs) {
|
||||||
|
var data = {
|
||||||
|
id: wid,
|
||||||
|
name: dbname
|
||||||
|
};
|
||||||
|
if (typeof dbname === "function") {
|
||||||
|
delete data.id;
|
||||||
|
delete data.name;
|
||||||
|
}
|
||||||
|
layer.close(indexs)
|
||||||
|
layer.close(indes)
|
||||||
|
if (typeof dbname === "function") {
|
||||||
|
dbname(data)
|
||||||
|
} else {
|
||||||
|
data.id = data.id[0]
|
||||||
|
bt.database.del_database(data, function (rdata) {
|
||||||
|
layer.closeAll()
|
||||||
|
if (callback) callback(rdata);
|
||||||
|
bt.msg(rdata);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if("undefined" != typeof site && site.hasOwnProperty("del_site")){
|
if("undefined" != typeof site && site.hasOwnProperty("del_site")){
|
||||||
site.del_site = function(wid, wname, callback) {
|
site.del_site = function (wid, wname, callback) {
|
||||||
var title = typeof wname === "function" ?'批量删除站点':'删除站点 [ '+ wname +' ]';
|
title = typeof wname === "function" ? '批量删除站点' : '删除站点 [ ' + wname + ' ]';
|
||||||
layer.open({
|
layer.open({
|
||||||
type:1,
|
type: 1,
|
||||||
title:title,
|
title: title,
|
||||||
icon:0,
|
icon: 0,
|
||||||
skin:'delete_site_layer',
|
skin: 'delete_site_layer',
|
||||||
area: "440px",
|
area: "440px",
|
||||||
closeBtn: 2,
|
closeBtn: 2,
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
content:"<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
content: "<div class=\'bt-form webDelete pd30\' id=\'site_delete_form\'>" +
|
||||||
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
||||||
"<div class=\'f13 check_title\'>是否要删除关联的FTP、数据库、站点目录!</div>" +
|
"<div class=\'f13 check_title\'>是否要删除关联的FTP、数据库、站点目录!</div>" +
|
||||||
"<div class=\"check_type_group\">" +
|
"<div class=\"check_type_group\">" +
|
||||||
"<label><input type=\"checkbox\" name=\"ftp\"><span>FTP</span></label>" +
|
"<label><input type=\"checkbox\" name=\"ftp\"><span>FTP</span></label>" +
|
||||||
"<label><input type=\"checkbox\" name=\"database\"><span>数据库</span>"+ (!recycle_bin_db_open?'<span class="glyphicon glyphicon-info-sign" style="color: red"></span>':'') +"</label>" +
|
"<label><input type=\"checkbox\" name=\"database\"><span>数据库</span>" + (!recycle_bin_db_open ? '<span class="glyphicon glyphicon-info-sign" style="color: red"></span>' : '') + "</label>" +
|
||||||
"<label><input type=\"checkbox\" name=\"path\"><span>站点目录</span>"+ (!recycle_bin_open?'<span class="glyphicon glyphicon-info-sign" style="color: red"></span>':'') +"</label>" +
|
"<label><input type=\"checkbox\" name=\"path\"><span>站点目录</span>" + (!recycle_bin_open ? '<span class="glyphicon glyphicon-info-sign" style="color: red"></span>' : '') + "</label>" +
|
||||||
"</div>"+
|
"</div>" +
|
||||||
"</div>",
|
"</div>",
|
||||||
btn:[lan.public.ok,lan.public.cancel],
|
btn: [lan.public.ok, lan.public.cancel],
|
||||||
success:function(layers,indexs){
|
success: function (layers, indexs) {
|
||||||
$(layers).find('.check_type_group label').hover(function(){
|
$(layers).find('.check_type_group label').hover(function () {
|
||||||
var name = $(this).find('input').attr('name');
|
var name = $(this).find('input').attr('name');
|
||||||
if(name === 'data' && !recycle_bin_db_open){
|
if (name === 'database' && !recycle_bin_db_open) {
|
||||||
layer.tips('风险操作:当前数据库回收站未开启,删除数据库将永久消失!', this, {tips: [1, 'red'],time:0})
|
layer.tips('风险操作:当前数据库回收站未开启,删除数据库将永久消失!', this, { tips: [1, 'red'], time: 0 })
|
||||||
}else if(name === 'path' && !recycle_bin_open){
|
} else if (name === 'path' && !recycle_bin_open) {
|
||||||
layer.tips('风险操作:当前文件回收站未开启,删除站点目录将永久消失!', this, {tips: [1, 'red'],time:0})
|
layer.tips('风险操作:当前文件回收站未开启,删除站点目录将永久消失!', this, { tips: [1, 'red'], time: 0 })
|
||||||
}
|
}
|
||||||
},function(){
|
}, function () {
|
||||||
layer.closeAll('tips');
|
layer.closeAll('tips');
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
yes:function(indexs){
|
yes: function (indexs) {
|
||||||
var data = {id: wid,webname: wname};
|
var data = { id: wid, webname: wname };
|
||||||
$('#site_delete_form input[type=checkbox]').each(function (index, item) {
|
$('#site_delete_form input[type=checkbox]').each(function (index, item) {
|
||||||
if($(item).is(':checked')) data[$(item).attr('name')] = 1
|
if ($(item).is(':checked')) data[$(item).attr('name')] = 1
|
||||||
})
|
})
|
||||||
var is_database = data.hasOwnProperty('database'),is_path = data.hasOwnProperty('path'),is_ftp = data.hasOwnProperty('ftp');
|
var is_database = data.hasOwnProperty('database'), is_path = data.hasOwnProperty('path'), is_ftp = data.hasOwnProperty('ftp');
|
||||||
if((!is_database && !is_path) && (!is_ftp || is_ftp)){
|
if ((!is_database && !is_path) && (!is_ftp || is_ftp)) {
|
||||||
if(typeof wname === "function"){
|
if (typeof wname === "function") {
|
||||||
wname(data)
|
wname(data)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -129,22 +274,95 @@ if("undefined" != typeof site && site.hasOwnProperty("del_site")){
|
|||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if(typeof wname === "function"){
|
if (typeof wname === "function") {
|
||||||
delete data.id;
|
delete data.id;
|
||||||
delete data.webname;
|
delete data.webname;
|
||||||
}
|
}
|
||||||
layer.close(indexs)
|
layer.close(indexs)
|
||||||
if(typeof wname === "function"){
|
var ids = JSON.stringify(wid instanceof Array ? wid : [wid]), countDown = typeof wname === 'string' ? 4 : 9;
|
||||||
console.log(data)
|
title = typeof wname === "function" ? '二次验证信息,批量删除站点' : '二次验证信息,删除站点 [ ' + wname + ' ]';
|
||||||
wname(data)
|
var loadT = bt.load('正在检测站点数据信息,请稍候...')
|
||||||
}else{
|
bt.send('check_del_data', 'site/check_del_data', { ids: ids }, function (res) {
|
||||||
bt.site.del_site(data, function (rdata) {
|
loadT.close()
|
||||||
layer.closeAll()
|
layer.open({
|
||||||
if (rdata.status) site.get_list();
|
type: 1,
|
||||||
if (callback) callback(rdata);
|
title: title,
|
||||||
bt.msg(rdata);
|
closeBtn: 2,
|
||||||
|
skin: 'verify_site_layer_info',
|
||||||
|
area: '740px',
|
||||||
|
content: '<div class="check_delete_site_main pd30">' +
|
||||||
|
'<i class="layui-layer-ico layui-layer-ico0"></i>' +
|
||||||
|
'<div class="check_layer_title">堡塔温馨提示您,请冷静几秒钟,确认以下要删除的数据。</div>' +
|
||||||
|
'<div class="check_layer_content">' +
|
||||||
|
'<div class="check_layer_item">' +
|
||||||
|
'<div class="check_layer_site"></div>' +
|
||||||
|
'<div class="check_layer_database"></div>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="check_layer_error ' + (is_database && data['database'] && !recycle_bin_db_open ? '' : 'hide') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启数据库回收站功能,删除数据库后,数据库将永久消失!</div>' +
|
||||||
|
'<div class="check_layer_error ' + (is_path && data['path'] && !recycle_bin_open ? '' : 'hide') + '"><span class="glyphicon glyphicon-info-sign"></span>风险事项:当前未开启文件回收站功能,删除站点目录后,站点目录将永久消失!</div>' +
|
||||||
|
'<div class="check_layer_message"><span style="color:red">注意:请仔细阅读以上要删除信息,防止网站数据被误删</span></div>' +
|
||||||
|
'</div>',
|
||||||
|
// recycle_bin_db_open &&
|
||||||
|
// recycle_bin_open &&
|
||||||
|
btn: ['确认删除', '取消删除'],
|
||||||
|
success: function (layers) {
|
||||||
|
var html = '', rdata = res.data;
|
||||||
|
for (var i = 0; i < rdata.length; i++) {
|
||||||
|
var item = rdata[i], newTime = parseInt(new Date().getTime() / 1000),
|
||||||
|
t_icon = '<span class="glyphicon glyphicon-info-sign" style="color: red;width:15px;height: 15px;;vertical-align: middle;"></span>';
|
||||||
|
|
||||||
|
site_html = (function (item) {
|
||||||
|
if (!is_path) return ''
|
||||||
|
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
||||||
|
is_path_rule = res.file_size <= item.total,
|
||||||
|
dir_time = bt.format_data(item.st_time, 'yyyy-MM-dd'),
|
||||||
|
dir_size = bt.format_size(item.total);
|
||||||
|
|
||||||
|
var f_html = '<i ' + (is_path_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + (item.limit ? '大于50MB' : dir_size) + '</i> ' + (is_path_rule ? t_icon : '');
|
||||||
|
var f_title = (is_path_rule ? '注意:此目录较大,可能为重要数据,请谨慎操作.\n' : '') + '目录:' + item.path + '(' + (item.limit ? '大于' : '') + dir_size + ')';
|
||||||
|
|
||||||
|
return '<div class="check_layer_site">' +
|
||||||
|
'<span title="站点:' + item.name + '">站点名:' + item.name + '</span>' +
|
||||||
|
'<span title="' + f_title + '" >目录:<span style="vertical-align: middle;max-width: 160px;width: auto;">' + item.path + '</span> (' + f_html + ')</span>' +
|
||||||
|
'<span title="' + (is_time_rule ? '注意:此站点创建时间较早,可能为重要数据,请谨慎操作.\n' : '') + '时间:' + dir_time + '">创建时间:<i ' + (is_time_rule ? 'class="warning"' : '') + '>' + dir_time + '</i></span>' +
|
||||||
|
'</div>'
|
||||||
|
}(item)),
|
||||||
|
database_html = (function (item) {
|
||||||
|
if (!is_database || !item.database) return '';
|
||||||
|
var is_time_rule = (newTime - item.st_time) > (86400 * 30) && (item.total > 1024 * 10),
|
||||||
|
is_database_rule = res.db_size <= item.database.total,
|
||||||
|
database_time = bt.format_data(item.database.st_time, 'yyyy-MM-dd'),
|
||||||
|
database_size = bt.format_size(item.database.total);
|
||||||
|
|
||||||
|
var f_size = '<i ' + (is_database_rule ? 'class="warning"' : '') + ' style = "vertical-align: middle;" > ' + database_size + '</i> ' + (is_database_rule ? t_icon : '');
|
||||||
|
var t_size = '注意:此数据库较大,可能为重要数据,请谨慎操作.\n数据库:' + database_size;
|
||||||
|
|
||||||
|
return '<div class="check_layer_database">' +
|
||||||
|
'<span title="数据库:' + item.database.name + '">数据库:' + item.database.name + '</span>' +
|
||||||
|
'<span title="' + t_size + '">大小:' + f_size + '</span>' +
|
||||||
|
'<span title="' + (is_time_rule && item.database.total != 0 ? '重要:此数据库创建时间较早,可能为重要数据,请谨慎操作.' : '') + '时间:' + database_time + '">创建时间:<i ' + (is_time_rule && item.database.total != 0 ? 'class="warning"' : '') + '>' + database_time + '</i></span>' +
|
||||||
|
'</div>'
|
||||||
|
}(item))
|
||||||
|
if ((site_html + database_html) !== '') html += '<div class="check_layer_item">' + site_html + database_html + '</div>';
|
||||||
|
}
|
||||||
|
if (html === '') html = '<div style="text-align: center;width: 100%;height: 100%;line-height: 300px;font-size: 15px;">无数据</div>'
|
||||||
|
$('.check_layer_content').html(html)
|
||||||
|
},
|
||||||
|
yes: function (indes, layers) {
|
||||||
|
if (typeof wname === "function") {
|
||||||
|
wname(data)
|
||||||
|
} else {
|
||||||
|
bt.site.del_site(data, function (rdata) {
|
||||||
|
layer.closeAll()
|
||||||
|
if (rdata.status) site.get_list();
|
||||||
|
if (callback) callback(rdata);
|
||||||
|
bt.msg(rdata);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -157,7 +375,10 @@ if("undefined" != typeof bt && bt.hasOwnProperty("firewall") && bt.firewall.hasO
|
|||||||
if (port.indexOf('-') != -1) ports = port.split('-');
|
if (port.indexOf('-') != -1) ports = port.split('-');
|
||||||
for (var i = 0; i < ports.length; i++) {
|
for (var i = 0; i < ports.length; i++) {
|
||||||
if (!bt.check_port(ports[i])) {
|
if (!bt.check_port(ports[i])) {
|
||||||
layer.msg(lan.firewall.port_err, { icon: 5 });
|
layer.msg('可用端口范围:1-65535', { icon: 2 });
|
||||||
|
// layer.msg(lan.firewall.port_err, {
|
||||||
|
// icon: 5
|
||||||
|
// });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
122
wiki/files/win/PluginLoader.py
Normal file
122
wiki/files/win/PluginLoader.py
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
#coding: utf-8
|
||||||
|
import public,os,sys,json
|
||||||
|
|
||||||
|
#获取插件列表(0/1)
|
||||||
|
def get_plugin_list(force = 0):
|
||||||
|
api_root_url = 'https://api.bt.cn'
|
||||||
|
api_url = api_root_url+ '/wpanel/get_plugin_list'
|
||||||
|
cache_file = 'data/plugin_list.json'
|
||||||
|
|
||||||
|
if force==0 and os.path.exists(cache_file):
|
||||||
|
jsonData = public.readFile(cache_file)
|
||||||
|
softList = json.loads(jsonData)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
jsonData = public.HttpGet(api_url)
|
||||||
|
except Exception as ex:
|
||||||
|
raise public.error_conn_cloud(str(ex))
|
||||||
|
softList = json.loads(jsonData)
|
||||||
|
if type(softList)!=dict or 'list' not in softList: raise Exception('云端插件列表获取失败')
|
||||||
|
public.writeFile(cache_file, jsonData)
|
||||||
|
return softList
|
||||||
|
|
||||||
|
#获取授权状态() 返回:0.免费版 1.专业版 2.企业版 -1.获取失败
|
||||||
|
def get_auth_state():
|
||||||
|
try:
|
||||||
|
softList = get_plugin_list()
|
||||||
|
if softList['ltd'] > -1:
|
||||||
|
return 2
|
||||||
|
elif softList['pro'] > -1:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
except:
|
||||||
|
return -1
|
||||||
|
|
||||||
|
#执行插件方法(插件名,方法名,参数)
|
||||||
|
def plugin_run(plugin_name, def_name, args):
|
||||||
|
if not plugin_name or not def_name: return public.returnMsg(False,'插件名称和插件方法名称不能为空!')
|
||||||
|
if not path_check(plugin_name) or not path_check(def_name): return public.returnMsg(False,'插件名或方法名不能包含特殊符号!')
|
||||||
|
p_path = public.get_plugin_path(plugin_name)
|
||||||
|
if not os.path.exists(p_path + '/index.php') and not os.path.exists(p_path + '/%s_main.py' % plugin_name): return public.returnMsg(False,'插件不存在!')
|
||||||
|
|
||||||
|
is_php = os.path.exists(p_path + '/index.php')
|
||||||
|
if not is_php:
|
||||||
|
sys.path.append(p_path)
|
||||||
|
plugin_main = __import__(plugin_name + '_main')
|
||||||
|
try:
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
reload(plugin_main)
|
||||||
|
else:
|
||||||
|
from imp import reload
|
||||||
|
reload(plugin_main)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
plu = eval('plugin_main.' + plugin_name + '_main()')
|
||||||
|
if not hasattr(plu, def_name):
|
||||||
|
return public.returnMsg(False,'在[%s]插件中找不到[%s]方法' % (plugin_name,def_name))
|
||||||
|
|
||||||
|
if 'plugin_get_object' in args and args.plugin_get_object == 1:
|
||||||
|
if not is_php:
|
||||||
|
return getattr(plu, def_name)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
if not is_php:
|
||||||
|
data = eval('plu.' + def_name + '(args)')
|
||||||
|
else:
|
||||||
|
import panelPHP
|
||||||
|
args.s = def_name
|
||||||
|
args.name = plugin_name
|
||||||
|
data = panelPHP.panelPHP(plugin_name).exec_php_script(args)
|
||||||
|
return data
|
||||||
|
|
||||||
|
#执行模块方法(模块名,方法名,参数)
|
||||||
|
def module_run(mod_name, def_name, args):
|
||||||
|
if not mod_name or not def_name: return public.returnMsg(False,'模块名称和模块方法名称不能为空!')
|
||||||
|
if not path_check(mod_name) or not path_check(def_name): return public.returnMsg(False,'模块名或方法名不能包含特殊符号!')
|
||||||
|
|
||||||
|
if 'model_index' in args:
|
||||||
|
if args.model_index:
|
||||||
|
mod_file = "{}/{}Model/{}Model.py".format(public.get_class_path(),args.model_index,mod_name)
|
||||||
|
else:
|
||||||
|
mod_file = "{}/projectModel/{}Model.py".format(public.get_class_path(),mod_name)
|
||||||
|
else:
|
||||||
|
module_list = get_module_list()
|
||||||
|
for module_dir in module_list:
|
||||||
|
mod_file = "{}/{}/{}Model.py".format(public.get_class_path(),module_dir,mod_name)
|
||||||
|
if os.path.exists(mod_file): break
|
||||||
|
|
||||||
|
if not os.path.exists(mod_file):
|
||||||
|
return public.returnMsg(False,'模块[%s]不存在' % mod_name)
|
||||||
|
|
||||||
|
def_object = public.get_script_object(mod_file)
|
||||||
|
if not def_object: return public.returnMsg(False,'模块[%s]不存在!' % mod_name)
|
||||||
|
try:
|
||||||
|
run_object = getattr(def_object.main(),def_name,None)
|
||||||
|
except:
|
||||||
|
return public.returnMsg(False,'模块入口实例化失败' % mod_name)
|
||||||
|
if not run_object: return public.returnMsg(False,'在[%s]模块中找不到[%s]方法' % (mod_name,def_name))
|
||||||
|
if 'module_get_object' in args and args.module_get_object == 1:
|
||||||
|
return run_object
|
||||||
|
result = run_object(args)
|
||||||
|
return result
|
||||||
|
|
||||||
|
#获取模块文件夹列表
|
||||||
|
def get_module_list():
|
||||||
|
list = []
|
||||||
|
class_path = public.get_class_path()
|
||||||
|
f_list = os.listdir(class_path)
|
||||||
|
for fname in f_list:
|
||||||
|
f_path = class_path+'/'+fname
|
||||||
|
if os.path.isdir(f_path) and len(fname) > 6 and fname.find('.') == -1 and fname.find('Model') != -1:
|
||||||
|
list.append(fname)
|
||||||
|
return list
|
||||||
|
|
||||||
|
#检查路径是否合法
|
||||||
|
def path_check(path):
|
||||||
|
list = ["./","..",",",";",":","?","'","\"","<",">","|","\\","\n","\r","\t","\b","\a","\f","\v","*","%","&","$","#","@","!","~","`","^","(",")","+","=","{","}","[","]"]
|
||||||
|
for i in path:
|
||||||
|
if i in list:
|
||||||
|
return False
|
||||||
|
return True
|
@@ -1,60 +0,0 @@
|
|||||||
#coding: utf-8
|
|
||||||
import public,os,sys,json
|
|
||||||
|
|
||||||
class Plugin:
|
|
||||||
name = False
|
|
||||||
p_path = None
|
|
||||||
is_php = False
|
|
||||||
plu = None
|
|
||||||
__api_root_url = 'https://api.bt.cn'
|
|
||||||
__api_url = __api_root_url+ '/wpanel/get_plugin_list'
|
|
||||||
__cache_file = 'data/plugin_list.json'
|
|
||||||
|
|
||||||
def __init__(self, name):
|
|
||||||
self.name = name
|
|
||||||
self.p_path = public.get_plugin_path(name)
|
|
||||||
self.is_php = os.path.exists(self.p_path + '/index.php')
|
|
||||||
|
|
||||||
def get_plugin_list(self, force = False):
|
|
||||||
if force==False and os.path.exists(self.__cache_file):
|
|
||||||
jsonData = public.readFile(self.__cache_file)
|
|
||||||
softList = json.loads(jsonData)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
jsonData = public.HttpGet(self.__api_url)
|
|
||||||
except Exception as ex:
|
|
||||||
raise public.error_conn_cloud(str(ex))
|
|
||||||
softList = json.loads(jsonData)
|
|
||||||
if type(softList)!=dict or 'list' not in softList: raise Exception('云端插件列表获取失败')
|
|
||||||
public.writeFile(self.__cache_file, jsonData)
|
|
||||||
|
|
||||||
return softList
|
|
||||||
|
|
||||||
def isdef(self, fun):
|
|
||||||
if not self.is_php:
|
|
||||||
sys.path.append(self.p_path)
|
|
||||||
plugin_main = __import__(self.name + '_main')
|
|
||||||
try:
|
|
||||||
from imp import reload
|
|
||||||
reload(plugin_main)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
self.plu = eval('plugin_main.' + self.name + '_main()')
|
|
||||||
if not hasattr(self.plu, fun):
|
|
||||||
if self.name == 'btwaf' and fun == 'index':
|
|
||||||
raise Exception("未购买")
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def exec_fun(self, args):
|
|
||||||
fun = args.s
|
|
||||||
if not self.is_php:
|
|
||||||
plu = self.plu
|
|
||||||
data = eval('plu.' + fun + '(args)')
|
|
||||||
else:
|
|
||||||
import panelPHP
|
|
||||||
args.s = fun
|
|
||||||
args.name = self.name
|
|
||||||
data = panelPHP.panelPHP(self.name).exec_php_script(args)
|
|
||||||
return data
|
|
||||||
|
|
@@ -10,9 +10,11 @@
|
|||||||
|
|
||||||
- 将PluginLoader.py复制到class文件夹
|
- 将PluginLoader.py复制到class文件夹
|
||||||
|
|
||||||
|
- 批量解密模块文件:执行 php think decrypt classdir <面板class文件夹路径>
|
||||||
|
|
||||||
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
||||||
|
|
||||||
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除clearModel.py)
|
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除clearModel.py、scanningModel.py、ipsModel.py)
|
||||||
|
|
||||||
- 全局搜索替换 http://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
|
||||||
|
|
||||||
@@ -38,8 +40,12 @@
|
|||||||
|
|
||||||
在 def check_domain_cloud(domain): 这一行下面加上 return
|
在 def check_domain_cloud(domain): 这一行下面加上 return
|
||||||
|
|
||||||
|
在 def get_improvement(): 这一行下面加上 return False
|
||||||
|
|
||||||
- class/panelPlugin.py 文件,download_icon方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
- class/panelPlugin.py 文件,download_icon方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
||||||
|
|
||||||
|
- class/panelPlugin.py 文件,删除public.total_keyword(get.query)这一行
|
||||||
|
|
||||||
- class/panelPlugin.py 文件,set_pyenv方法内,temp_file = public.readFile(filename)这行代码下面加上
|
- class/panelPlugin.py 文件,set_pyenv方法内,temp_file = public.readFile(filename)这行代码下面加上
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@@ -61,18 +67,18 @@
|
|||||||
|
|
||||||
"update_software_list": update_software_list,
|
"update_software_list": update_software_list,
|
||||||
|
|
||||||
"check_files_panel": check_files_panel,
|
|
||||||
|
|
||||||
"check_panel_msg": check_panel_msg,
|
"check_panel_msg": check_panel_msg,
|
||||||
|
|
||||||
- 去除面板日志上报:script/site_task.py 文件
|
PluginLoader.daemon_panel()
|
||||||
|
|
||||||
删除最下面 logs_analysis() 这1行
|
- 去除WebRTC连接:BTPanel/static/js/public.js 删除stun.start();这一行
|
||||||
|
|
||||||
- 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行
|
- 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行
|
||||||
|
|
||||||
- 去除首页自动检测更新,避免频繁请求云端:BTPanel/static/js/index.js 文件注释掉bt.system.check_update这一段代码外的setTimeout
|
- 去除首页自动检测更新,避免频繁请求云端:BTPanel/static/js/index.js 文件注释掉bt.system.check_update这一段代码外的setTimeout
|
||||||
|
|
||||||
|
- 去除内页广告:BTPanel/templates/default/layout.html 删除getPaymentStatus();这一行
|
||||||
|
|
||||||
- [可选]去除各种计算题:复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的\</body\>前面加入
|
- [可选]去除各种计算题:复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的\</body\>前面加入
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -91,9 +97,8 @@
|
|||||||
|
|
||||||
- [可选]关闭未绑定域名提示页面:在class/panelSite.py,root /www/server/nginx/html改成return 400
|
- [可选]关闭未绑定域名提示页面:在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,将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(
|
解压安装包panel6.zip,将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(
|
||||||
|
|
||||||
|
@@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
Windows版宝塔由于加密文件太多,无法全部解密,因此无法做到全开源。
|
Windows版宝塔由于加密文件太多,无法全部解密,因此无法做到全开源。
|
||||||
|
|
||||||
- 删除pluginAuth.cp38-win_amd64.pyd,将win/pluginAuth.py复制到class文件夹
|
- 删除PluginLoader.pyd,将win/PluginLoader.py复制到class文件夹
|
||||||
|
|
||||||
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
- 全局搜索替换 https://api.bt.cn => http://www.example.com
|
||||||
|
|
||||||
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/
|
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除ipsModel.py)
|
||||||
|
|
||||||
- 全局搜索替换 http://www.bt.cn/api/ => http://www.example.com/api/
|
- 全局搜索替换 http://www.bt.cn/api/ => http://www.example.com/api/
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ Windows版宝塔由于加密文件太多,无法全部解密,因此无法做
|
|||||||
|
|
||||||
- 去除面板日志上报:script/site_task.py 文件
|
- 去除面板日志上报:script/site_task.py 文件
|
||||||
|
|
||||||
删除最下面 logs_analysis() 这1行
|
- 删除最下面 logs_analysis() 这1行
|
||||||
|
|
||||||
- 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行
|
- 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行
|
||||||
|
|
||||||
@@ -72,5 +72,5 @@ Windows版宝塔由于加密文件太多,无法全部解密,因此无法做
|
|||||||
|
|
||||||
删除 if not os.path.exists(self.sitePath + '/.htaccess') 这一行
|
删除 if not os.path.exists(self.sitePath + '/.htaccess') 这一行
|
||||||
|
|
||||||
|
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user