Files
NebulaShell/store/@{Falck}/web-toolkit
qwen.ai[bot] 97ced1b5e6 Title: Implement minimal core framework with PL injection and update build config
Key features implemented:
- Updated package metadata and dependencies in PKG-INFO, setup files
- Added main.py entry point for backward compatibility with README launch method
- Enhanced CLI with config options, system info command, and proper signal handling
- Implemented minimal PluginManager loading only plugin-loader core plugin
- Refactored PluginLoader to follow minimal core design, removed sandbox/isolation complexity
- Updated auto-dependency plugin with safer PL injection mechanism and disabled pl_injection
- Removed legacy plugin files (firewall, frp_proxy, ftp_server, multi_lang_deploy, ops_toolbox, security_gateway) as functionality moved to core plugin system
- Improved gitignore with comprehensive ignore patterns

The changes implement a minimal core framework design where only the plugin-loader is directly loaded by the core, with all other plugins managed through the PL injection mechanism, significantly simplifying the architecture.
2026-04-25 10:47:26 +00:00
..
2026-04-17 23:15:15 +08:00
2026-04-17 23:15:15 +08:00
2026-04-17 23:15:15 +08:00

web-toolkit Web 工具包

提供静态文件服务、模板渲染、路由等 Web 开发工具。

功能

  • 静态文件服务:提供 HTML/CSS/JS/图片等静态文件
  • 模板引擎:支持变量替换、条件判断、循环
  • 路由管理:为 HTTP 和 TCP 服务器注册路由
  • 自动首页:自动查找 index.html

使用

web = plugin_mgr.get("web-toolkit")

# 设置目录
web.set_static_dir("./public")
web.set_template_dir("./templates")

# 添加自定义路由
web.add_route("GET", "/api/hello", lambda req: {
    "status": 200,
    "headers": {"Content-Type": "application/json"},
    "body": '{"message": "Hello"}'
})

# 渲染模板
html = web.render_template("page.html", {"title": "My Page", "items": [1, 2, 3]})

模板语法

<!-- 变量 -->
<h1>{{ title }}</h1>
<p>{{ description }}</p>

<!-- 条件 -->
{% if show_content %}
  <div>{{ content }}</div>
{% endif %}

<!-- 循环 -->
<ul>
{% for item in items %}
  <li>{{ item }}</li>
{% endfor %}
</ul>

配置

{
  "config": {
    "args": {
      "host": "0.0.0.0",
      "port": 8080,
      "static_dir": "./static",
      "template_dir": "./templates",
      "index_files": ["index.html", "index.htm"]
    }
  }
}

依赖

  • http-apiHTTP 服务
  • http-tcpTCP HTTP 服务