fixes and features

This commit is contained in:
Mateusz Gruszczyński
2026-07-23 13:47:17 +02:00
parent 3ed74b1eac
commit dc6227896b
21 changed files with 831 additions and 82 deletions
+8 -4
View File
@@ -12,7 +12,7 @@ use slug::slugify;
use crate::{
db, queries,
state::{NoteUpdate, SharedState},
state::{NoteUpdate, RoomEvent, SharedState},
};
const MAX_NAME_LENGTH: usize = 80;
@@ -282,7 +282,7 @@ pub async fn restore(
author: Some("restore".into()),
owner_map: "[]".into(),
};
let _ = state.note_channel(&workspace_slug, &note_slug).await.send(update);
let _ = state.note_channel(&workspace_slug, &note_slug).await.send(RoomEvent::Document(update));
Ok(Json(serde_json::json!({"ok": true})))
}
@@ -553,7 +553,7 @@ pub async fn pad_restore(
author: Some("restore".into()),
owner_map,
};
let _ = state.pad_channel(&slug).await.send(update);
let _ = state.pad_channel(&slug).await.send(RoomEvent::Document(update));
Ok(Json(serde_json::json!({"ok": true})))
}
@@ -800,7 +800,11 @@ async fn serve_token_file(state: &SharedState, token: &str, filename: &str) -> R
HeaderValue::from_str(mime.as_ref()).unwrap_or_else(|_| HeaderValue::from_static("application/octet-stream")),
);
response.headers_mut().insert(header::X_CONTENT_TYPE_OPTIONS, HeaderValue::from_static("nosniff"));
response.headers_mut().insert(header::CACHE_CONTROL, HeaderValue::from_static("public, max-age=600"));
response.headers_mut().insert(
header::CACHE_CONTROL,
HeaderValue::from_str(&format!("public, max-age={}", state.file_cache_max_age_seconds))
.expect("valid file cache-control header"),
);
Ok(response)
}