mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-10-11 20:05:38 +00:00
* feat: 初始化插件系统 * refactor: 收口插件系统运行时重构 * perf: 优化插件系统类型提示 * fix&perf: 修复和优化插件系统 * fix: 修复gitignore规则误忽略插件文件的问题 * fix: 修复运行时插件根路径算错的问题 * fix: 加强插件发现和路由注册的防护措施 * revert: 回滚定时任务白名单 * fix: 移除未使用的应用路由注册探测 * revert: 恢复部分代码 * perf: 优化插件系统 * docs: 新增插件开发文档 * perf: 优化插件管理模块 * perf: 提升插件系统核心能力 * refactor: 重构生命周期 step runner * fix: 修复lint错误 * test: 清理测试用例 * test: 调整测试目录名称 * fix: 修复前后端目录硬编码的问题 * fix: 修复插件系统安全性缺口 * refactor: 重新设计插件生命周期 Migration 事务与回滚 * perf: 优化插件系统边界问题 * refactor: 重构当前插件系统的依赖体系设计 * perf: 优化代码 * perf: 优化代码 * fix: 修复代码合并问题 * fix: 修复bug * perf: 优化代码 * perf&fix: 优化代码和修复bug * docs: 优化文档格式 * feat: 适配Vue2版本 * docs: 更新README文档 * fix: 修复ruff lint错误 * chore: 更新后端依赖文件
39 lines
1003 B
Python
39 lines
1003 B
Python
from dataclasses import dataclass
|
|
|
|
from plugins.core.manifest.schema import PluginMenuManifest
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class InstalledPluginMenu:
|
|
"""
|
|
已安装插件菜单快照。
|
|
"""
|
|
|
|
menu_id: int
|
|
menu_key: str
|
|
manifest_menu: PluginMenuManifest
|
|
|
|
|
|
class PluginMenuKeyBuilder:
|
|
"""
|
|
插件菜单自然键构建器。
|
|
|
|
使用 Strategy 思路将菜单自然键计算逻辑集中封装,便于后续调整匹配规则时
|
|
不影响菜单安装流程。
|
|
"""
|
|
|
|
@classmethod
|
|
def build(cls, menu: PluginMenuManifest, parent_key: str) -> str:
|
|
"""
|
|
构建插件菜单自然键。
|
|
|
|
:param menu: 插件菜单声明
|
|
:param parent_key: 父级菜单自然键
|
|
:return: 插件菜单自然键
|
|
"""
|
|
if menu.type == 'F':
|
|
return f'button:{parent_key}/{menu.name}#{menu.perms}'
|
|
if menu.perms:
|
|
return f'perm:{menu.perms}'
|
|
return f'route:{parent_key}/{menu.path}#{menu.component}'
|