feat: 实现依赖注入系统、插件架构和窗口管理

- 引入ExamAware的DI系统并适配SecScore项目
- 添加服务注册表和窗口管理器
- 实现基于Koishi的Disposable设计的插件系统
- 集成Winston日志服务
- 分离设置窗口为独立页面
- 将非核心功能改为内置插件
- 更新README文件
- 添加相关hooks和工具函数
This commit is contained in:
Yukino_fox
2026-04-26 19:39:56 +08:00
parent a39355d62a
commit 18eada8ff3
47 changed files with 5347 additions and 180 deletions
+58
View File
@@ -169,3 +169,61 @@ pub async fn window_start_dragging(
}
Ok(())
}
#[tauri::command]
pub async fn open_settings_window(app: AppHandle) -> Result<(), String> {
#[cfg(not(desktop))]
{
let _ = app;
return Err("Not supported on mobile".to_string());
}
#[cfg(desktop)]
{
// 检查设置窗口是否已存在
if let Some(window) = app.get_webview_window("settings") {
// 如果窗口已存在,将其置于前台
window.set_focus().map_err(|e| e.to_string())?;
return Ok(());
}
// 创建新的设置窗口
let window = tauri::WebviewWindowBuilder::new(
&app,
"settings",
tauri::WebviewUrl::App("/settings-window".into()),
)
.title("SecScore 设置")
.inner_size(900.0, 650.0)
.min_inner_size(700.0, 500.0)
.center()
.decorations(false)
.transparent(false)
.resizable(true)
.build()
.map_err(|e| e.to_string())?;
// 在开发模式下打开开发者工具
#[cfg(debug_assertions)]
window.open_devtools();
Ok(())
}
}
#[tauri::command]
pub async fn close_settings_window(app: AppHandle) -> Result<(), String> {
#[cfg(not(desktop))]
{
let _ = app;
return Ok(());
}
#[cfg(desktop)]
{
if let Some(window) = app.get_webview_window("settings") {
window.close().map_err(|e| e.to_string())?;
}
Ok(())
}
}
+2
View File
@@ -131,6 +131,8 @@ pub fn run() {
toggle_devtools,
window_resize,
window_set_resizable,
open_settings_window,
close_settings_window,
db_test_connection,
db_switch_connection,
db_get_status,