### Install Software Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Initiates a software installation task. This command automatically waits for the installation to complete and returns a JSON object with a message ID and installation result. ```bash btpython scripts/software.py install --name nginx --version 1.28 ``` -------------------------------- ### Install Software Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/SKILL.md Initiates the installation of a specified software or plugin from the Btpanel software store. This command automatically waits for the task to complete and returns the message ID and installation results. Ensure the software name is correct and specify a version if required. ```bash btpython scripts/software.py install --name <软件名> [--version <版本>] ``` -------------------------------- ### Ensure .NET Manager and Install .NET Runtime Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md First, ensure the .NET manager is installed using 'ensure-manager'. Then, install a specific .NET version. ```bash btpython scripts/runtime.py ensure-manager --runtime dotnet ``` ```bash btpython scripts/runtime.py install --runtime dotnet --version 8.0.100 ``` -------------------------------- ### Install Go Runtime Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md Use this command to install a specific Go SDK version. Ensure the runtime is set to 'go' and provide the desired version. ```bash btpython scripts/runtime.py install --runtime go --version 1.22.5 ``` -------------------------------- ### Software Installation Command Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Command-line interface for installing software, specifying name, version, installation type, and force option. ```bash btpython scripts/software.py install --name <软件名> [--version <版本>] [--type 0] [--force false] ``` -------------------------------- ### Plugin Installation Entry Point Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md This section describes the recommended method for installing plugins using the `panelPlugin` module, highlighting the internal processes handled by the `install_plugin` function. ```APIDOC ## Plugin Installation Entry Point To install plugins, you must call the native panel method: ```python import panelPlugin result = panelPlugin.panelPlugin().install_plugin(get) ``` Avoid directly interacting with the `tasks` table. The `install_plugin()` function internally manages dependency checks, mutual exclusion checks, system limit checks, task creation, log initialization, task triggering, and message creation. ``` -------------------------------- ### Software Installation Parameters Mapping Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Translates command-line arguments into a JSON object format required by the panel's native installation method. ```json { "sName": "nginx", "version": "1.28", "min_version": "", "type": "0", "force": "false" } ``` -------------------------------- ### Start Project Return Values Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/references/other_apis.md These are the possible return structures when attempting to start an AI project. Check the status and message for success or failure reasons. ```python {'status': True, 'msg': '项目启动成功'} ``` ```python {'status': False, 'msg': '指定项目不存在: xxx'} ``` ```python {'status': False, 'msg': '动态项目未配置启动命令'} ``` -------------------------------- ### Jump to Install Prompt Source: https://github.com/aapanel/baota/blob/main/class/push/panel_push.html Displays a confirmation dialog to prompt the user to jump to the installation interface if a module is not installed. It uses layer.confirm for the dialog and setTimeout to delay the opening of the installation channel. ```javascript alarm_jump:function(name){ layer.confirm("当前模块未安装,是否跳转到安装界面,是否继续?",{title:"跳转提醒",icon:3,closeBtn:2}, function() { layer.closeAll(); setTimeout(function(){ open_three_channel_auth(name) },200) }) ``` -------------------------------- ### Install AaPanel on Debian Source: https://github.com/aapanel/baota/blob/main/README.md Use this command for Debian-based systems. It directly downloads and executes the installation script using wget. ```bash wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh && bash install_panel.sh btg26 ``` -------------------------------- ### List Available Runtimes (Python) Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/SKILL.md Use this command to query available or installed versions of a specific runtime, such as Python. This is a preliminary step before installation. ```bash btpython scripts/runtime.py list --runtime python ``` -------------------------------- ### .NET Version Installation Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md This snippet shows the command to install a specific .NET version. Ensure the .NET manager plugin is installed first. ```python panelPlugin.panelPlugin().a(public.to_dict_obj({ 'name': 'dotnet', 's': 'install_dotnet', 'version': version })) ``` -------------------------------- ### Check BTPanel Software Installation Status by Task ID Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Use this command to query the status of a specific software installation task using its task ID. This provides an alternative method to track installation progress. ```bash btpython scripts/software.py status --task-id 82 ``` -------------------------------- ### StartProject Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/references/other_apis.md Starts a specified AI project. For dynamic projects, it runs the start command in the background. For static projects, it modifies Nginx configuration to make the site accessible. ```APIDOC ## StartProject — 启动项目 Starts a specified AI project. Dynamic projects run the start command in the background via nohup and write a PID file; static projects remove the bt-stop.html rewrite rule from Nginx configuration to make the site accessible. ### Method `btpython scripts/ai_site.py start --project_name <项目名称>` or `site.start_project(project_name='my_project')` ### Parameters #### Path Parameters - **project_name** (string) - Required - The name of the AI project to start. Must be a project name already created in the panel. ### Response #### Success Response - **status** (boolean) - Indicates if the operation was successful. - **msg** (string) - A message describing the outcome of the operation. Example: ```json { "status": true, "msg": "项目启动成功" } ``` #### Error Response - **status** (boolean) - Indicates if the operation failed. - **msg** (string) - A message describing the error. Example (Project not found): ```json { "status": false, "msg": "指定项目不存在: xxx" } ``` Example (Missing start command for dynamic project): ```json { "status": false, "msg": "动态项目未配置启动命令" } ``` ``` -------------------------------- ### Start AI Project Command Line Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/references/other_apis.md Use this command to start a specified AI project. Ensure the project name is valid and created within the panel. ```bash btpython scripts/ai_site.py start --project_name <项目名称> ``` -------------------------------- ### View Installation Log Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/SKILL.md Retrieves the installation log for a specific task, identified by its message ID or task ID. You can specify the number of lines to display. This is useful for diagnosing installation failures. ```bash btpython scripts/software.py log --msg-id --lines 100 ``` ```bash btpython scripts/software.py log --task-id --lines 100 ``` -------------------------------- ### View Installation Logs Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/SKILL.md Retrieves recent installation logs to help diagnose issues. You can specify the number of lines to display. ```bash btpython scripts/runtime.py log --lines 100 ``` -------------------------------- ### BTPanel Software Installation Status Response Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md This JSON object represents the response received after initiating a software installation task. It includes details about the selected software, installation arguments, and the immediate result of adding the task to the queue, along with a message ID for future reference. ```json { "selected": { "name": "mysql", "version": "5.7.44", "m_version": "5.7", "min_version": "44", "source": "specified" }, "install_args": {}, "result": { "status": true, "msg_id": "93e66640a0a2704b", "msg": "已将安装任务添加到队列!" }, "install_result": { "status": true, "msg": "安装mysql-5.7已结束", "soft_name": "mysql-5.7", "install_status": "安装mysql-5.7结束", "file_name": "/www/server/panel/logs/installed/mysql-5.7_xxx.log", "task_id": 82 } } ``` -------------------------------- ### Ensure Node.js Manager and Install Node.js Runtime Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md First, ensure the Node.js manager is installed using 'ensure-manager'. Then, install a specific Node.js version. ```bash btpython scripts/runtime.py ensure-manager --runtime node ``` ```bash btpython scripts/runtime.py install --runtime node --version v20.15.0 ``` -------------------------------- ### Install Java/JDK Runtime Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md Use this command to install a specific Java Development Kit (JDK) version. Ensure the runtime is set to 'java' and provide the desired version. ```bash btpython scripts/runtime.py install --runtime java --version jdk-17.0.10 ``` -------------------------------- ### Install Runtime Version (PHP) Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/SKILL.md Installs a specific version of a runtime environment, like PHP 8.3. This command must be executed in a blocking manner. Ensure the runtime and version are valid before execution. ```bash btpython scripts/runtime.py install --runtime php --version 8.3 ``` -------------------------------- ### Install Python Runtime Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md Use this command to install a specific Python version. Ensure the runtime is set to 'python' and provide the desired version. ```bash btpython scripts/runtime.py install --runtime python --version 3.12.3 ``` -------------------------------- ### View BTPanel Software Installation Log by Task ID Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Retrieve the installation log for a specific software task using its task ID. This command allows you to view the log output, specifying the number of recent lines to display. ```bash btpython scripts/software.py log --task-id 82 --lines 100 ``` -------------------------------- ### Install Plugin using panelPlugin Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md This Python code demonstrates the correct method to install a plugin using the panelPlugin. It is crucial to use this method as it handles all necessary checks and task creations internally. ```python import panelPlugin result = panelPlugin.panelPlugin().install_plugin(get) ``` -------------------------------- ### View BTPanel Software Installation Log by Message ID Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Retrieve the installation log for a specific software task using its message ID. You can specify the number of lines to display from the end of the log. ```bash btpython scripts/software.py log --msg-id 93e66640a0a2704b --lines 100 ``` -------------------------------- ### View Installation Log by Task ID Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/references/software_install.md Retrieve installation logs for a specific task using its task ID. You can specify the number of lines to retrieve. Returns a JSON object with log details. ```bash btpython scripts/software.py log --task-id --lines 100 ``` -------------------------------- ### Get Project Status Response Example - JSON Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/references/other_apis.md This is an example of the enhanced project information returned by the get_project_stat function. It includes real-time status fields like 'run', 'listen', and 'listen_ok'. ```json { "id": 1, "name": "my_project", "path": "/www/wwwroot/my_project", "ps": "项目备注", "status": 1, "project_config": {...}, "addtime": "2024-01-01 12:00:00", "run": true, "listen": [3000], "listen_ok": true } ``` -------------------------------- ### Full Nginx Configuration Workflow Example Source: https://github.com/aapanel/baota/blob/main/mod/base/pynginx/btnginx/readme.md Demonstrates a complete workflow from detecting running Nginx instances to parsing their configuration, formatting it for compatibility, and then creating sites based on the parsed information. Requires specific imports for detector, formatter, and site creation utilities. ```python from mod.base.pynginx.btnginx.nginx_detector import ng_detect nginx_instances = ng_detect(only_running=True) if not nginx_instances: print("未找到运行中的Nginx实例") exit() nginx_ins = nginx_instances[0] from mod.base.pynginx.btnginx.bt_formater import bt_nginx_format result = bt_nginx_format(nginx_ins) for site in result['site_conf']: print(f"站点: {site['name']}") print(f" 类型: {site['site_type']}") print(f" 域名: {site['domains']}") print(f" 端口: {site['ports']}") from mod.base.pynginx.btnginx.create_site import CreateSiteUtil util = CreateSiteUtil(result['tmp_path']) for site in result['site_conf']: if site['site_type'] == 'PHP': util.create_php_site(site) elif site['site_type'] == 'proxy': util.create_proxy_site(site) else: util.create_static_site(site) ``` -------------------------------- ### Get Available PHP Versions Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_site/references/php_site.md Query the panel for currently installed PHP versions. This is necessary before creating a PHP site to confirm available versions. ```bash btpython scripts/php_site.py php-versions ``` ```python from php_site import BtPanelPhpSite site = BtPanelPhpSite() result = site.get_php_versions() ``` ```python [ {"version": "00", "name": "纯静态", "status": True}, {"version": "80", "name": "PHP-80", "status": True}, {"version": "74", "name": "PHP-74", "status": True} ] ``` -------------------------------- ### Get Push Message Channel Status Source: https://github.com/aapanel/baota/blob/main/class/push/panel_push.html Fetches the installation status of available push message channels. It sends a POST request to '/push?action=get_push_msg_list' and provides the data to a callback. ```javascript get_push_msg_list: function(callback) { $.post('/push?action=get_push_msg_list', function (rdata) { if(callback) callback(rdata) }) ``` -------------------------------- ### Get Full Site Intercept Log - get_attack_report_log Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btwaf/SKILL.md Searches WAF full-site intercept logs. Supports keyword search and time range filtering. Default limit is 10 records per page, starting from page 1. ```bash btpython skills/btwaf/scripts/btwaf_script.py get_attack_report_log '{"limit":10,"p":1}' ``` ```bash btpython skills/btwaf/scripts/btwaf_script.py get_attack_report_log '{"limit":10,"p":1,"keyword":"sql"}' ``` ```bash btpython skills/btwaf/scripts/btwaf_script.py get_attack_report_log '{"limit":20,"p":1,"start_time":"2026-04-01","end_time":"2026-04-28"}' ``` -------------------------------- ### List Available Software Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/SKILL.md Queries the Btpanel software store to list available software, optionally filtering by a query string. This command helps users discover what can be installed. ```bash btpython scripts/software.py list --query nginx ``` -------------------------------- ### Node.js Manager Installation Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md Before installing a specific Node.js version, ensure the Node.js manager plugin is installed. This snippet shows the command to install the Node.js manager. ```python panelPlugin.panelPlugin().a(public.to_dict_obj({ 'name': 'nodejs', 's': 'install_nodejs', 'version': version })) ``` -------------------------------- ### StartProject Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/references/other_apis.md Starts a project. For dynamic projects, it executes the start_cmd and runs it in the background via nohup. For static projects, it removes the bt-stop.html rule from the Nginx configuration. ```APIDOC ## StartProject ### Description Starts a project. For dynamic projects, it executes the start_cmd and runs it in the background via nohup. For static projects, it removes the bt-stop.html rule from the Nginx configuration. ### Method `btpython scripts/ai_site.py start` ### Return Content Success: status=True, msg='Project started successfully' Failure: Error message ``` -------------------------------- ### Start AI Project Python SDK Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/references/other_apis.md Initiate an AI project using the BtPanel AI Site SDK. The project name must be pre-configured in the panel. ```python from ai_site import BtPanelAiSite site = BtPanelAiSite() result = site.start_project(project_name='my_project') ``` -------------------------------- ### Node.js PM2 and Yarn Installation Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/references/runtime_install.md After a Node.js version is installed, continue to install PM2 and yarn for that version using these commands. ```python panelPlugin.panelPlugin().a(public.to_dict_obj({ 'name': 'nodejs', 's': 'install_module', 'version': version, 'module': 'pm2' })) ``` ```python panelPlugin.panelPlugin().a(public.to_dict_obj({ 'name': 'nodejs', 's': 'install_module', 'version': version, 'module': 'yarn' })) ``` -------------------------------- ### Initialize Software List and Recommendations Source: https://github.com/aapanel/baota/blob/main/BTPanel/templates/default/soft.html This JavaScript code initializes the software list and renders recommended software upon page load. It also sets up event listeners for search functionality. ```javascript bt.set_cookie('sites_path', "{{session['config']['sites_path']}}"); bt.set_cookie('serverType', "{{session['webserver']}}"); bt.set_cookie('distribution', "{{session['config']['distribution']}}"); $(document).ready(function () { soft.get_list(); soft.render_soft_recommend() $('#SearchValue').keyup(function (e) { if (e.keyCode == 13) { $('#records_search').css('opacity', '0'); setTimeout(function () { $('#records_search').css('display', 'none'); }, 80); soft.get_list(1, 0, $("#SearchValue").val()) } }); }); ``` -------------------------------- ### Query Installation Status Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/SKILL.md Checks the status of a previously initiated installation task using its message ID or task ID. This is crucial for confirming the success or failure of an installation and for troubleshooting. ```bash btpython scripts/software.py status --msg-id ``` ```bash btpython scripts/software.py status --task-id ``` -------------------------------- ### Full Mail Deployment Process in Python Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel_mail/SKILL.md This script demonstrates a complete workflow for deploying and configuring the BtPanel mail system. It covers checking installation status, initializing the system, verifying service status, adding domains, configuring DNS, and creating mailboxes. It adapts its behavior based on whether full access or basic functionality is available. ```python #!/usr/bin/env python3 import sys import os import json import time sys.path.insert(0, '/www/server/panel') sys.path.insert(0, '/www/server/panel/class') os.chdir('/www/server/panel') from mod.base import public_aap as public # 内部函数:检查授权状态 def _check_auth(): auth_file = '/www/server/panel/data/auth_list.json' if os.path.exists(auth_file): try: auth_data = json.loads(public.readFile(auth_file)) ltd = auth_data.get('ltd', 0) current_time = int(time.time()) return ltd > current_time except: return False return False # 内部函数:根据授权选择接口 def _get_mail_interface(): if _check_auth(): from mailModel.mainModel import main as MailMain from mailModel.manageModel import main as MailManage return MailMain(), MailManage(), True else: MAIL_SYS_PLUGIN = '/www/server/panel/plugin/mail_sys/mail_sys_main.py' if not os.path.exists(MAIL_SYS_PLUGIN): return None, None, False sys.path.insert(0, '/www/server/panel/plugin/mail_sys') from mail_sys_main import mail_sys_main as MailMain return MailMain(), None, False print("="*60) print("宝塔邮局部署") print("="*60) # 获取接口(内部操作,不展示给用户) mail, manage, has_full_access = _get_mail_interface() if not mail: print("\n✗ 邮局服务不可用") sys.exit(1) class Args: def __init__(self, **kwargs): self.__dict__.update(kwargs) # 步骤 1: 检查安装状态 print("\n[步骤 1] 检查邮局安装状态...") if has_full_access: install_check = manage.install_status(None) if not install_check.get('status', False): print("正在安装邮局服务...") install_result = manage.install_service(None) print(f"安装结果:{install_result.get('msg', '')}") print("请等待安装完成后重新运行") sys.exit(0) else: if not os.path.exists('/www/server/panel/plugin/mail_sys/mail_sys_main.py'): print("✗ 邮局插件未安装") sys.exit(1) print("✓ 邮局已安装") # 步骤 2: 检查初始化状态 print("\n[步骤 2] 检查邮局初始化状态...") init_check = mail.check_mail_sys(None) if not init_check.get('status', False): print("正在初始化邮局系统...") args = Args( domain='example.com', a_record='mail.example.com', ips='1.2.3.4' ) result = mail.setup_mail_sys(args) print(f"初始化完成:{result.get('msg', '')}") else: print("✓ 邮局已初始化") # 步骤 3: 检查服务状态 print("\n[步骤 3] 检查服务状态...") status = mail.get_service_status(None) print(f"Postfix: {'✓ 运行中' if status['data']['postfix'] else '✗ 未运行'}") print(f"Dovecot: {'✓ 运行中' if status['data']['dovecot'] else '✗ 未运行'}") print(f"Rspamd: {'✓ 运行中' if status['data']['rspamd'] else '✗ 未运行'}") # 步骤 4: 添加域名 print("\n[步骤 4] 添加域名...") args = Args( domain='example.com', a_record='mail.example.com', ips='1.2.3.4', mailboxes=1000, mailbox_quota='1 GB', quota='10 GB', rate_limit=12 ) result = mail.add_domain_new(args) print(f"域名添加:{result.get('msg', '')}") # 步骤 5: 自动配置 DNS(完整功能) if has_full_access: print("\n[步骤 5] 自动配置 DNS...") args = Args(domain='example.com', a_record='mail.example.com') result = mail.auto_create_dns_record(args) print(f"DNS 配置:{result.get('msg', '')}") else: print("\n[步骤 5] 跳过 DNS 自动配置") print(" 请手动配置 DNS 记录") # 步骤 6: 创建管理员邮箱 print("\n[步骤 6] 创建管理员邮箱...") args = Args( username='admin@example.com', full_name='Admin', password='AdminPass123', quota='2 GB', is_admin=1, active=1 ) result = mail.add_mailbox(args) print(f"邮箱创建:{result.get('msg', '')}") print("\n" + "="*60) print("邮局配置完成!") print("="*60) ``` -------------------------------- ### Check Mail Panel Installation Status Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel_mail/SKILL.md Use this Python code to check if the mail panel is installed and its current installation status. It includes a check for the presence of the mail system plugin file. ```python # 完整功能 from mailModel.manageModel import main as MailManage manage = MailManage() result = manage.install_status(None) print(f"安装状态:{result.get('status', False)}") # 基础功能 if not os.path.exists('/www/server/panel/plugin/mail_sys/mail_sys_main.py'): print("邮局插件未安装") ``` -------------------------------- ### Create Static Project with BTPanel AI Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_ai_site/SKILL.md This script is used to create and configure static projects (Vue, React) with the BTPanel AI. It requires pre-flight checks and specifies project details, domains, and project remarks. Static projects do not require port or start/stop commands as Nginx directly hosts the files. ```bash btpython scripts/ai_site.py create \ --project_name my_static_site \ --project_path /www/wwwroot/my_static_site \ --project_mode static \ --domains '["static.example.com:80"]' \ --project_ps "项目备注" ``` -------------------------------- ### Install AaPanel on Ubuntu/Deepin Source: https://github.com/aapanel/baota/blob/main/README.md This command is for Ubuntu and Deepin systems. It requires sudo privileges to execute the installation script. ```bash wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh && sudo bash install_panel.sh btg26 ``` -------------------------------- ### Detect Installed Firewall Tools Source: https://github.com/aapanel/baota/blob/main/mod/project/agent/skill_agents/firewall_diagnosis_agent.md Checks for the presence of UFW or firewall-cmd executables to identify installed firewall management tools. ```bash which ufw ``` ```bash which firewall-cmd ``` -------------------------------- ### Find Software Details Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_software/SKILL.md Use this command to query software information and available versions from the Btpanel software store. It is essential for validating user-specified versions or selecting the latest version when none is provided. ```bash btpython scripts/software.py find --name <软件名> ``` -------------------------------- ### Get WAF Overview - overview Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btwaf/SKILL.md Retrieves a comprehensive WAF overview for a specified date. The start_time parameter is optional and defaults to the current day. ```bash btpython skills/btwaf/scripts/btwaf_script.py overview '{}' ``` ```bash btpython skills/btwaf/scripts/btwaf_script.py overview '{"start_time":"2026-04-28"}' ``` -------------------------------- ### Add HTML Site via Command Line Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_site/references/html_site.md Use this command to create a static HTML site. Specify the domain or IP with port, the website directory, and an optional remark. ```bash btpython scripts/html_site.py add --domain <域名或IP端口> --site_path <网站目录> --ps <备注> ``` -------------------------------- ### Initialize Firewall Settings Source: https://github.com/aapanel/baota/blob/main/BTPanel/templates/default/firewall_new.html Initializes firewall settings, including SSH and ping status, and sets up event listeners for UI elements like dropdowns and switches. ```javascript var firewall = { get_init:function(){ firewall.flush_init(); firewall.get_list(); firewall.get_log_list(); firewall.get_logs_size(); $('.sshswitch').click(function(){ var status = $("#sshswitch").prop("checked")==true?1:0; bt.firewall.set_mstsc_status(status,function(rdata){ if(rdata===-1){ if(status){ $("#sshswitch").prop("checked","checked") }else{ $("#sshswitch").removeAttr('checked'); } }else{ bt.msg(rdata); firewall.flush_init(); } }) }) $('.noping').click(function(){ var status = $("#noping").prop("checked")==true?1:0; bt.firewall.ping(status,function(rdata){ if(rdata===-1){ if(status){ $("#noping").prop("checked","checked") }else{ $("#noping").removeAttr('checked'); } }else{ bt.msg(rdata); firewall.flush_init(); } }) }) $("#firewalldType").change(function(){ var type = $(this).val(); var w = '120px'; var p = lan.firewall.port; var t = lan.firewall.accept; var m = lan.firewall.port_ps; $("#AcceptAddress").hide(); if (type == 'address') { w = '150px'; p = lan.firewall.ip; t = lan.firewall.drop; m = lan.firewall.ip_ps; } else if (type === 'ip_port') { $("#AcceptAddress").show(); m = '说明: 只允许指定IP访问某端口,如: 只允许192.168.0.1访问8080端口'; } $("#AcceptPort").css("width",w); $("#AcceptPort").attr('placeholder',p); $("#toAccept").html(t); $("#f-ps").html(m); }); }, flush_init:function(){ bt.firewall.get_ssh_info(function(rdata){ if(!rdata.status){ $("#mstscSubmit").attr('disabled','disabled') $("#mstscPort").attr('disabled','disabled') $('#sshswitch').removeAttr('checked'); } else{ $("#mstscSubmit").removeAttr('disabled') $("#mstscPort").removeAttr('disabled') $('#sshswitch').attr('checked','checked'); } if(rdata.ping){ $('#noping').removeAttr('checked'); }else{ $('#noping').attr('checked','checked'); } $("#mstscPort").val(rdata.port); }) }, get_logs_size:function(){ bt.firewall.get_logs_size(function(rdata){ $("#logSize").text(rdata); }) }, clear_logs_files:function(){ bt.firewall.clear_logs_files(function(rdata){ $("#logSize").text(rdata); bt.msg({msg:lan.firewall.empty,icon:1}); }) }, add_accept_port:function(){ var type = $("#firewalldType").val(); var port = $("#AcceptPort").val(); var ps = $("#Ps").val(); bt.firewall.add_accept_port(type,port,ps,function(rdata){ if(rdata.status){ firewall.get_list(); $("#AcceptPort").val(''); $("#Ps").val(''); } bt.msg(rdata); }) }, remove_accept_port: function (id,port) { bt.firewall.del_accept_port(id, port, function (rdata) { if (rdata.status) { firewall.get_list(); } bt.msg(rdata); }) }, get_list:function(page,search){ if(page==undefined) page=1; $.post('/firewall_new?action=GetList', { p: page, search: search,collback:'firewall.get_list' }, function (rdata) { $('.firewallBody').html(rdata.page); var ports_ps = { "3306": "MySQL服务默认端口", "888": "phpMyAdmin默认端口", "22": "SSH远程服务", "20": "FTP主动模式数据端口", "21": "FTP协议默认端口", "39000-40000": "FTP被动模式端口范围", "30000-40000": "FTP被动模式端口范围","11211":"Memcached服务端口","873":"rsync数据同步服务","8888":"宝塔Linux面板默认端口"} var _tab = bt.render({ table:'#firewallBody', columns:[ { field: 'id', title: "{{data['lan']['TH1']}}"}, { field: 'port', title: "{{data['lan']['TH2']}}",templet:function(item){ var _ps = lan.firewall.accept_port; if(bt.contains(item.port,'.')){ _ps = lan.firewall.drop_ip; } _ps += ':['+item.port+']' return _ps; }}, { field: 'status', title: "{{data['lan']['TH3']}}",templet:function(item){ var status = ''; switch(item.status){ case 0: status = lan.firewall.status_not; break; case 1: status = lan.firewall.status_net; break; default: status = lan.firewall.status_ok; break; } return status; },help:'https://www.bt.cn/bbs/thread-4708-1-1.html'}, { field: 'addtime', title: "{{data['lan']['TH4']}}"}, { field: 'ps', title: "{{data['lan']['TH5']}}", templet: function (item) { if (item.port in ports_ps) return ports_ps[item.port]; return item.ps; }}, { field: 'opt',align:'right',width:50, title: "{{data['lan']['TH6']}}",templet:function(item){ return '删除'; }} ], data:rdata.data }) }) }, get_log_list:function(page,search){ if (page == undefined) page = 1; if (search == undefined) search = $("#SearchValue").val(); bt.firewall.get_log_list(page,search,function(rdata){ $('.logsBody').html(rdata.page); var _tab = bt.render({ table:'#logsBody', columns:[ { field: 'id', title: "{{data['lan']['LTH1']}}"}, { field: 'type', title: "{{data['lan']['LTH2']}}"}, { field: 'log', title: "{{data['lan']['LTH3']}}"}, { field: 'addtime', title: "{{data['lan']['LTH4']}}"} ], data:rdata.data }) }) }, //查看面板运行日志 get_panel_error_logs: function () { layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] }); $.post('/config?action=get_panel_error_logs', {}, function (rdata) { layer.closeAll(); if (!rdata.status) { laye ``` -------------------------------- ### Ensure Runtime Manager (Node.js) Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_runtime/SKILL.md Before installing Node.js, ensure the necessary manager plugin is present. This command checks for and installs the manager if it's missing. ```bash btpython scripts/runtime.py ensure-manager --runtime node ``` -------------------------------- ### Install AaPanel with Universal Script Source: https://github.com/aapanel/baota/blob/main/README.md Use this command to install AaPanel on most Linux systems. It checks for curl and falls back to wget if curl is not available. ```bash if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh btg26 ``` -------------------------------- ### JavaScript for Site Configuration and Installation Source: https://github.com/aapanel/baota/blob/main/BTPanel/templates/default/site.html JavaScript code to manage site configurations, set cookies, and handle the installation of web servers like Nginx or Apache. ```javascript var serverType = "{{session\[\'webserver\'\].replace(\'\\\',\'\\\\\'\')}}"; bt.set_cookie('sites_path', "{{session\[\'config\'\].\['sites_path'\]}}"); bt.set_cookie('serverType', serverType); var isSetup = "{{data\[\'isSetup\'\].replace(\'\\\',\'\\\\\'\')}}" === 'True' ? true : false {% if not data\[\'isSetup\'\] %} layer.msg('未安装Web服务器,安装Nginx  |  安装Apache', { icon: 7, shade: [0.3, '#000'], time: 0,area:'380px' }); $(".layui-layer-shade").css("margin-left", "180px"); {% else %} site.plugin_firewall(); {% endif %} ``` -------------------------------- ### List Sites with Python SDK Source: https://github.com/aapanel/baota/blob/main/data/agent/skills/btpanel/btpanel_site/references/php_site.md Instantiate the BtPanelPhpSite class to interact with site management functions. Call list_sites() to fetch all sites or filter by project_type for specific site categories. ```python from php_site import BtPanelPhpSite site = BtPanelPhpSite() result = site.list_sites() # 全部站点 result = site.list_sites(project_type='PHP') # 仅PHP站点 ```