1.1 KiB
1.1 KiB
Backend
后端由 AstrBot 插件生命周期托管,不启动独立 Web 服务。
main.py中的Star子类在initialize()阶段调用context.register_web_api。terminate()用于插件停用或重载时清理资源。- route registry 和业务层只维护
ui/bootstrap、profiles、nodes/{node_id}/generate等相对 endpoint。 - AstrBot v4.25 插件页面 bridge 兼容
/api/plug/astrbot_plugin_imagestudio/<endpoint>。 - 当前直接调用兼容
/api/v1/plugins/extensions/astrbot_plugin_imagestudio/<endpoint>。 - 前端 bridge 必须传相对 endpoint,不能传完整宿主 URL。
插件 UI 由 pages/imagestudio/index.html 自动发现。未注册的 /web 目录不是生产入口。
SQLite、媒体、日志和缓存等运行数据应写入 data/plugin_data/astrbot_plugin_imagestudio/,不要写入插件源码目录。
当前 API 的产品边界是可信 AstrBot WebUI 管理员工作台。角色档案已按调用身份过滤,但其他资源尚未完成统一祖先链 owner 授权;在补齐该授权与跨用户回归测试前,不应把本插件作为互不信任用户共享的多租户服务发布。