baota-panel

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

宝塔面板管理专家

BT Panel Management Expert

通过宝塔面板 API 实现对服务器的全面自动化管理。
Realize comprehensive automated management of servers via BT Panel API.

安装命令

Installation Command

bash
npx skills add ayflying/ai-skills --skill baota-panel
bash
npx skills add ayflying/ai-skills --skill baota-panel

准备工作 (Prerequisites)

Prerequisites

  1. 安装依赖
    bash
    pip install -r requirements.txt
  2. 配置认证
    • 复制
      .env.example
      .env
    • 在宝塔面板中开启 API 接口,获取密钥并填入
      .env
    • 将当前 IP 加入宝塔 API 的 IP 白名单。
  1. Install Dependencies:
    bash
    pip install -r requirements.txt
  2. Configure Authentication:
    • Copy
      .env.example
      to
      .env
      .
    • Enable the API interface in the BT Panel, obtain the secret key and fill it into
      .env
      .
    • Add the current IP to the IP whitelist of the BT Panel API.

核心亮点

Core Highlights

  • 稳健模式 (Robust Execution):当普通 Shell 接口被防火墙拦截时,自动切换至计划任务代理模式执行,确保 100% 命令送达。
  • Session 嗅探 (Socket Support):自动从服务器本地获取
    x-http-token
    ,支持调用宝塔内部的 Socket/Model 接口(如 Docker Compose 编排)。
  • 全能管理:覆盖网站、FTP、数据库、Docker、文件系统及系统监控。
  • Robust Execution: When the regular Shell interface is blocked by a firewall, it automatically switches to the scheduled task proxy mode for execution, ensuring 100% command delivery.
  • Session Sniffing (Socket Support): Automatically obtain
    x-http-token
    from the server locally, supporting calls to BT's internal Socket/Model interfaces (such as Docker Compose orchestration).
  • Comprehensive Management: Covers websites, FTP, databases, Docker, file systems, and system monitoring.

常用命令示例

Common Command Examples

1. 系统信息

1. System Information

bash
python scripts/bt_api.py
bash
python scripts/bt_api.py

2. Docker Compose 部署 (稳健模式)

2. Docker Compose Deployment (Robust Execution Mode)

python
from scripts.bt_api import BTPanelAPI
api = BTPanelAPI(url, key)
python
from scripts.bt_api import BTPanelAPI
api = BTPanelAPI(url, key)

即使有防火墙拦截,也能稳定执行

Even if blocked by a firewall, it can execute stably

api.docker_compose("/www/docker/myapp", "up -d")
undefined
api.docker_compose("/www/docker/myapp", "up -d")
undefined

3. 删除容器编排

3. Delete Container Orchestration

python
undefined
python
undefined

获取项目 ID 后执行删除

Execute deletion after obtaining the project ID

api.delete_compose_project(1)
undefined
api.delete_compose_project(1)
undefined

内部文档

Internal Documentation

  • API 规范与认证
  • 网站管理接口
  • Docker 与 Compose 管理
  • 数据库与 FTP
  • 文件系统操作
  • 系统与安全
  • API Specifications and Authentication
  • Website Management Interface
  • Docker & Compose Management
  • Databases & FTP
  • File System Operations
  • System & Security

安全红线

Security Guidelines

  • 严禁擅自执行删除操作。在删除站点、数据库、编排项目或清空回收站前,必须获得用户明确授权。
  • Strictly Prohibit Unauthorized Deletion Operations: Before deleting sites, databases, orchestration projects, or emptying the recycle bin, explicit authorization from the user must be obtained.