aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/api.rs')
-rw-r--r--server/src/routes/api.rs23
1 files changed, 21 insertions, 2 deletions
diff --git a/server/src/routes/api.rs b/server/src/routes/api.rs
index f761a8f..4e2211f 100644
--- a/server/src/routes/api.rs
+++ b/server/src/routes/api.rs
@@ -4,12 +4,15 @@
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use super::ui::{
- account::{login_logic, session::AdminSession},
+ account::{
+ login_logic,
+ session::{AdminSession, Session},
+ },
error::MyResult,
};
use crate::database::Database;
use jellybase::assetfed::AssetInner;
-use jellycommon::user::CreateSessionParams;
+use jellycommon::{user::CreateSessionParams, NodeID, Visibility};
use rocket::{
get,
http::MediaType,
@@ -53,6 +56,22 @@ pub fn r_api_asset_token_raw(_admin: AdminSession, token: &str) -> MyResult<Json
Ok(Json(AssetInner::deser(token)?))
}
+#[get("/api/nodes_modified?<since>")]
+pub fn r_api_nodes_modified_since(
+ _session: Session,
+ database: &State<Database>,
+ since: u64,
+) -> MyResult<Json<Vec<NodeID>>> {
+ let mut nodes = database.get_nodes_modified_since(since)?;
+ nodes.retain(|id| {
+ database.get_node(*id).map_or(false, |n| {
+ n.as_ref()
+ .map_or(false, |n| n.visibility >= Visibility::Reduced)
+ })
+ });
+ Ok(Json(nodes))
+}
+
pub struct AcceptJson(bool);
impl Deref for AcceptJson {
type Target = bool;