aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-26 04:13:11 +0100
committertv <tv@krebsco.de>2026-10-26 04:13:11 +0100
commit735b27ad691f768027d6034a3f50efbd68feda89 (patch)
treeb44ac893b2bf36ff92e2652ef5082de49acbeb36 /src/api
parent9b242809f874248c07130156ad9cb34c85e950ac (diff)
move protocol paths to dedicated module
Diffstat (limited to 'src/api')
-rw-r--r--src/api/mod.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs
index affb9ef..bec7764 100644
--- a/src/api/mod.rs
+++ b/src/api/mod.rs
@@ -25,6 +25,7 @@ use utoipa::OpenApi;
use utoipa_swagger_ui::SwaggerUi;
use crate::api::auth::{AuthState, AuthenticatedUser, basic_auth};
+use crate::document::meta;
use crate::document::store::StoreError;
use crate::state::AppState;
@@ -117,13 +118,11 @@ fn parse_write_path(
method: &str,
) -> Result<Vec<String>, StatusCode> {
let path = parse_key_path(key)?;
- if path.first().map(String::as_str) != Some(crate::remake::snapshot::META_ROOT) {
+ if !meta::is_protocol(&path) {
return Ok(path);
}
// `_continuum` itself, epoch metadata and the swarm ID: nobody.
- let fixed = path.len() < 2
- || path[1] == crate::remake::snapshot::EPOCHS
- || path[1] == crate::remake::snapshot::SWARM;
+ let fixed = path.len() < 2 || path[1] == meta::EPOCHS || path[1] == meta::SWARM;
if fixed || !state.protocol_writers.contains(&user.0) {
warn!(user = %user.0, method, path = %key, "Refused a write to protocol data");
return Err(StatusCode::FORBIDDEN);