Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
efbb0934f0 | ||
![]() |
2ed20aba20 |
12
README.md
@@ -5,7 +5,7 @@
|
||||
|
||||
网站后台管理可一键同步宝塔官方的插件列表与增量更新插件包,还有云端使用记录、IP黑白名单、操作日志、定时任务等功能。
|
||||
|
||||
本项目自带的宝塔安装包和更新包是7.9.2最新版,已修改适配此第三方云端,并且全开源,无so等加密文件。
|
||||
本项目自带的宝塔安装包和更新包是7.9.3最新版,已修改适配此第三方云端,并且全开源,无so等加密文件。
|
||||
|
||||
觉得该项目不错的可以给个Star~
|
||||
|
||||
@@ -36,13 +36,17 @@
|
||||
|
||||
- 在`系统基本设置`修改宝塔面板接口设置。你需要一个官方最新脚本安装并绑定账号的宝塔面板,用于获取最新插件列表及插件包。并根据界面提示安装好专用插件。
|
||||
- 在`定时任务设置`执行所显示的命令从宝塔官方获取最新的插件列表并批量下载插件包(增量更新)。当然你也可以去插件列表,一个一个点击下载。
|
||||
- 在public/install/src和update文件夹里面分别是bt安装包和更新包,解压后源码里面全部的 www.example.com 替换成你自己搭建的云端域名,然后重新打包。可使用VSCode等支持批量替换的软件。
|
||||
- 将bt安装脚本public/install/install_6.0.sh和更新脚本update6.sh里面的 www.example.com 替换成你自己搭建的云端域名。
|
||||
- 在public/install/src和update文件夹里面分别是Linux面板安装包和更新包,解压后源码里面全部的 www.example.com 替换成你自己搭建的云端域名(如果云端用了强制https也需要单独改),然后重新打包。可使用VSCode等支持批量替换的软件。
|
||||
- 在public/win/panel/panel_x.x.x.zip是Windows面板的更新包,同样方法替换域名。
|
||||
- Linux面板安装脚本public/install/install_6.0.sh和更新脚本update6.sh里面的 www.example.com 替换成你自己搭建的云端域名。
|
||||
- Windows面板更新脚本 public/win/install/panel_update.py、public/win/panel/data/setup.py、api.py 里面的 www.example.com 替换成你自己搭建的云端域名。
|
||||
- 访问网站`/download`查看使用此第三方云端的一键安装脚本
|
||||
|
||||
## 其他
|
||||
|
||||
- [bt官方更新包修改记录](./wiki/update.md)
|
||||
- [Linux面板官方更新包修改记录](./wiki/update.md)
|
||||
|
||||
- [Windows面板官方更新包修改记录](./wiki/updatewin.md)
|
||||
|
||||
- 宝塔面板官方版与此第三方云端版对比:
|
||||
|
||||
|
@@ -25,16 +25,27 @@ class UpdateAll extends Command
|
||||
$res = Db::name('config')->cache('configs',0)->column('value','key');
|
||||
Config::set($res, 'sys');
|
||||
|
||||
if(config_get('bt_url')){
|
||||
$this->process_plugins($input, $output, 'Linux');
|
||||
}
|
||||
if(config_get('wbt_url')){
|
||||
$this->process_plugins($input, $output, 'Windows');
|
||||
}
|
||||
|
||||
config_set('runtime', date('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
private function process_plugins(Input $input, Output $output, $os){
|
||||
//刷新插件列表
|
||||
if(!$this->refresh_plugin_list($input, $output)){
|
||||
if(!$this->refresh_plugin_list($input, $output, $os)){
|
||||
return;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
|
||||
$type = intval(config_get('updateall_type'));
|
||||
$type = intval(config_get($os=='Windows'?'updateall_type_win':'updateall_type'));
|
||||
|
||||
$json_arr = Plugins::get_plugin_list();
|
||||
$json_arr = Plugins::get_plugin_list($os);
|
||||
//循环下载缺少的插件
|
||||
foreach($json_arr['list'] as $plugin){
|
||||
if($type == 0 && ($plugin['type']==8 || $plugin['type']==12) || $type == 1 && $plugin['type']==12 || $plugin['type']==10 || $plugin['type']==5) continue;
|
||||
@@ -43,18 +54,18 @@ class UpdateAll extends Command
|
||||
$ver = $version['m_version'].'.'.$version['version'];
|
||||
if(isset($version['download'])){
|
||||
if(!file_exists(get_data_dir().'plugins/other/'.$version['download'])){
|
||||
if(!$this->download_plugin($input, $output, $plugin['name'], $ver)){
|
||||
if(!$this->download_plugin($input, $output, $plugin['name'], $ver, $os)){
|
||||
sleep(1);
|
||||
$this->download_plugin($input, $output, $plugin['name'], $ver);
|
||||
$this->download_plugin($input, $output, $plugin['name'], $ver, $os);
|
||||
}
|
||||
sleep(1);
|
||||
$count++;
|
||||
}
|
||||
}else{
|
||||
if(!file_exists(get_data_dir().'plugins/package/'.$plugin['name'].'-'.$ver.'.zip')){
|
||||
if(!$this->download_plugin($input, $output, $plugin['name'], $ver)){
|
||||
if(!file_exists(get_data_dir($os).'plugins/package/'.$plugin['name'].'-'.$ver.'.zip')){
|
||||
if(!$this->download_plugin($input, $output, $plugin['name'], $ver, $os)){
|
||||
sleep(1);
|
||||
$this->download_plugin($input, $output, $plugin['name'], $ver);
|
||||
$this->download_plugin($input, $output, $plugin['name'], $ver, $os);
|
||||
}
|
||||
sleep(1);
|
||||
$count++;
|
||||
@@ -62,29 +73,15 @@ class UpdateAll extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$imgcount = 0;
|
||||
//循环下载缺少的插件图片
|
||||
/*foreach($json_arr['list'] as $plugin){
|
||||
if(isset($plugin['min_image']) && strpos($plugin['min_image'], 'fname=')){
|
||||
$fname = substr($plugin['min_image'], strpos($plugin['min_image'], '?fname=')+7);
|
||||
if(!file_exists(get_data_dir().'plugins/other/'.$fname)){
|
||||
$this->download_plugin_image($input, $output, $fname);
|
||||
sleep(1);
|
||||
$imgcount++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$output->writeln('本次成功下载'.$count.'个插件'.($imgcount>0?','.$imgcount.'个图片':''));
|
||||
config_set('runtime', date('Y-m-d H:i:s'));
|
||||
$output->writeln($os.'本次成功下载'.$count.'个插件');
|
||||
}
|
||||
|
||||
private function refresh_plugin_list(Input $input, Output $output){
|
||||
private function refresh_plugin_list(Input $input, Output $output, $os){
|
||||
try{
|
||||
Plugins::refresh_plugin_list();
|
||||
Db::name('log')->insert(['uid' => 1, 'action' => '刷新插件列表', 'data' => '刷新插件列表成功', 'addtime' => date("Y-m-d H:i:s")]);
|
||||
$output->writeln('刷新插件列表成功');
|
||||
Plugins::refresh_plugin_list($os);
|
||||
Db::name('log')->insert(['uid' => 1, 'action' => '刷新插件列表', 'data' => '刷新'.$os.'插件列表成功', 'addtime' => date("Y-m-d H:i:s")]);
|
||||
$output->writeln('刷新'.$os.'插件列表成功');
|
||||
return true;
|
||||
}catch(\Exception $e){
|
||||
$output->writeln($e->getMessage());
|
||||
@@ -93,12 +90,12 @@ class UpdateAll extends Command
|
||||
}
|
||||
}
|
||||
|
||||
private function download_plugin(Input $input, Output $output, $plugin_name, $version){
|
||||
private function download_plugin(Input $input, Output $output, $plugin_name, $version, $os){
|
||||
$fullname = $plugin_name.'-'.$version;
|
||||
try{
|
||||
Plugins::download_plugin($plugin_name, $version);
|
||||
Db::name('log')->insert(['uid' => 1, 'action' => '下载插件', 'data' => $fullname, 'addtime' => date("Y-m-d H:i:s")]);
|
||||
$output->writeln('下载插件: '.$fullname.' 成功');
|
||||
Plugins::download_plugin($plugin_name, $version, $os);
|
||||
Db::name('log')->insert(['uid' => 1, 'action' => '下载插件', 'data' => $fullname.' os:'.$os, 'addtime' => date("Y-m-d H:i:s")]);
|
||||
$output->writeln('下载'.$os.'插件: '.$fullname.' 成功');
|
||||
return true;
|
||||
}catch(\Exception $e){
|
||||
$output->writeln($fullname.' '.$e->getMessage());
|
||||
|
@@ -2,8 +2,8 @@
|
||||
// 应用公共文件
|
||||
use think\facade\Db;
|
||||
|
||||
function get_data_dir(){
|
||||
return app()->getRootPath().'data/';
|
||||
function get_data_dir($os = 'Linux'){
|
||||
return app()->getRootPath().'data/'.($os == 'Windows' ? 'win/' : '');
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,17 @@ function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
function random($length, $numeric = 0) {
|
||||
$seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
|
||||
$seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
|
||||
$hash = '';
|
||||
$max = strlen($seed) - 1;
|
||||
for($i = 0; $i < $length; $i++) {
|
||||
$hash .= $seed[mt_rand(0, $max)];
|
||||
}
|
||||
return $hash;
|
||||
}
|
||||
|
||||
function get_curl($url, $post=0, $referer=0, $cookie=0, $header=0, $ua=0, $nobody=0, $addheader=0)
|
||||
{
|
||||
$ch = curl_init();
|
||||
|
@@ -133,7 +133,7 @@ class Admin extends BaseController
|
||||
if(!$bt_url || !$bt_key)return json(['code'=>-1, 'msg'=>'参数不能为空']);
|
||||
$btapi = new Btapi($bt_url, $bt_key);
|
||||
$result = $btapi->get_config();
|
||||
if($result && isset($result['status']) && $result['status']==1){
|
||||
if($result && isset($result['status']) && ($result['status']==1 || isset($result['sites_path']))){
|
||||
$result = $btapi->get_user_info();
|
||||
if($result && isset($result['username'])){
|
||||
return json(['code'=>0, 'msg'=>'面板连接测试成功!']);
|
||||
@@ -157,11 +157,25 @@ class Admin extends BaseController
|
||||
return view();
|
||||
}
|
||||
|
||||
public function pluginswin(){
|
||||
$typelist = [];
|
||||
$json_arr = Plugins::get_plugin_list('Windows');
|
||||
if($json_arr){
|
||||
foreach($json_arr['type'] as $type){
|
||||
$typelist[$type['id']] = $type['title'];
|
||||
}
|
||||
}
|
||||
View::assign('typelist', $typelist);
|
||||
return view();
|
||||
}
|
||||
|
||||
public function plugins_data(){
|
||||
$type = input('post.type/d');
|
||||
$keyword = input('post.keyword', null, 'trim');
|
||||
$os = input('get.os');
|
||||
if(!$os) $os = 'Linux';
|
||||
|
||||
$json_arr = Plugins::get_plugin_list();
|
||||
$json_arr = Plugins::get_plugin_list($os);
|
||||
if(!$json_arr) return json([]);
|
||||
|
||||
$typelist = [];
|
||||
@@ -184,7 +198,7 @@ class Admin extends BaseController
|
||||
$versions[] = ['status'=>$status, 'type'=>1, 'version'=>$ver, 'download'=>$version['download'], 'md5'=>$version['md5']];
|
||||
}else{
|
||||
$status = false;
|
||||
if(file_exists(get_data_dir().'plugins/package/'.$plugin['name'].'-'.$ver.'.zip')){
|
||||
if(file_exists(get_data_dir($os).'plugins/package/'.$plugin['name'].'-'.$ver.'.zip')){
|
||||
$status = true;
|
||||
}
|
||||
$versions[] = ['status'=>$status, 'type'=>0, 'version'=>$ver];
|
||||
@@ -209,10 +223,12 @@ class Admin extends BaseController
|
||||
public function download_plugin(){
|
||||
$name = input('post.name', null, 'trim');
|
||||
$version = input('post.version', null, 'trim');
|
||||
$os = input('post.os');
|
||||
if(!$os) $os = 'Linux';
|
||||
if(!$name || !$version) return json(['code'=>-1, 'msg'=>'参数不能为空']);
|
||||
try{
|
||||
Plugins::download_plugin($name, $version);
|
||||
Db::name('log')->insert(['uid' => 0, 'action' => '下载插件', 'data' => $name.'-'.$version, 'addtime' => date("Y-m-d H:i:s")]);
|
||||
Plugins::download_plugin($name, $version, $os);
|
||||
Db::name('log')->insert(['uid' => 0, 'action' => '下载插件', 'data' => $name.'-'.$version.' os:'.$os, 'addtime' => date("Y-m-d H:i:s")]);
|
||||
return json(['code'=>0,'msg'=>'下载成功']);
|
||||
}catch(\Exception $e){
|
||||
return json(['code'=>-1, 'msg'=>$e->getMessage()]);
|
||||
@@ -220,9 +236,11 @@ class Admin extends BaseController
|
||||
}
|
||||
|
||||
public function refresh_plugins(){
|
||||
$os = input('get.os');
|
||||
if(!$os) $os = 'Linux';
|
||||
try{
|
||||
Plugins::refresh_plugin_list();
|
||||
Db::name('log')->insert(['uid' => 0, 'action' => '刷新插件列表', 'data' => '刷新插件列表成功', 'addtime' => date("Y-m-d H:i:s")]);
|
||||
Plugins::refresh_plugin_list($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()]);
|
||||
|
@@ -22,18 +22,40 @@ class Api extends BaseController
|
||||
return json($json_arr);
|
||||
}
|
||||
|
||||
//获取插件列表(win)
|
||||
public function get_plugin_list_win(){
|
||||
if(!$this->checklist()) return '';
|
||||
$record = Db::name('record')->where('ip',$this->clientip)->find();
|
||||
if($record){
|
||||
Db::name('record')->where('id',$record['id'])->update(['usetime'=>date("Y-m-d H:i:s")]);
|
||||
}else{
|
||||
Db::name('record')->insert(['ip'=>$this->clientip, 'addtime'=>date("Y-m-d H:i:s"), 'usetime'=>date("Y-m-d H:i:s")]);
|
||||
}
|
||||
$json_file = get_data_dir('Windows').'config/plugin_list.json';
|
||||
if(file_exists($json_file)){
|
||||
$data = file_get_contents($json_file);
|
||||
$json_arr = json_decode($data, true);
|
||||
if($json_arr){
|
||||
return json($json_arr);
|
||||
}
|
||||
}
|
||||
return json((object)[]);
|
||||
}
|
||||
|
||||
//下载插件包
|
||||
public function download_plugin(){
|
||||
$plugin_name = input('post.name');
|
||||
$version = input('post.version');
|
||||
$os = input('post.os');
|
||||
if(!$plugin_name || !$version){
|
||||
return '参数不能为空';
|
||||
}
|
||||
if(!in_array($os,['Windows','Linux'])) $os = 'Linux';
|
||||
if(!preg_match('/^[a-zA-Z0-9_]+$/', $plugin_name) || !preg_match('/^[0-9.]+$/', $version)){
|
||||
return '参数不正确';
|
||||
}
|
||||
if(!$this->checklist()) '你的服务器被禁止使用此云端';
|
||||
$filepath = get_data_dir().'plugins/package/'.$plugin_name.'-'.$version.'.zip';
|
||||
$filepath = get_data_dir($os).'plugins/package/'.$plugin_name.'-'.$version.'.zip';
|
||||
if(file_exists($filepath)){
|
||||
$filename = $plugin_name.'.zip';
|
||||
$this->output_file($filepath, $filename);
|
||||
@@ -46,19 +68,21 @@ class Api extends BaseController
|
||||
public function download_plugin_main(){
|
||||
$plugin_name = input('post.name');
|
||||
$version = input('post.version');
|
||||
$os = input('post.os');
|
||||
if(!$plugin_name || !$version){
|
||||
return '参数不能为空';
|
||||
}
|
||||
if(!in_array($os,['Windows','Linux'])) $os = 'Linux';
|
||||
if(!preg_match('/^[a-zA-Z0-9_]+$/', $plugin_name) || !preg_match('/^[0-9.]+$/', $version)){
|
||||
return '参数不正确';
|
||||
}
|
||||
if(!$this->checklist()) '你的服务器被禁止使用此云端';
|
||||
$filepath = get_data_dir().'plugins/main/'.$plugin_name.'-'.$version.'.dat';
|
||||
$filepath = get_data_dir($os).'plugins/main/'.$plugin_name.'-'.$version.'.dat';
|
||||
if(file_exists($filepath)){
|
||||
$filename = $plugin_name.'_main.py';
|
||||
$this->output_file($filepath, $filename);
|
||||
}else{
|
||||
$filepath = get_data_dir().'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py';
|
||||
$filepath = get_data_dir($os).'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py';
|
||||
if(file_exists($filepath)){
|
||||
$filename = $plugin_name.'_main.py';
|
||||
$this->output_file($filepath, $filename);
|
||||
@@ -86,14 +110,26 @@ class Api extends BaseController
|
||||
}
|
||||
|
||||
public function get_update_logs(){
|
||||
$version = config_get('new_version');
|
||||
$data = [
|
||||
[
|
||||
'title' => 'Linux面板'.$version,
|
||||
'body' => config_get('update_msg'),
|
||||
'addtime' => config_get('update_date')
|
||||
]
|
||||
];
|
||||
$type = input('get.type');
|
||||
if($type == 'Windows'){
|
||||
$version = config_get('new_version_win');
|
||||
$data = [
|
||||
[
|
||||
'title' => 'Linux面板'.$version,
|
||||
'body' => config_get('update_msg_win'),
|
||||
'addtime' => config_get('update_date_win')
|
||||
]
|
||||
];
|
||||
}else{
|
||||
$version = config_get('new_version');
|
||||
$data = [
|
||||
[
|
||||
'title' => 'Linux面板'.$version,
|
||||
'body' => config_get('update_msg'),
|
||||
'addtime' => config_get('update_date')
|
||||
]
|
||||
];
|
||||
}
|
||||
return jsonp($data);
|
||||
}
|
||||
|
||||
@@ -102,6 +138,11 @@ class Api extends BaseController
|
||||
return $version;
|
||||
}
|
||||
|
||||
public function get_version_win(){
|
||||
$version = config_get('new_version_win');
|
||||
return $version;
|
||||
}
|
||||
|
||||
//安装统计
|
||||
public function setup_count(){
|
||||
return 'ok';
|
||||
@@ -130,6 +171,32 @@ class Api extends BaseController
|
||||
return json($data);
|
||||
}
|
||||
|
||||
//检测更新(win)
|
||||
public function check_update_win(){
|
||||
$version = config_get('new_version_win');
|
||||
$down_url = request()->root(true).'/win/panel/panel_'.$version.'.zip';
|
||||
$data = [
|
||||
'force' => false,
|
||||
'version' => $version,
|
||||
'downUrl' => $down_url,
|
||||
'updateMsg' => config_get('update_msg_win'),
|
||||
'uptime' => config_get('update_date_win'),
|
||||
'is_beta' => 0,
|
||||
'py_version' => '3.8.6',
|
||||
'adviser' => -1,
|
||||
'is_rec' => -1,
|
||||
'btb' => '',
|
||||
'beta' => [
|
||||
'py_version' => '3.8.6',
|
||||
'version' => $version,
|
||||
'downUrl' => $down_url,
|
||||
'updateMsg' => config_get('update_msg_win'),
|
||||
'uptime' => config_get('update_date_win'),
|
||||
]
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
|
||||
//获取内测版更新日志
|
||||
public function get_beta_logs(){
|
||||
return json(['beta_ps'=>'当前暂无内测版', 'list'=>[]]);
|
||||
@@ -160,6 +227,11 @@ class Api extends BaseController
|
||||
return time();
|
||||
}
|
||||
|
||||
//同步时间
|
||||
public function get_win_date(){
|
||||
return date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
//查询是否专业版(废弃)
|
||||
public function is_pro(){
|
||||
return json(['endtime'=>true, 'code'=>1]);
|
||||
@@ -187,7 +259,17 @@ class Api extends BaseController
|
||||
|
||||
//绑定账号
|
||||
public function get_auth_token(){
|
||||
return json(['status'=>false, 'msg'=>'不支持绑定宝塔官网账号', 'data'=>'5b5d']);
|
||||
$userinfo = ['uid'=>1, 'username'=>'Administrator', 'address'=>'127.0.0.1', 'serverid'=>'1', 'access_key'=>random(32), 'secret_key'=>random(48), 'ukey'=>md5(time()), 'state'=>1];
|
||||
$data = bin2hex(urlencode(json_encode($userinfo)));
|
||||
return json(['status'=>true, 'msg'=>'登录成功!', 'data'=>$data]);
|
||||
}
|
||||
|
||||
//一键部署列表
|
||||
public function get_deplist(){
|
||||
$os = input('post.os');
|
||||
$json_arr = Plugins::get_deplist($os);
|
||||
if(!$json_arr) return json([]);
|
||||
return json($json_arr);
|
||||
}
|
||||
|
||||
public function return_success(){
|
||||
|
@@ -144,6 +144,18 @@ class Btapi
|
||||
$data = json_decode($result,true);
|
||||
return $data;
|
||||
}
|
||||
|
||||
//获取一键部署列表
|
||||
public function get_deplist(){
|
||||
$url = $this->BT_PANEL.'/plugin?action=a&name=kaixin&s=get_deplist';
|
||||
|
||||
$p_data = $this->GetKeyData();
|
||||
|
||||
$result = $this->curl($url,$p_data);
|
||||
|
||||
$data = json_decode($result,true);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function GetKeyData(){
|
||||
|
@@ -8,30 +8,35 @@ use ZipArchive;
|
||||
class Plugins
|
||||
{
|
||||
|
||||
private static function get_btapi(){
|
||||
$bt_url = config_get('bt_url');
|
||||
$bt_key = config_get('bt_key');
|
||||
private static function get_btapi($os){
|
||||
if($os == 'Windows'){
|
||||
$bt_url = config_get('wbt_url');
|
||||
$bt_key = config_get('wbt_key');
|
||||
}else{
|
||||
$bt_url = config_get('bt_url');
|
||||
$bt_key = config_get('bt_key');
|
||||
}
|
||||
if(!$bt_url || !$bt_key) throw new Exception('请先配置好宝塔面板接口信息');
|
||||
$btapi = new Btapi($bt_url, $bt_key);
|
||||
return $btapi;
|
||||
}
|
||||
|
||||
//刷新插件列表
|
||||
public static function refresh_plugin_list(){
|
||||
$btapi = self::get_btapi();
|
||||
public static function refresh_plugin_list($os = 'Linux'){
|
||||
$btapi = self::get_btapi($os);
|
||||
$result = $btapi->get_plugin_list();
|
||||
if($result && isset($result['list']) && isset($result['type'])){
|
||||
if(empty($result['list']) || empty($result['type'])){
|
||||
throw new Exception('获取插件列表失败:插件列表为空');
|
||||
}
|
||||
self::save_plugin_list($result);
|
||||
self::save_plugin_list($result, $os);
|
||||
}else{
|
||||
throw new Exception('获取插件列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
|
||||
}
|
||||
}
|
||||
|
||||
//保存插件列表
|
||||
private static function save_plugin_list($data){
|
||||
private static function save_plugin_list($data, $os){
|
||||
$data['ip'] = '127.0.0.1';
|
||||
$data['serverid'] = '';
|
||||
$data['beta'] = 0;
|
||||
@@ -45,15 +50,15 @@ class Plugins
|
||||
$data['list'] = $list;
|
||||
if($data['pro']>-1) $data['pro'] = 0;
|
||||
if($data['ltd']>-1) $data['ltd'] = strtotime('+1 year');
|
||||
$json_file = get_data_dir().'config/plugin_list.json';
|
||||
$json_file = get_data_dir($os).'config/plugin_list.json';
|
||||
if(!file_put_contents($json_file, json_encode($data))){
|
||||
throw new Exception('保存插件列表失败,文件无写入权限');
|
||||
}
|
||||
}
|
||||
|
||||
//获取插件列表
|
||||
public static function get_plugin_list(){
|
||||
$json_file = get_data_dir().'config/plugin_list.json';
|
||||
public static function get_plugin_list($os = 'Linux'){
|
||||
$json_file = get_data_dir($os).'config/plugin_list.json';
|
||||
if(file_exists($json_file)){
|
||||
$data = file_get_contents($json_file);
|
||||
$json_arr = json_decode($data, true);
|
||||
@@ -65,8 +70,8 @@ class Plugins
|
||||
}
|
||||
|
||||
//获取一个插件信息
|
||||
public static function get_plugin_info($name){
|
||||
$json_arr = self::get_plugin_list();
|
||||
public static function get_plugin_info($name, $os = 'Linux'){
|
||||
$json_arr = self::get_plugin_list($os);
|
||||
if(!$json_arr) return null;
|
||||
foreach($json_arr['list'] as $plugin){
|
||||
if($plugin['name'] == $name){
|
||||
@@ -77,30 +82,30 @@ class Plugins
|
||||
}
|
||||
|
||||
//下载插件(自动判断是否第三方)
|
||||
public static function download_plugin($plugin_name, $version){
|
||||
$plugin_info = Plugins::get_plugin_info($plugin_name);
|
||||
public static function download_plugin($plugin_name, $version, $os = 'Linux'){
|
||||
$plugin_info = Plugins::get_plugin_info($plugin_name, $os);
|
||||
if(!$plugin_info) throw new Exception('未找到该插件信息');
|
||||
if($plugin_info['type'] == 10 && isset($plugin_info['versions'][0]['download'])){
|
||||
if($plugin_info['price'] == 0){
|
||||
$btapi = self::get_btapi();
|
||||
$btapi = self::get_btapi($os);
|
||||
$btapi->create_plugin_other_order($plugin_info['id']);
|
||||
}
|
||||
$fname = $plugin_info['versions'][0]['download'];
|
||||
$filemd5 = $plugin_info['versions'][0]['md5'];
|
||||
Plugins::download_plugin_other($fname, $filemd5);
|
||||
Plugins::download_plugin_other($fname, $filemd5, $os);
|
||||
if(isset($plugin_info['min_image']) && strpos($plugin_info['min_image'], 'fname=')){
|
||||
$fname = substr($plugin_info['min_image'], strpos($plugin_info['min_image'], '?fname=')+7);
|
||||
Plugins::download_plugin_other($fname);
|
||||
Plugins::download_plugin_other($fname, null, $os);
|
||||
}
|
||||
}else{
|
||||
Plugins::download_plugin_package($plugin_name, $version);
|
||||
Plugins::download_plugin_package($plugin_name, $version, $os);
|
||||
}
|
||||
}
|
||||
|
||||
//下载插件包
|
||||
public static function download_plugin_package($plugin_name, $version){
|
||||
$filepath = get_data_dir().'plugins/package/'.$plugin_name.'-'.$version.'.zip';
|
||||
$btapi = self::get_btapi();
|
||||
public static function download_plugin_package($plugin_name, $version, $os = 'Linux'){
|
||||
$filepath = get_data_dir($os).'plugins/package/'.$plugin_name.'-'.$version.'.zip';
|
||||
$btapi = self::get_btapi($os);
|
||||
$result = $btapi->get_plugin_filename($plugin_name, $version);
|
||||
if($result && isset($result['status'])){
|
||||
if($result['status'] == true){
|
||||
@@ -110,12 +115,12 @@ class Plugins
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($filepath) === true)
|
||||
{
|
||||
$zip->extractTo(get_data_dir().'plugins/folder/'.$plugin_name.'-'.$version);
|
||||
$zip->extractTo(get_data_dir($os).'plugins/folder/'.$plugin_name.'-'.$version);
|
||||
$zip->close();
|
||||
$main_filepath = get_data_dir().'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py';
|
||||
$main_filepath = get_data_dir($os).'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py';
|
||||
if(file_exists($main_filepath) && filesize($main_filepath)>10){
|
||||
if(!strpos(file_get_contents($main_filepath), 'import ')){ //加密py文件,需要解密
|
||||
self::decode_plugin_main($plugin_name, $version, $main_filepath);
|
||||
self::decode_plugin_main($plugin_name, $version, $main_filepath, $os);
|
||||
self::noauth_plugin_main($main_filepath);
|
||||
$zip->open($filepath, ZipArchive::CREATE);
|
||||
$zip->addFile($main_filepath, $plugin_name.'/'.$plugin_name.'_main.py');
|
||||
@@ -138,9 +143,9 @@ class Plugins
|
||||
}
|
||||
|
||||
//下载插件主程序文件
|
||||
public static function download_plugin_main($plugin_name, $version){
|
||||
$filepath = get_data_dir().'plugins/main/'.$plugin_name.'-'.$version.'.dat';
|
||||
$btapi = self::get_btapi();
|
||||
public static function download_plugin_main($plugin_name, $version, $os = 'Linux'){
|
||||
$filepath = get_data_dir($os).'plugins/main/'.$plugin_name.'-'.$version.'.dat';
|
||||
$btapi = self::get_btapi($os);
|
||||
$result = $btapi->get_plugin_main_filename($plugin_name, $version);
|
||||
if($result && isset($result['status'])){
|
||||
if($result['status'] == true){
|
||||
@@ -160,8 +165,8 @@ class Plugins
|
||||
}
|
||||
|
||||
//解密并下载插件主程序文件
|
||||
public static function decode_plugin_main($plugin_name, $version, $main_filepath){
|
||||
$btapi = self::get_btapi();
|
||||
public static function decode_plugin_main($plugin_name, $version, $main_filepath, $os = 'Linux'){
|
||||
$btapi = self::get_btapi($os);
|
||||
$result = $btapi->get_decode_plugin_main($plugin_name, $version);
|
||||
if($result && isset($result['status'])){
|
||||
if($result['status'] == true){
|
||||
@@ -180,20 +185,29 @@ class Plugins
|
||||
public static function noauth_plugin_main($main_filepath){
|
||||
$data = file_get_contents($main_filepath);
|
||||
if(!$data) return false;
|
||||
|
||||
$data = str_replace('\'http://www.bt.cn/api/panel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list_test', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/panel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list_test', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/panel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/panel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/panel/notpro', 'public.GetConfigValue(\'home\')+\'/api/panel/notpro', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/panel/notpro', 'public.GetConfigValue(\'home\')+\'/api/panel/notpro', $data);
|
||||
|
||||
$data = str_replace('\'http://www.bt.cn/api/wpanel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list_test', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/wpanel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list_test', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/wpanel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/wpanel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
|
||||
|
||||
file_put_contents($main_filepath, $data);
|
||||
}
|
||||
|
||||
//下载插件其他文件
|
||||
public static function download_plugin_other($fname, $filemd5 = null){
|
||||
public static function download_plugin_other($fname, $filemd5 = null, $os = 'Linux'){
|
||||
$filepath = get_data_dir().'plugins/other/'.$fname;
|
||||
@mkdir(dirname($filepath), 0777, true);
|
||||
$btapi = self::get_btapi();
|
||||
$btapi = self::get_btapi($os);
|
||||
$result = $btapi->get_plugin_other_filename($fname);
|
||||
if($result && isset($result['status'])){
|
||||
if($result['status'] == true){
|
||||
@@ -244,4 +258,34 @@ class Plugins
|
||||
}
|
||||
}
|
||||
|
||||
//刷新一键部署列表
|
||||
public static function refresh_deplist($os = 'Linux'){
|
||||
$btapi = self::get_btapi($os);
|
||||
$result = $btapi->get_deplist();
|
||||
if($result && isset($result['list']) && isset($result['type'])){
|
||||
if(empty($result['list']) || empty($result['type'])){
|
||||
throw new Exception('获取一键部署列表失败:一键部署列表为空');
|
||||
}
|
||||
$json_file = get_data_dir($os).'config/deployment_list.json';
|
||||
if(!file_put_contents($json_file, json_encode($result))){
|
||||
throw new Exception('保存一键部署列表失败,文件无写入权限');
|
||||
}
|
||||
}else{
|
||||
throw new Exception('获取一键部署列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
|
||||
}
|
||||
}
|
||||
|
||||
//获取一键部署列表
|
||||
public static function get_deplist($os = 'Linux'){
|
||||
$json_file = get_data_dir($os).'config/deployment_list.json';
|
||||
if(file_exists($json_file)){
|
||||
$data = file_get_contents($json_file);
|
||||
$json_arr = json_decode($data, true);
|
||||
if($json_arr){
|
||||
return $json_arr;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
<div class="list-group-item"><span class="glyphicon glyphicon-stats"></span> <b>宝塔插件统计:</b>共有 {$stat.total} 个,其中免费插件 {$stat.free} 个,专业版插件 {$stat.pro} 个,企业版插件 {$stat.ltd} 个,第三方插件 {$stat.third} 个</div>
|
||||
<div class="list-group-item"><span class="glyphicon glyphicon-tint"></span> <b>使用记录统计:</b>历史总共数量:{$stat.record_total},正在使用数量:{$stat.record_isuse}</div>
|
||||
<div class="list-group-item"><span class="glyphicon glyphicon-time"></span> <b>任务运行情况:</b>上次运行时间:{$stat.runtime|raw} <a href="/admin/set/mod/task" class="btn btn-xs btn-info">查看详情</a></div>
|
||||
<div class="list-group-item"><span class="glyphicon glyphicon-cog"></span> <b>常用功能入口:</b><a href="/admin/plugins" class="btn btn-xs btn-default">插件列表</a> <a href="/admin/record" class="btn btn-xs btn-default">使用记录</a> <a href="/admin/black" class="btn btn-xs btn-default">黑白名单</a> <a href="/download" class="btn btn-xs btn-default" target="_blank">安装脚本</a></div>
|
||||
<div class="list-group-item"><span class="glyphicon glyphicon-cog"></span> <b>常用功能入口:</b><a href="/admin/plugins" class="btn btn-xs btn-default">插件列表</a> <a href="/admin/record" class="btn btn-xs btn-default">使用记录</a> <a href="/admin/list" class="btn btn-xs btn-default">黑白名单</a> <a href="/download" class="btn btn-xs btn-default" target="_blank">安装脚本</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-info">
|
||||
|
@@ -34,8 +34,12 @@
|
||||
<li class="{:checkIfActive('index')}">
|
||||
<a href="/admin"><i class="fa fa-home"></i> 后台首页</a>
|
||||
</li>
|
||||
<li class="{:checkIfActive('plugins')}">
|
||||
<a href="/admin/plugins"><i class="fa fa-cubes"></i> 插件列表</a>
|
||||
<li class="{:checkIfActive('plugins,pluginswin')}">
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="{:checkIfActive('record')}">
|
||||
<a href="/admin/record"><i class="fa fa-list"></i> 使用记录</a>
|
||||
|
@@ -28,7 +28,7 @@
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="active">
|
||||
<a href="./login.php"><span class="glyphicon glyphicon-user"></span> 登录</a>
|
||||
<a href="#"><span class="glyphicon glyphicon-user"></span> 登录</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
|
214
app/view/admin/pluginswin.html
Normal file
@@ -0,0 +1,214 @@
|
||||
{extend name="admin/layout" /}
|
||||
{block name="title"}插件列表{/block}
|
||||
{block name="main"}
|
||||
<style>
|
||||
td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;}
|
||||
.bt-ico-ask {
|
||||
border: 1px solid #fb7d00;
|
||||
border-radius: 8px;
|
||||
color: #fb7d00;
|
||||
cursor: help;
|
||||
display: inline-block;
|
||||
font-family: arial;
|
||||
font-size: 11px;
|
||||
font-style: normal;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
margin-left: 5px;
|
||||
text-align: center;
|
||||
width: 16px
|
||||
}
|
||||
.bt-ico-ask:hover {
|
||||
background-color: #fb7d00;
|
||||
color: #fff
|
||||
}
|
||||
</style>
|
||||
<div class="modal fade" id="help" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">帮助</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p>
|
||||
<p>官方插件包本地存储路径是/data/win/plugins/package/软件标识-版本号.zip,第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p>
|
||||
<p>点击【重新获取】按钮会从宝塔官方获取最新插件列表,但是插件包需要手动点击下载。如果需要批量下载插件包,可查看<a href="/admin/set/type/task">定时任务设置</a></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 center-block" style="float: none;">
|
||||
|
||||
<div id="searchToolbar">
|
||||
<form onsubmit="return searchSubmit()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<input type="text" class="form-control" name="keyword" placeholder="应用名称">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select name="type" class="form-control"><option value="0">全部插件</option>
|
||||
{foreach $typelist as $k=>$v}<option value="{$k}">{$v}</option>{/foreach} </select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>
|
||||
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i>重置</a>
|
||||
<a href="javascript:refresh_plugins()" class="btn btn-success"><i class="fa fa-refresh"></i>重新获取</a>
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#help"><i class="fa fa-info-circle"></i>帮助</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table id="listTable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
|
||||
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
|
||||
<script src="/static/js/custom.js"></script>
|
||||
<script>
|
||||
|
||||
function download_version(name, version, status){
|
||||
if(status == true){
|
||||
var confirm = layer.confirm('是否确定重新下载'+version+'版本插件包?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
download_plugin(name, version)
|
||||
}, function(){
|
||||
layer.close(confirm)
|
||||
});
|
||||
}else{
|
||||
download_plugin(name, version)
|
||||
}
|
||||
}
|
||||
|
||||
function download_plugin(name, version){
|
||||
var ii = layer.msg('正在下载,请稍候...', {icon: 16, shade:0.1, time: 0});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : '/admin/download_plugin',
|
||||
data: { name:name, version:version, os:'Windows'},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii)
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){layer.closeAll();searchSubmit();});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon:2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii)
|
||||
layer.msg('服务器错误', {icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function refresh_plugins(){
|
||||
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_plugins?os=Windows',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii)
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){layer.closeAll();searchSubmit();});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon:2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii)
|
||||
layer.msg('服务器错误', {icon:2});
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirm)
|
||||
});
|
||||
}
|
||||
|
||||
function searchByType(type){
|
||||
$("input[name=keyword]").val('');
|
||||
$("select[name=type]").val(type);
|
||||
searchSubmit()
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
updateToolbar();
|
||||
const defaultPageSize = 20;
|
||||
|
||||
$("#listTable").bootstrapTable({
|
||||
url: '/admin/plugins_data?os=Windows',
|
||||
pageNumber: 1,
|
||||
pageSize: 15,
|
||||
sidePagination: 'client',
|
||||
classes: 'table table-striped table-hover table-bottom-border',
|
||||
columns: [
|
||||
{
|
||||
field: 'name',
|
||||
title: '软件标识',
|
||||
formatter: function(value, row, index) {
|
||||
return '<b>'+value+'</b>';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '软件名称'
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '软件分类',
|
||||
formatter: function(value, row, index) {
|
||||
return '<a href="javascript:searchByType('+value+')" title="查看该分类下的插件">'+row.typename+'</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'desc',
|
||||
title: '说明',
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
title: '价格',
|
||||
formatter: function(value, row, index) {
|
||||
return value > 0 ? '<span style="color:#fc6d26">¥'+value+'</span>' : '免费';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'author',
|
||||
title: '开发商'
|
||||
},
|
||||
{
|
||||
field: 'versions',
|
||||
title: '版本与状态',
|
||||
formatter: function(value, row, index) {
|
||||
var html = '';
|
||||
if(row.type == 5){
|
||||
html += '<a href="javascript:" class="btn btn-xs btn-success" disabled>无需下载</a>';
|
||||
}else{
|
||||
$.each(value, function(index,item){
|
||||
if(item.status)
|
||||
html += '<a href="javascript:download_version(\''+row.name+'\',\''+item.version+'\','+item.status+')" class="btn btn-xs btn-success">'+item.version+'</a> ';
|
||||
else
|
||||
html += '<a href="javascript:download_version(\''+row.name+'\',\''+item.version+'\','+item.status+')" class="btn btn-xs btn-danger">'+item.version+'</a> ';
|
||||
})
|
||||
}
|
||||
return html
|
||||
}
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{/block}
|
@@ -19,19 +19,34 @@
|
||||
<font color="green">页面地址:<a href="/download" target="_blank">/download</a>,开启后可以公开访问,否则只能管理员访问</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔面板最新版本号:</label>
|
||||
<label>宝塔Linux面板最新版本号:</label>
|
||||
<input type="text" name="new_version" value="{:config_get('new_version')}" class="form-control"/>
|
||||
<font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/install/update/放置对应版本更新包</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔面板最新版更新日志:</label>
|
||||
<label>宝塔Linux面板更新日志:</label>
|
||||
<textarea class="form-control" name="update_msg" rows="5" placeholder="支持HTML代码">{:config_get('update_msg')}</textarea>
|
||||
<font color="green">用于检测更新接口返回</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔面板最新版更新日期:</label>
|
||||
<label>宝塔Linux面板更新日期:</label>
|
||||
<input type="date" name="update_date" value="{:config_get('update_date')}" class="form-control"/>
|
||||
<font color="green">用于检测更新接口返回</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔Windows面板最新版本号:</label>
|
||||
<input type="text" name="new_version_win" value="{:config_get('new_version_win')}" class="form-control"/>
|
||||
<font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/win/panel/放置对应版本更新包</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔Windows面板更新日志:</label>
|
||||
<textarea class="form-control" name="update_msg_win" rows="5" placeholder="支持HTML代码">{:config_get('update_msg_win')}</textarea>
|
||||
<font color="green">用于检测更新接口返回</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔Windows面板更新日期:</label>
|
||||
<input type="date" name="update_date_win" value="{:config_get('update_date_win')}" class="form-control"/>
|
||||
<font color="green">用于检测更新接口返回</font>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
|
||||
@@ -40,7 +55,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">宝塔面板接口设置</h3></div>
|
||||
<div class="panel-heading"><h3 class="panel-title">宝塔Linux面板接口设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
|
||||
<p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取最新插件列表及插件包</p>
|
||||
@@ -61,6 +76,29 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">宝塔Windows面板接口设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
|
||||
<p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取最新插件列表及插件包</p>
|
||||
<p><a href="/static/file/win/kaixin.zip">下载专用插件</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
|
||||
<p><a href="/static/file/win/__init__.zip">下载py替换文件</a>,解压覆盖到C:\Program Files\python\Lib\json\目录下,然后重启面板。</p>
|
||||
<div class="form-group">
|
||||
<label>宝塔面板URL:</label><br/>
|
||||
<input type="text" name="wbt_url" value="{:config_get('wbt_url')}" class="form-control"/>
|
||||
<font color="green">填写规则如:<u>http://192.168.1.1:8888</u> ,不要带其他后缀</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>宝塔面板接口密钥:</label>
|
||||
<input type="text" name="wbt_key" value="{:config_get('wbt_key')}" class="form-control"/>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<button type="button" class="btn btn-info btn-block" id="testbturl2">测试连接</button>
|
||||
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{elseif $mod=='task'}
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading"><h3 class="panel-title">定时任务说明</h3></div>
|
||||
@@ -78,9 +116,13 @@
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
|
||||
<div class="form-group">
|
||||
<label>批量下载插件范围:</label><br/>
|
||||
<label>Linux面板批量下载插件范围:</label><br/>
|
||||
<select class="form-control" name="updateall_type" default="{:config_get('updateall_type')}"><option value="0">仅免费插件</option><option value="1">免费插件+专业版插件</option><option value="2">免费插件+专业版插件+企业版插件</option></select><font color="green">(批量下载不包含所有第三方插件,第三方插件需要去手动下载。)</font>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Windows面板批量下载插件范围:</label><br/>
|
||||
<select class="form-control" name="updateall_type_win" default="{:config_get('updateall_type_win')}"><option value="0">仅免费插件</option><option value="1">免费插件+专业版插件</option><option value="2">免费插件+专业版插件+企业版插件</option></select><font color="green">(批量下载不包含所有第三方插件,第三方插件需要去手动下载。)</font>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
|
||||
</div>
|
||||
@@ -153,6 +195,38 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
})
|
||||
$("#testbturl2").click(function(){
|
||||
var wbt_url = $("input[name=wbt_url]").val();
|
||||
var wbt_key = $("input[name=wbt_key]").val();
|
||||
if(wbt_url == ''){
|
||||
layer.alert('宝塔面板URL不能为空');return;
|
||||
}
|
||||
if(wbt_url.indexOf('http://')==-1 && wbt_url.indexOf('https://')==-1){
|
||||
layer.alert('宝塔面板URL不正确');return;
|
||||
}
|
||||
if(wbt_key == ''){
|
||||
layer.alert('宝塔面板接口密钥不能为空');return;
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : '/admin/testbturl',
|
||||
data : {bt_url:wbt_url, bt_key:wbt_key},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg, {icon: 1, time:1000})
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.close(ii);
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
function saveSetting(obj){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
|
@@ -20,12 +20,47 @@
|
||||
<p>2分钟装好面板,一键管理服务器</p>
|
||||
<p>集成LAMP/LNMP环境安装,网站、FTP、数据库、文件管理、软件安装等功能</p>
|
||||
</div>
|
||||
<div class="mt_30 i1ta wap_mt15">
|
||||
<a href="https://demo.bt.cn" target="_block" rel="noreferrer">查看演示</a>
|
||||
<a href="javascript:;" id="goInstallLinux">
|
||||
<img class="middle mr10" src="/static/images/i1aico_03.png">
|
||||
立即免费安装
|
||||
</a>
|
||||
<div class="disflex flex_lrcenter mt_50 install-list">
|
||||
<div class="install-box linux">
|
||||
<div class="img">
|
||||
<img src="/static/images/prd_1_03.png">
|
||||
</div>
|
||||
<div class="cont">
|
||||
<div class="top">
|
||||
<div class="title">Linux面板 {:config_get('new_version')}</div>
|
||||
<div class="desc">
|
||||
支持Centos、Ubuntu、Deepin、Debian、Fedora等Linux系统。
|
||||
<a class="link" href="https://demo.bt.cn/login" target="_blank" style="margin-left: 5px; font-weight: 700" rel="noreferrer">查看演示</a>
|
||||
</div>
|
||||
<div class="mark">
|
||||
<span>2分钟装好</span>
|
||||
<span>阿里云推荐</span>
|
||||
<span>腾讯云推荐</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<a class="btn" href="javascript:;" id="goInstallLinux">查看安装脚本</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="install-box windows">
|
||||
<div class="img">
|
||||
<img src="/static/images/prd_2_03.png">
|
||||
</div>
|
||||
<div class="cont">
|
||||
<div class="top">
|
||||
<div class="title">Windows面板 {:config_get('new_version_win')}</div>
|
||||
<div class="desc">支持Windows Server 2008 R2/2012/2016/2019,64位系统</div>
|
||||
<div class="mark">
|
||||
<span>操作简单</span>
|
||||
<span>使用方便</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<a class="btn" href="javascript:;" id="goInstallWindows">查看安装方法</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,7 +68,7 @@
|
||||
<div class="d2" id="instal-linux">
|
||||
<div class="wrap">
|
||||
<div class="wrap-title linux-title">
|
||||
<div class="text">使用此云端的宝塔面板(版本:{:config_get('new_version')})</div>
|
||||
<div class="text">Linux面板{:config_get('new_version')}安装脚本</div>
|
||||
</div>
|
||||
<div class="desc">
|
||||
使用 SSH 连接工具,如
|
||||
@@ -70,13 +105,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d4" id="instal-cloud">
|
||||
<div class="d4" id="instal-windows">
|
||||
<div class="wrap">
|
||||
<div class="wrap-title">
|
||||
<div class="text">更新日志</div>
|
||||
<div class="text">Windows面板{:config_get('new_version_win')}安装方法</div>
|
||||
</div>
|
||||
<div class="desc">
|
||||
<p>宝塔Linux面板更新到{:config_get('new_version')}</p>
|
||||
<p>1、使用<a class="link" href="https://download.bt.cn/win/panel/BtSoft.zip" target="_blank" rel="noreferrer">官方安装程序</a>进行安装,安装完先不要进入面板。</p>
|
||||
<p>2、在命令提示符(cmd)输入以下一键更新命令,然后重启面板。</p>
|
||||
</div>
|
||||
<div class="install-code">
|
||||
<div class="code-cont">
|
||||
<div class="command" title="点击复制一键更新命令">wget {$siteurl}/win/panel/data/setup.py -O C:/update.py && "C:\Program Files\python\python.exe" C:/update.py update_panel {:config_get('new_version_win')}</div>
|
||||
<span class="ico-copy" title="点击复制一键更新命令" data-clipboard-text="wget {$siteurl}/win/panel/data/setup.py -O C:/update.py && "C:\Program Files\python\python.exe" C:/update.py update_panel {:config_get('new_version_win')}">复制</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tips" style="color: orangered; font-weight: 700">
|
||||
<p>注意:仅支持Windows Server 2008 R2/2012/2016/2019,64位系统(中文简体),且未安装其它环境</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,8 +178,8 @@
|
||||
scrollTop('#instal-linux');
|
||||
});
|
||||
|
||||
$('#goOnlineInstall').click(function () {
|
||||
scrollTop('#online-instal');
|
||||
$('#goInstallWindows').click(function () {
|
||||
scrollTop('#instal-windows');
|
||||
});
|
||||
|
||||
$('#goInstallCloud').click(function () {
|
||||
|
1
data/config/deployment_list.json
Normal file
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 162 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 917 B |
Before Width: | Height: | Size: 971 B |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 896 B |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 819 B |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 16 KiB |