You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
4.5 KiB

1 year ago
  1. # Linux面板官方更新包修改记录
  2. 查询最新版本号:https://www.bt.cn/api/panel/get_version?is_version=1
  3. 官方更新包下载链接:http://download.bt.cn/install/update/LinuxPanel-版本号.zip
  4. 假设搭建的宝塔第三方云端网址是 http://www.example.com
  5. - 将class文件夹里面所有的.so文件删除
  6. - 将linux/PluginLoader.py复制到class文件夹
  7. - 批量解密模块文件:执行 php think decrypt classdir <面板class文件夹路径>
  8. - 全局搜索替换 https://api.bt.cn => http://www.example.com
  9. - 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/(需排除clearModel.py、scanningModel.py、ipsModel.py)
  10. - 全局搜索替换 https://download.bt.cn/install/update6.sh => http://www.example.com/install/update6.sh
  11. - class/ajax.py 文件 \#是否执行升级程序 下面的 public.get_url() 改成 public.GetConfigValue('home')
  12. class/jobs.py 文件 \#尝试升级到独立环境 下面的 public.get_url() 改成 public.GetConfigValue('home')
  13. class/system.py 文件 RepPanel和UpdatePro方法内的 public.get_url() 改成 public.GetConfigValue('home')
  14. - class/public.py 在
  15. ```python
  16. def GetConfigValue(key):
  17. ```
  18. 这一行下面加上
  19. ```python
  20. if key == 'home': return 'http://www.example.com'
  21. ```
  22. 在 def is_bind(): 这一行下面加上 return True
  23. 在 def check_domain_cloud(domain): 这一行下面加上 return
  24. 在 def get_improvement(): 这一行下面加上 return False
  25. 在free_login_area方法内get_free_ips_area替换成get_ips_area
  26. - class/panelPlugin.py 文件,download_icon方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
  27. 删除public.total_keyword(get.query)这一行
  28. set_pyenv方法内,temp_file = public.readFile(filename)这行代码下面加上
  29. ```python
  30. temp_file = temp_file.replace('wget -O Tpublic.sh', '#wget -O Tpublic.sh')
  31. temp_file = temp_file.replace('\cp -rpa Tpublic.sh', '#\cp -rpa Tpublic.sh')
  32. temp_file = temp_file.replace('http://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
  33. temp_file = temp_file.replace('https://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
  34. ```
  35. - class/plugin_deployment.py 文件,SetupPackage方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
  36. - install/install_soft.sh 在bash执行之前加入以下代码
  37. ```shell
  38. sed -i "s/http:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
  39. sed -i "s/https:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
  40. sed -i "/wget -O Tpublic.sh/d" $name.sh
  41. ```
  42. - install/public.sh 用官网最新版的[public.sh](http://download.bt.cn/install/public.sh)替换,并去除最下面bt_check一行
  43. - 去除无用的定时任务:task.py 文件 删除以下几行
  44. "check_panel_msg": check_panel_msg,
  45. - 去除WebRTC连接:BTPanel/static/js/public.js 删除stun.start();这一行
  46. - 去除首页广告:BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行
  47. - 去除首页自动检测更新,避免频繁请求云端:BTPanel/static/js/index.js 文件注释掉bt.system.check_update这一段代码外的setTimeout
  48. - 去除内页广告:BTPanel/templates/default/layout.html 删除getPaymentStatus();这一行
  49. - 删除问卷调查:BTPanel/templates/default/layout.html 删除if(window.localStorage.getItem('panelNPS') == null)以及下面的行
  50. - [可选]去除各种计算题:复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的\</body\>前面加入
  51. ```javascript
  52. <script src="/static/bt.js"></script>
  53. ```
  54. - [可选]去除创建网站自动创建的垃圾文件:在class/panelSite.py,分别删除
  55. htaccess = self.sitePath+'/.htaccess'
  56. index = self.sitePath+'/index.html'
  57. doc404 = self.sitePath+'/404.html'
  58. 这3行及分别接下来的4行代码
  59. - [可选]关闭未绑定域名提示页面:在class/panelSite.py,root /www/server/nginx/html改成return 400
  60. - [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行
  61. - [可选]删除小图标广告:在BTPanel/static/js/site.js,删除“WAF防火墙,保护网站安全”对应的html标签,files.js,删除“开启保护,文件无法编辑”对应的html标签
  62. 解压安装包panel6.zip,将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(
  63. 别忘了删除class文件夹里面所有的.so文件)