- nebula create mod/key/list-templates 模组脚手架 - nebula dev 开发模式热重载 - manifest permissions.imports 权限白名单机制 - system-monitor 系统监控仪表盘插件 - 默认端口统一为 10086 - 修复 _init_nbpf 误读 Ed25519 私钥为 RSA 的 bug - 更新 README.md 文档
51 lines
927 B
Python
51 lines
927 B
Python
"""
|
|
@{{ author }}/{{ mod_name }}
|
|
{{ description }}
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
# 模组信息(可选,用于动态获取)
|
|
NAME = "{{ mod_name }}"
|
|
VERSION = "0.1.0"
|
|
|
|
|
|
def init(deps):
|
|
"""
|
|
模组初始化。
|
|
deps 包含:
|
|
- deps["services"] — 其他模组注册的服务
|
|
- deps["config"] — 当前模组的配置
|
|
- deps["logger"] — 日志工具
|
|
"""
|
|
logger = deps.get("logger")
|
|
if logger:
|
|
logger.info(f"{NAME} v{VERSION} 初始化完成")
|
|
|
|
|
|
def start():
|
|
"""模组启动。init 成功后调用。"""
|
|
pass
|
|
|
|
|
|
def stop():
|
|
"""模组停止。框架关闭时调用,释放资源。"""
|
|
pass
|
|
|
|
|
|
def reload(config: dict):
|
|
"""热重载配置(可选)"""
|
|
pass
|
|
|
|
|
|
def health() -> dict:
|
|
"""健康检查(可选)"""
|
|
return {"status": "ok", "version": VERSION}
|
|
|
|
|
|
def stats() -> dict:
|
|
"""统计信息(可选)"""
|
|
return {}
|