feat(target-lists): 新增黑白名单管理与实时告警功能

- rid-shared 新增 target_lists 模块,定义名单数据契约
- 地图适配器支持按名单类型着色渲染目标(白/黑/未知)
- 新增名单筛选器与目标目录过滤联动
- 实时详情面板支持加入/编辑白名单与黑名单操作
- 新增黑名单命中告警横幅与事件日志高亮
- 新增名单管理浮层(Manager 组件)与徽章展示
- 底图默认切换为影像图,相机初始俯仰角归零
- color-scheme 切换为 dark,新增 glass/workbench 样式
```
This commit is contained in:
2026-10-23 09:12:50 +08:00
parent 3cf50f2e8b
commit df9e8bdeb5
24 changed files with 1481 additions and 120 deletions
+69 -41
View File
@@ -78,7 +78,8 @@ fn apply(state: &Shared) {
"false"
},
);
let _ = body.set_attribute("class", &format!("b R2 theme-{theme}"));
// Legacy preference values remain intact; all use the approved dark material.
let _ = body.set_attribute("class", "b R2 theme-graphite");
}
let image = p["image"].as_str().map(str::to_owned).unwrap_or_else(|| {
format!(
@@ -118,32 +119,7 @@ fn apply(state: &Shared) {
if let Some(fit) = el("fit").and_then(|e| e.dyn_into::<HtmlSelectElement>().ok()) {
fit.set_value(p["fit"].as_str().unwrap_or("cover"));
}
text(
"theme-name",
match theme {
"blue" => "深蓝玻璃",
"white" => "透明白玻璃",
_ => "石墨玻璃",
},
);
each("[data-theme]", |e| {
if e.tag_name() == "BODY" {
return;
}
let active = e.get_attribute("data-theme").as_deref() == Some(theme);
let _ = e.set_attribute("aria-pressed", if active { "true" } else { "false" });
let classes = e
.get_attribute("class")
.unwrap_or_default()
.split_whitespace()
.filter(|c| *c != "active")
.collect::<Vec<_>>()
.join(" ");
let _ = e.set_attribute(
"class",
&format!("{classes}{}", if active { " active" } else { "" }),
);
});
text("theme-name", "深海蓝玻璃");
each("[data-wall]", |e| {
let active = p["image"].is_null()
&& e.get_attribute("data-wall").as_deref() == p["wallpaper"].as_str();
@@ -158,10 +134,43 @@ fn apply(state: &Shared) {
);
});
if let Some(sample) = el("desktop-sample").and_then(|e| e.dyn_into::<HtmlElement>().ok()) {
let _ = sample.style().set_property(
"--preview-shade",
&(p["dim"].as_f64().unwrap_or(14.0) / 100.0).to_string(),
);
let _ = sample
.style()
.set_property("background-image", &format!("url(\"{image}\")"));
.set_property("--preview-blur", &format!("{}px", p["blur"]));
}
if let Some(preview) = el("appearance-wallpaper") {
let _ = preview.set_attribute("src", &image);
if let Some(element) = preview.dyn_ref::<HtmlElement>() {
let _ = element
.style()
.set_property("object-fit", p["fit"].as_str().unwrap_or("cover"));
}
}
let wallpaper_name = if p["image"].is_string() {
"自定义壁纸"
} else {
match p["wallpaper"].as_str().unwrap_or("B4") {
"B1" => "黑曜石柔光",
"B2" => "午夜蓝丝绸",
"B3" => "石墨空间玻璃",
_ => "科技网格",
}
};
text("appearance-wallpaper-name", wallpaper_name);
text("appearance-dim-value", &format!("{}%", p["dim"]));
text("appearance-blur-value", &format!("{} px", p["blur"]));
text(
"appearance-fit-value",
if p["fit"].as_str() == Some("contain") {
"完整显示"
} else {
"铺满屏幕"
},
);
}
async fn fetch_preferences(state: Shared) {
let result = async {
@@ -276,14 +285,14 @@ fn show(view: &str, realtime: bool) {
}
hidden("workspace-content", view == "home" || view == "settings");
hidden("appearance-view", view != "settings");
hidden("home-top", view != "home");
if let Ok(Some(header)) = document().query_selector(".reference-top") {
text(
"workspace-brand",
if view == "home" {
let _ = header.set_attribute("hidden", "");
"RID 工作空间"
} else {
let _ = header.remove_attribute("hidden");
}
}
"应用"
},
);
each(".homescreen", |e| {
if view == "home" {
let _ = e.remove_attribute("hidden");
@@ -481,6 +490,32 @@ pub fn init(realtime: bool) {
show("home", realtime);
return;
}
if let Some(section) = button.get_attribute("data-setting-section") {
if let Some(target) = el(&section) {
target.scroll_into_view();
if let Some(element) = target.dyn_ref::<HtmlElement>() {
let _ = element.focus();
}
}
each("[data-setting-section]", |entry| {
let active = entry.get_attribute("data-setting-section").as_deref()
== Some(section.as_str());
let _ = entry.set_attribute(
"class",
if active {
"setting-link active"
} else {
"setting-link"
},
);
if active {
let _ = entry.set_attribute("aria-current", "location");
} else {
let _ = entry.remove_attribute("aria-current");
}
});
return;
}
if let Some(view) = button.get_attribute("data-open") {
show(&view, realtime);
if view == "settings" {
@@ -491,13 +526,6 @@ pub fn init(realtime: bool) {
}
return;
}
if let Some(theme) = button.get_attribute("data-theme") {
if clicked.borrow().ready {
clicked.borrow_mut().prefs["theme"] = json!(theme);
queue_save(clicked.clone());
}
return;
}
if let Some(wall) = button.get_attribute("data-wall") {
if clicked.borrow().ready {
let mut s = clicked.borrow_mut();