diff --git a/app/command/CleanViteJs.php b/app/command/CleanViteJs.php index 62ca4e4..9f5c43a 100644 --- a/app/command/CleanViteJs.php +++ b/app/command/CleanViteJs.php @@ -101,6 +101,7 @@ class CleanViteJs extends Command } private function handlefile($filepath){ + //echo $filepath."\n"; $file = file_get_contents($filepath); if(!$file)return; @@ -119,8 +120,24 @@ class CleanViteJs extends Command } $flag = true; } + + if(strpos($file, '"点击打开调查问卷"')!==false){ //index + $code = $this->getExtendCode($file, '"点击打开调查问卷"', 2); + if($code){ + $file = str_replace($code, '{}', $file); + } + $flag = true; + } + + if(strpos($file, '您有{0}个优惠券待领取')!==false){ //win-index + $code = $this->getExtendCode($file, 'isGetCoupon:', 2); + if($code){ + $file = str_replace($code, '{}', $file); + } + $flag = true; + } - if(strpos($file, '论坛求助')!==false){ //main + if(strpos($file, '论坛求助')!==false && strpos($file, '"/other/customer-qrcode.png"')!==false){ //main $code = $this->getExtendCode($file, '"微信公众号"', 1); $code = $this->getExtendFunction($file, $code); $start = strpos($file, $code) - 1; @@ -153,6 +170,12 @@ class CleanViteJs extends Command } $flag = true; } + + if(strpos($file, '"sqlserver管理"')!==false && strpos($file, '"iis管理"')!==false){ //win-utils + $file = preg_replace('!"calc"===\w+\.\w+\.type!', '!1', $file); + $file = preg_replace('!"input"===\w+\.\w+\.type!', '!1', $file); + $flag = true; + } if(strpos($file, '请冷静几秒钟,确认以下要删除的数据')!==false && strpos($file, '"计算结果:"')!==false){ //site $code = $this->getExtendCode($file, '"计算结果:"', 1, '[', ']'); @@ -206,17 +229,27 @@ class CleanViteJs extends Command if(strpos($file, '"商用SSL"')!==false){ //ssl $code = $this->getExtendFunction($file, '"商用SSL"', '{', '}'); $file = str_replace($code, '', $file); - $code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']'); - if($code){ - $file = str_replace($code, '[]', $file); - } - $code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']'); - if($code){ - $file = str_replace($code, '[]', $file); + $code = $this->getExtendFunction($file, '"宝塔证书"', '{', '}'); + $file = str_replace($code, '', $file); + for($i=0;$i<3;$i++){ + $code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']'); + if($code){ + $file = str_replace($code, '[]', $file); + } } + $flag = true; } if(strpos($file, '"SSL-CERTIFICATE-STORE"')!==false){ //ssl - $file = str_replace('("ssl")', '("encrypt")', $file); + $file = str_replace('("bt")', '("encrypt")', $file); + $flag = true; + } + + if(strpos($file, '"商业证书"')!==false && strpos($file, 'name:"busSslList"')!==false && strpos($file, 'IIS配置')!==false){ //win-ssl + $code = $this->getExtendFunction($file, 'name:"busSslList"', '{', '}'); + $file = str_replace($code, '', $file); + $code = $this->getExtendFunction($file, 'name:"trustAsiaList"', '{', '}'); + $file = str_replace($code, '', $file); + $file = $this->str_replace_once('"busSslList"', '"currentCertInfo"', $file); $flag = true; } @@ -234,7 +267,7 @@ class CleanViteJs extends Command $flag = true; } - if(strpos($file, '"打开插件文件目录"')!==false){ //soft.table + if(strpos($file, '"打开插件文件目录"')!==false && strpos($file, '"(续费)"')!==false){ //soft.table $code = $this->getExtendFunction($file, '"(续费)"'); $file = str_replace($code, '""', $file); $flag = true; diff --git a/app/command/UpdateAll.php b/app/command/UpdateAll.php index 75a82a9..3fd6336 100644 --- a/app/command/UpdateAll.php +++ b/app/command/UpdateAll.php @@ -57,7 +57,7 @@ class UpdateAll extends Command $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; + if($type == 0 && ($plugin['type']==8 || $plugin['type']==12 || in_array($plugin['name'], \app\lib\BtPlugins::$skip_plugins)) || $type == 1 && $plugin['type']==12 || $plugin['type']==10 || $plugin['type']==5) continue; foreach($plugin['versions'] as $version){ $ver = $version['m_version'].'.'.$version['version']; diff --git a/app/controller/Admin.php b/app/controller/Admin.php index 2a7f71d..25c3577 100644 --- a/app/controller/Admin.php +++ b/app/controller/Admin.php @@ -144,18 +144,33 @@ class Admin extends BaseController }else{ $bt_url = input('post.bt_url'); $bt_key = input('post.bt_key'); + $os = input('post.os'); 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 || isset($result['sites_path']))){ - $result = $btapi->get_user_info(); - if($result && isset($result['username'])){ - return json(['code'=>0, 'msg'=>'面板连接测试成功!']); + if ($os == 'win') { + $result = $btapi->get_config_go(); + if($result && isset($result['config'])){ + $result = $btapi->get_user_info(); + if($result && isset($result['username'])){ + return json(['code'=>0, 'msg'=>'面板连接测试成功!']); + }else{ + return json(['code'=>-1, 'msg'=>'面板连接测试成功,但未安装专用插件/未登录账号']); + } }else{ - return json(['code'=>-1, 'msg'=>'面板连接测试成功,但未安装专用插件/未登录账号']); + return json(['code'=>-1, 'msg'=>isset($result['msg'])?$result['msg']:'面板地址无法连接']); + } + } else { + $result = $btapi->get_config(); + 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'=>'面板连接测试成功!']); + }else{ + return json(['code'=>-1, 'msg'=>'面板连接测试成功,但未安装专用插件/未登录账号']); + } + }else{ + return json(['code'=>-1, 'msg'=>isset($result['msg'])?$result['msg']:'面板地址无法连接']); } - }else{ - return json(['code'=>-1, 'msg'=>isset($result['msg'])?$result['msg']:'面板地址无法连接']); } } } @@ -170,6 +185,7 @@ class Admin extends BaseController } } View::assign('typelist', $typelist); + View::assign('skip_plugins', \app\lib\BtPlugins::$skip_plugins); return view(); } diff --git a/app/controller/Api.php b/app/controller/Api.php index 630e6bc..877da87 100644 --- a/app/controller/Api.php +++ b/app/controller/Api.php @@ -19,13 +19,16 @@ class Api extends BaseController Db::name('record')->insert(['ip'=>$this->clientip, 'addtime'=>date("Y-m-d H:i:s"), 'usetime'=>date("Y-m-d H:i:s")]); } $json_arr = Plugins::get_plugin_list(); - if(!$json_arr) return json((object)[]); + if(!$json_arr) $json_arr = (object)[]; return json($json_arr); } //获取插件列表(win) public function get_plugin_list_win(){ if(!$this->checklist()) return json('你的服务器被禁止使用此云端'); + $os_version = input('post.os_version'); + $serverid = input('post.serverid'); + $uid = input('post.uid'); $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")]); @@ -33,7 +36,10 @@ class Api extends BaseController Db::name('record')->insert(['ip'=>$this->clientip, 'addtime'=>date("Y-m-d H:i:s"), 'usetime'=>date("Y-m-d H:i:s")]); } $json_arr = Plugins::get_plugin_list('Windows'); - if(!$json_arr) return json((object)[]); + if(!$json_arr) $json_arr = (object)[]; + if($os_version == 'windows_go'){ + return Plugins::encrypt_plugin_list($json_arr, $serverid, $uid); + } return json($json_arr); } @@ -47,49 +53,49 @@ class Api extends BaseController Db::name('record')->insert(['ip'=>$this->clientip, 'addtime'=>date("Y-m-d H:i:s"), 'usetime'=>date("Y-m-d H:i:s")]); } $json_arr = Plugins::get_plugin_list('en'); - if(!$json_arr) return json((object)[]); + if(!$json_arr) $json_arr = (object)[]; return json($json_arr); } //下载插件包 public function download_plugin(){ - $plugin_name = input('post.name'); - $version = input('post.version'); - $os = input('post.os'); + $plugin_name = input('param.name'); + $version = input('param.version'); + $os = input('param.os'); if(!$plugin_name || !$version){ - return '参数不能为空'; + return json(['status'=>false, 'msg'=>'参数不能为空']); } if(!in_array($os,['Windows','Linux'])) $os = 'Linux'; if(!preg_match('/^[a-zA-Z0-9_]+$/', $plugin_name) || !preg_match('/^[0-9.]+$/', $version)){ - return '参数不正确'; + return json(['status'=>false, 'msg'=>'参数不正确']); } - if(!$this->checklist()) return '你的服务器被禁止使用此云端'; + if(!$this->checklist()) return json(['status'=>false, 'msg'=>'你的服务器被禁止使用此云端']); $filepath = get_data_dir($os).'plugins/package/'.$plugin_name.'-'.$version.'.zip'; if(file_exists($filepath)){ $filename = $plugin_name.'.zip'; $this->output_file($filepath, $filename); }else{ - return '云端不存在该插件包'; + return json(['status'=>false, 'msg'=>'云端不存在该插件包']); } } //下载插件包aapanel public function download_plugin_en(){ - $plugin_name = input('post.name'); - $version = input('post.version'); + $plugin_name = input('param.name'); + $version = input('param.version'); if(!$plugin_name || !$version){ - return '参数不能为空'; + return json(['status'=>false, 'msg'=>'参数不能为空']); } if(!preg_match('/^[a-zA-Z0-9_]+$/', $plugin_name) || !preg_match('/^[0-9.]+$/', $version)){ - return '参数不正确'; + return json(['status'=>false, 'msg'=>'参数不正确']); } - if(!$this->checklist()) return '你的服务器被禁止使用此云端'; + if(!$this->checklist()) return json(['status'=>false, 'msg'=>'你的服务器被禁止使用此云端']); $filepath = get_data_dir('en').'plugins/package/'.$plugin_name.'-'.$version.'.zip'; if(file_exists($filepath)){ $filename = $plugin_name.'.zip'; $this->output_file($filepath, $filename); }else{ - return '云端不存在该插件包'; + return json(['status'=>false, 'msg'=>'云端不存在该插件包']); } } @@ -99,13 +105,13 @@ class Api extends BaseController $version = input('post.version'); $os = input('post.os'); if(!$plugin_name || !$version){ - return '参数不能为空'; + return json(['status'=>false, 'msg'=>'参数不能为空']); } if(!in_array($os,['Windows','Linux'])) $os = 'Linux'; if(!preg_match('/^[a-zA-Z0-9_]+$/', $plugin_name) || !preg_match('/^[0-9.]+$/', $version)){ - return '参数不正确'; + return json(['status'=>false, 'msg'=>'参数不正确']); } - if(!$this->checklist()) return '你的服务器被禁止使用此云端'; + if(!$this->checklist()) return json(['status'=>false, 'msg'=>'你的服务器被禁止使用此云端']); $filepath = get_data_dir($os).'plugins/package/'.$plugin_name.'-'.$version.'.zip'; $mainfilepath = get_data_dir($os).'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py'; if(file_exists($mainfilepath)){ @@ -116,10 +122,10 @@ class Api extends BaseController if ($zip->open($filepath) === true){ echo $zip->getFromName($plugin_name.'/'.$plugin_name.'_main.py'); }else{ - return '插件包解压缩失败'; + return json(['status'=>false, 'msg'=>'插件包解压缩失败']); } }else{ - return '云端不存在该插件主文件'; + return json(['status'=>false, 'msg'=>'云端不存在该插件主文件']); } } @@ -143,6 +149,36 @@ class Api extends BaseController } } + public function get_plugin_auth(){ + $productids = ["8","9","10","11","12","13","14","15","16","17","18","19","20","22","23","24","25","26","28","32","33","42","44","45","47","55","65","69","75","82","83","85","90","91","97","99","101","107","108","110","118","121","127","128","132","135","136","140","143","144","151","154","156","161","163","167","173","179","183","185","190","192","195","197","200","201","202","203","204","205","206","207","208","212","213","214","215","216","217","218","219","220","221","222","223","224","225","226","227","228","229","230","231","232","233","234","235","236","237","238","239","241","243","244","245","246","247","248","249","250","251","252","253","254","255","256","257","258","259","261","262","263","264","265","266","267","268","269","270","271","272","273","274","275","276","277","278","279","280","281","282","283","284","285","286","287","289","292","293","295","296","297","298","299","300","301","302","303","304","305","306","307","308","309","310","311","312","313","314","315","316","317","318","319","320","321","322","323","324","325","326","327","328","329","330","331","332","334","335","336","337","338","339","340","341","342","343","344","345","346","347","348","349","350","351","352","353","354","355","356","357","358","359","360","361","362","363","364","365","366","368","369","371","372","373","374","375","376","377","378","379","380","381","382","383","384","385","386","387","388","389","390","391","392","393","394","397","398","400","401","406","408","409","411","413","415","419","423","425","427","429","430","1111111","100000001","100000005","100000007","100000008","100000009","100000010","100000012","100000014","100000015","100000016","100000017","100000035","100000036","100000039","100000040","100000041","100000042","100000045","100000053","100000054","100000056","100000057","100000058","100000059","100000062","100000063","100000067","100000069","100000070","100000076","100000077","100000078","100000079","100000080","100000084","100000085","100000088","100000089","100000090","100000091","100000092","100000093","100000094","100000095","100000096","100000097","100000098"]; + $os_version = input('post.os_version'); + $address = input('post.address',''); + $uid = input('post.uid',''); + $username = input('post.username',''); + $serverid = input('post.serverid',''); + $mac = input('post.mac',''); + $data = ['ip'=>$address, 'uid'=>$uid, 'username'=>$username, 'serverid'=>$serverid, 'lasttime'=>time(), 'pro'=>-1, 'skey'=>'', 'ltd'=>strtotime('+10 year'), 'list'=>[]]; + foreach($productids as $pid){ + $data['list'][$pid] = strtotime('+10 year'); + } + return Plugins::encrypt_plugin_list($data, $serverid, $uid); + } + + public function get_plugin_auth_win(){ + $productids = ["49","50","51","52","53","54","56","57","58","59","60","61","67","68","72","76","80","84","88","89","92","93","119","120","133","134","137","138","139","142","145","146","150","168","169","170","172","176","184","396","404","414","420","422","424","426","428","100000001","100000018","100000019","100000024","100000026","100000027","100000028","100000031","100000039","100000043","100000047","100000048","100000049","100000051","100000052","100000060","100000061","100000064","100000067","100000075"]; + $os_version = input('post.os_version'); + $address = input('post.address',''); + $uid = input('post.uid',''); + $username = input('post.username',''); + $serverid = input('post.serverid',''); + $mac = input('post.mac',''); + $data = ['ip'=>$address, 'uid'=>$uid, 'username'=>$username, 'serverid'=>$serverid, 'lasttime'=>time(), 'pro'=>-1, 'skey'=>'', 'ltd'=>strtotime('+10 year'), 'list'=>[]]; + foreach($productids as $pid){ + $data['list'][$pid] = strtotime('+10 year'); + } + return Plugins::encrypt_plugin_list($data, $serverid, $uid); + } + public function get_update_logs(){ $type = input('get.type'); if($type == 'Windows'){ diff --git a/app/lib/BtPlugins.php b/app/lib/BtPlugins.php index 9aaafb4..4bde656 100644 --- a/app/lib/BtPlugins.php +++ b/app/lib/BtPlugins.php @@ -9,9 +9,10 @@ class BtPlugins { private $btapi; private $os; - + //需屏蔽的插件名称列表 - private static $block_plugins = ['dns','bt_boce','ssl_verify']; + public static $block_plugins = ['dns', 'bt_boce', 'ssl_verify', 'firewall', 'KylinOperatingSystem', 'KingdeeApusicDistributedCache', 'BorlandCacheServer', 'GBase8s', 'KingdeeApusicLoadBalancer', 'BorlandWebServer']; + public static $skip_plugins = ['php_filter', 'enterprise_backup', 'tamper_drive']; public function __construct($os){ $this->os = $os; diff --git a/app/lib/Btapi.php b/app/lib/Btapi.php index 6a2269b..c736d7f 100644 --- a/app/lib/Btapi.php +++ b/app/lib/Btapi.php @@ -26,6 +26,17 @@ class Btapi return $data; } + public function get_config_go(){ + $url = $this->BT_PANEL.'/panel/get_config'; + + $p_data = $this->GetKeyData(); + + $result = $this->curl($url,$p_data); + + $data = json_decode($result,true); + return $data; + } + //获取已登录用户信息 public function get_user_info(){ $url = $this->BT_PANEL.'/plugin?action=a&name=kaixin&s=get_user_info'; diff --git a/app/lib/Plugins.php b/app/lib/Plugins.php index 61366ea..324ab54 100644 --- a/app/lib/Plugins.php +++ b/app/lib/Plugins.php @@ -200,4 +200,19 @@ class Plugins return $result; } + //加密插件列表 + public static function encrypt_plugin_list($list, $server_id, $uid){ + $data = json_encode($list); + $block_size = 51200; + $key = md5(substr($server_id, 10, 16) . $uid . $server_id); + $iv = md5($key . $server_id); + $key = substr($key, 8, 16); + $iv = substr($iv, 8, 16); + $encrypted_content = ''; + foreach (str_split($data, $block_size) as $block) { + $encrypted_content .= openssl_encrypt($block, 'aes-128-cbc', $key, 0, $iv) . "\n"; + } + return $encrypted_content; + } + } \ No newline at end of file diff --git a/app/script/convert.sh b/app/script/convert.sh index 8129764..8fcaec2 100644 --- a/app/script/convert.sh +++ b/app/script/convert.sh @@ -1,6 +1,6 @@ #!/bin/bash -Linux_Version="11.2.0" +Linux_Version="11.3.0" Windows_Version="8.2.2" Aapanel_Version="7.0.25" Btm_Version="2.3.3" @@ -12,8 +12,6 @@ public/install/install_panel.sh public/install/update_panel.sh public/install/update6.sh public/win/install/panel_update.py -public/win/panel/panel_${Windows_Version}.zip -public/win/panel/data/api.py public/win/panel/data/setup.py public/install/src/bt-monitor-${Btm_Version}.zip public/install/install_btmonitor.sh diff --git a/app/view/admin/plugins.html b/app/view/admin/plugins.html index f875a9f..1e06c7b 100644 --- a/app/view/admin/plugins.html +++ b/app/view/admin/plugins.html @@ -75,7 +75,7 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px; - ``` - -- [可选]去除创建网站自动创建的垃圾文件:class/panelSite.py 文件 - - 删除 htaccess = self.sitePath + '/.htaccess' 以及下面2行 - - 删除 index = self.sitePath + '/index.html' 以及下面6行 - - 删除 doc404 = self.sitePath + '/404.html' 以及下面6行 - - 删除 if not os.path.exists(self.sitePath + '/.htaccess') 这一行 - -- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行 - -- [可选]上传文件默认选中覆盖,在BTPanel/static/js/upload-drog.js,id="all_operation"加checked属性 +- 使用16进制编辑器打开btPanel.exe,将 https://api.bt.cn 替换成 http://api.bt.cn/ ,将 https://www.bt.cn 替换成 http://www.bt.cn/ ,然后将api.bt.cn替换成任意其他域名,将第二个www.bt.cn替换成任意其他域名。 +- 新版vite页面去除需求反馈、各种广告、计算题等,执行 php think cleanvitejs <面板assets/static/js路径>