feat: 新增脚手架/开发模式/权限白名单/system-monitor插件
- nebula create mod/key/list-templates 模组脚手架 - nebula dev 开发模式热重载 - manifest permissions.imports 权限白名单机制 - system-monitor 系统监控仪表盘插件 - 默认端口统一为 10086 - 修复 _init_nbpf 误读 Ed25519 私钥为 RSA 的 bug - 更新 README.md 文档
This commit is contained in:
@@ -114,9 +114,16 @@ class NBPFPacker:
|
||||
# 1. 读取 manifest
|
||||
manifest = self._read_manifest(plugin_dir)
|
||||
|
||||
# 2. 编译所有 .py 文件为 NIR
|
||||
# 2. 编译所有 .py 文件为 NIR(传入 manifest 权限白名单)
|
||||
Log.info("NBPF", f"编译插件: {plugin_dir.name}")
|
||||
nir_data = self.compiler.compile_plugin(plugin_dir)
|
||||
perms = manifest.get("permissions", {})
|
||||
if isinstance(perms, dict):
|
||||
allowed_imports = perms.get("imports", [])
|
||||
else:
|
||||
allowed_imports = [] # 旧的数组格式,不开放系统模块
|
||||
if allowed_imports:
|
||||
Log.info("NBPF", f"已授权导入: {allowed_imports}")
|
||||
nir_data = self.compiler.compile_plugin(plugin_dir, allowed_imports=allowed_imports)
|
||||
|
||||
# 3. 收集资源文件
|
||||
res_files = self._collect_resources(plugin_dir)
|
||||
|
||||
Reference in New Issue
Block a user