Compare commits

..

5 Commits
1.0 ... 1.0.3

Author SHA1 Message Date
flucont
4689707987 自动去除插件授权 2022-06-07 14:21:19 +08:00
flucont
17d2025d8c update readme 2022-06-06 15:27:30 +08:00
flucont
e1ecf15c99 update readme 2022-06-06 15:18:29 +08:00
flucont
9067cb7b3c 第三方插件支持自动购买 2022-06-06 15:17:54 +08:00
flucont
a3eafecde5 fix unlink 2022-06-04 23:49:34 +08:00
9 changed files with 73 additions and 13 deletions

View File

@@ -44,5 +44,14 @@
- [bt官方更新包修改记录](./wiki/update.md)
- 宝塔面板官方版与此第三方云端版对比:
| | 官方版 | 此第三方云端版 |
| ---------- | ------------------------------------------------------------ | -------------------------------------------------- |
| 版本更新 | 支持 | 支持 |
| 面板广告 | 有广告 | 无广告 |
| 是否全开源 | 没有全开源 | 全开源 |
| 资源占用 | 各种统计上报等任务,资源占用略高 | 去除了很多无用的定时任务,资源占较少 |
| 兼容性 | 由于编译的so文件有系统架构限制兼容的系统仅限已编译的so对应的系统架构 | 由于全开源没有已编译的so文件因此无系统架构限制 |

View File

@@ -43,13 +43,19 @@ 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)){
sleep(1);
$this->download_plugin($input, $output, $plugin['name'], $ver);
}
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)){
sleep(1);
$this->download_plugin($input, $output, $plugin['name'], $ver);
}
sleep(1);
$count++;
}
@@ -59,7 +65,7 @@ class UpdateAll extends Command
$imgcount = 0;
//循环下载缺少的插件图片
foreach($json_arr['list'] as $plugin){
/*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)){
@@ -68,7 +74,7 @@ class UpdateAll extends Command
$imgcount++;
}
}
}
}*/
$output->writeln('本次成功下载'.$count.'个插件'.($imgcount>0?''.$imgcount.'个图片':''));
config_set('runtime', date('Y-m-d H:i:s'));

View File

@@ -190,6 +190,7 @@ class Admin extends BaseController
$versions[] = ['status'=>$status, 'type'=>0, 'version'=>$ver];
}
}
if($plugin['name'] == 'obs') $plugin['ps'] = substr($plugin['ps'],0,strpos($plugin['ps'],'<a '));
$list[] = [
'id' => $plugin['id'],
'name' => $plugin['name'],

View File

@@ -130,6 +130,21 @@ class Btapi
return $data;
}
//购买第三方插件
public function create_plugin_other_order($pid){
$url = $this->BT_PANEL.'/auth?action=create_plugin_other_order';
$p_data = $this->GetKeyData();
$p_data['pid'] = $pid;
$p_data['cycle'] = '999';
$p_data['type'] = '0';
$result = $this->curl($url,$p_data);
$data = json_decode($result,true);
return $data;
}
private function GetKeyData(){
$now_time = time();

View File

@@ -26,7 +26,7 @@ class Plugins
}
self::save_plugin_list($result);
}else{
throw new Exception('获取插件列表失败:'.($result['msg']?$result['msg']:'面板连接失败'));
throw new Exception('获取插件列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
}
}
@@ -81,6 +81,10 @@ class Plugins
$plugin_info = Plugins::get_plugin_info($plugin_name);
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->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);
@@ -112,6 +116,7 @@ class Plugins
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::noauth_plugin_main($main_filepath);
$zip->open($filepath, ZipArchive::CREATE);
$zip->addFile($main_filepath, $plugin_name.'/'.$plugin_name.'_main.py');
$zip->close();
@@ -171,6 +176,19 @@ 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);
file_put_contents($main_filepath, $data);
}
//下载插件其他文件
public static function download_plugin_other($fname, $filemd5 = null){
$filepath = get_data_dir().'plugins/other/'.$fname;
@@ -183,7 +201,7 @@ class Plugins
self::download_file($btapi, $filename, $filepath);
if(file_exists($filepath)){
if($filemd5 && md5_file($filepath) != $filemd5){
unlink($filepath);
@unlink($filepath);
throw new Exception('插件文件MD5校验失败');
}
return true;
@@ -203,7 +221,7 @@ class Plugins
try{
$btapi->download($filename, $filepath);
}catch(Exception $e){
unlink($filepath);
@unlink($filepath);
//宝塔bug小文件下载失败改用base64下载
$result = $btapi->get_file($filename);
if($result && isset($result['status']) && $result['status']==true){

View File

@@ -34,7 +34,7 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
</div>
<div class="modal-body">
<p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p>
<p>插件包本地存储路径是/data/plugins/package/软件标识-版本号.zip对于部分包含二次验证的插件可以自行修改。</p>
<p>官方插件包本地存储路径是/data/plugins/package/软件标识-版本号.zip第三方插件包路径是/data/plugins/other/other/对于部分包含二次验证的插件可以自行修改。</p>
<p>点击【重新获取】按钮会从宝塔官方获取最新插件列表,但是插件包需要手动点击下载。如果需要批量下载插件包,可查看<a href="/admin/set/type/task">定时任务设置</a></p>
</div>
<div class="modal-footer">

View File

@@ -67,6 +67,7 @@
<div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="alert alert-info">使用以下命令可以从宝塔官方获取最新的插件列表并批量下载插件包(增量更新)。<br/>你也可以将此命令添加到crontab以使此云端的插件保持最新建议1天执行1次。</div>
<div class="alert alert-danger">使用命令执行之后,可能会导致 /data 目录下文件权限不对,后台插件列表下载插件覆盖会报错,需要手动循环设置 /data 目录权限。</div>
<div class="alert alert-warning">上次运行时间:{$runtime|raw}</div>
<div class="list-group-item">php {:app()->getRootPath()}think updateall</div><br/>
</form>

View File

@@ -43,10 +43,17 @@
,根据系统执行相应命令开始安装:
</div>
<div class="install-code">
<span class="osname">一键安装脚本</span>
<span class="osname">Centos安装脚本</span>
<div class="code-cont">
<div class="command" title="点击复制一键安装脚本">wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh</div>
<span class="ico-copy" title="点击复制一键安装脚本" data-clipboard-text="wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh">复制</span>
<div class="command" title="点击复制Centos安装脚本">yum install -y wget && wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh</div>
<span class="ico-copy" title="点击复制Centos安装脚本" data-clipboard-text="yum install -y wget && wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh">复制</span>
</div>
</div>
<div class="install-code">
<span class="osname">Ubuntu/Debian安装脚本</span>
<div class="code-cont">
<div class="command" title="点击复制Ubuntu/Debian安装脚本">wget -O install.sh {$siteurl}/install/install_6.0.sh && bash install.sh</div>
<span class="ico-copy" title="点击复制Ubuntu/Debian安装脚本" data-clipboard-text="wget -O install.sh {$siteurl}/install/install_6.0.sh && bash install.sh">复制</span>
</div>
</div>
<div class="install-code">

View File

@@ -14,6 +14,8 @@ Route::post('/panel/get_unbinding', 'api/return_success');
Route::post('/bt_cert', 'api/return_error');
Route::group('api', function () {
Route::any('/panel/get_soft_list', 'api/get_plugin_list');
Route::any('/panel/get_soft_list_test', 'api/get_plugin_list');
Route::get('/getUpdateLogs', 'api/get_update_logs');
Route::get('/panel/get_version', 'api/get_version');
Route::get('/SetupCount', 'api/setup_count');
@@ -41,6 +43,7 @@ Route::group('api', function () {
Route::post('/Plugin/get_re_order_status', 'api/return_error');
Route::post('/Plugin/create_order_voucher', 'api/return_error');
Route::post('/Plugin/get_voucher', 'api/return_empty_array');
Route::post('/Plugin/check_plugin_status', 'api/return_success');
Route::post('/invite/get_voucher', 'api/return_empty_array');
Route::post('/invite/get_order_status', 'api/return_error');
@@ -62,7 +65,7 @@ Route::group('api', function () {
Route::post('/panel/model_total', 'api/return_empty');
Route::post('/wpanel/model_click', 'api/return_empty');
Route::post('/v2/statistics/report_plugin_daily', 'api/return_error');
Route::post('/panel/notpro', 'api/return_empty');
Route::get('/panel/notpro', 'api/return_empty');
Route::post('/LinuxBeta', 'api/return_error');
Route::post('/panel/apple_beta', 'api/return_error');