Skip to main content

WebUI Plugin for Entari

Project description

entari-plugin-webui

基于 Vite + Vue 3 + Element Plus 的 Entari 可视化管理面板。

功能特性

  • 仪表盘 — 消息统计、运行状态一览(ECharts)
  • 配置管理 — 可视化编辑所有插件配置,支持 YAML 源码与表单双模式
  • 插件管理 — 查看/启用/停用/重载插件
  • 插件市场 — 浏览、安装、卸载社区插件
  • 实时日志 — WebSocket 流式日志查看,支持 ANSI 转义渲染
  • 在线聊天 — 基于 Satori 协议的浏览器内聊天界面
  • 扩展机制 — 其他插件可通过 webui_extend 注册菜单、页面、路由、国际化、权限
  • 主题切换 — 明暗主题一键切换
  • 会话管理 — 基于 Cookie 的登录会话,自动过期
  • 登录限流 — 防暴力破解

安装

pip

pip install entari-plugin-webui

pdm

pdm add entari-plugin-webui

配置示例

entari.yml 中启用插件:

plugins:
  server:
    port: 8765              # WebUI 服务端口
    path: "satori"
    direct_adapter: true
  database:
    name: .entari/database.db   # 统计数据用 SQLite
  webui: {}                     # 启动 WebUI 面板

完整字段说明:

字段 默认值 说明
password "" 登录密码(远程部署必填,本地可省略)
registry_url "" 插件市场地址
package_manager "" 包管理器(自动探测 pip/pdm/uv/poetry/rye/pipenv)
session_ttl 43200 会话过期时间(秒,默认 12 小时)
log_buffer_lines 5000 日志缓冲区行数
login_rate_limit 5/60s 登录频率限制

认证说明

  • 本地部署host=127.0.0.1/localhost/::1):自动免认证,无需密码即可登录
  • 远程部署:首次启动时自动生成随机 16 位密码并输出到控制台日志

故障恢复

忘记密码时,删除配置中的 plugins.webui.password 字段(或置空),重启后即重新生成新密码:

plugins:
  webui: {}
  # password 字段可删除或留空

扩展开发

其他 Entari 插件可通过 webui_extend 注册前端扩展,无需修改本插件源码。

from entari_plugin_webui.core.extension import webui_extend

ext = webui_extend("my_plugin")

# 注册侧栏菜单
ext.add_menu("my_plugin.name", "mdi:account", "/extension/my_plugin")

# 注册 iframe 页面
ext.add_page("my_plugin", "my_plugin.name", "mdi:account",
             "http://127.0.0.1:3000/", permission="my_plugin.access")

# 注册后端 API 路由
ext.add_route("/api/my-plugin/hello", ["GET"], my_handler, permission="my_plugin.access")

# 注册国际化文案
ext.add_i18n("zh-CN", "my_plugin.name", "我的插件")
ext.add_i18n("en-US", "my_plugin.name", "My Plugin")

# 注册权限项
ext.add_permission("my_plugin.access", "my_plugin.permission.access")

WebUIExtension 方法总览:

方法 参数 说明
add_menu label_key, icon, path, order, badge_key, children 添加侧栏菜单项
add_page key, label_key, icon, component_url, permission 添加 iframe 页面
add_route path, methods, handler, permission 添加后端 HTTP 路由
add_websocket_route path, handler, permission 添加后端 WebSocket 路由
add_i18n locale, key, value 添加国际化翻译
add_permission key, label_key 添加权限定义

风险须知

[!WARNING]

  • 扩展页面以 iframe 沙箱 加载,与主面板隔离运行
  • 扩展来源 仅限本机已安装的插件,不支持加载外部站点
  • 各扩展通过 postMessage 与主面板通信,无法直接操作 DOM 或获取全局状态
  • 安装插件市场中的第三方插件前,请自行评估其安全性

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

entari_plugin_webui-1.0.0.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

entari_plugin_webui-1.0.0-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file entari_plugin_webui-1.0.0.tar.gz.

File metadata

  • Download URL: entari_plugin_webui-1.0.0.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.28.0 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for entari_plugin_webui-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6ef86d3ca2dccc7c72e8bd7315bc07d436557615afd7bb5300b6c020d4574a13
MD5 fb553f7bb2de146321c0fa26ea3111c9
BLAKE2b-256 99a75462441533632ae173fb9b6cb82dea6c41c9916b2f10f62beb92d4d6609c

See more details on using hashes here.

File details

Details for the file entari_plugin_webui-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: entari_plugin_webui-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.28.0 CPython/3.11.15 Linux/6.17.0-1018-azure

File hashes

Hashes for entari_plugin_webui-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57651438aacfffc9ec64e4879aec8c4fa387ebfdad44f9093e673f14557696a3
MD5 5d2a8366c1fd5bd3c51ca31c6342db28
BLAKE2b-256 3431e8bfff8e3596166a7fbfacea19e71e1b494169f2d17f941ab8cb5aea068c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page