This commit is contained in:
Mateusz Gruszczyński committed 2026-11-08 12:57:19 +01:00
1 parent b6e8ddb9c7
commit 818cae8592
12 files changed
+253 -33

No files matched your search

+21
View File
@@ -45,9 +45,29 @@ pub struct App {
/// Collection ids a device still uses but that do not exist here (e.g. left over from
/// Z-Push). They are sent as FolderHierarchy Delete on the next FolderSync.
stale: Mutex<std::collections::HashMap<i64, std::collections::BTreeSet<String>>>,
/// Last Autodiscover requests with headers (no secrets) and bodies, for the panel.
ad_trace: Mutex<std::collections::VecDeque<serde_json::Value>>,
}
impl App {
pub fn ad_trace_push(&self, v: serde_json::Value) {
let mut t = self.ad_trace.lock().unwrap();
if t.len() >= 30 {
t.pop_front();
}
t.push_back(v);
}
pub fn ad_trace_list(&self) -> Vec<serde_json::Value> {
self.ad_trace
.lock()
.unwrap()
.iter()
.rev()
.cloned()
.collect()
}
pub async fn new(boot: Boot, logs: Arc<LogRing>) -> anyhow::Result<Arc<App>> {
let db = db::open(&boot.data_dir).await?;
let (settings, rev) = db::load_settings(&db).await?;
@@ -73,6 +93,7 @@ impl App {
loops: Mutex::new(std::collections::HashMap::new()),
shutdown: tokio_util::sync::CancellationToken::new(),
stale: Mutex::new(std::collections::HashMap::new()),
ad_trace: Mutex::new(std::collections::VecDeque::new()),
}))
}