Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

did filtering, probably

phil 710aa7b1 b3148e63

+16 -2
+16 -2
constellation/src/server/mod.rs
··· 11 11 use bincode::Options; 12 12 use serde::{Deserialize, Serialize}; 13 13 use serde_with::serde_as; 14 - use std::collections::HashMap; 14 + use std::collections::{HashMap, HashSet}; 15 15 use std::time::{Duration, UNIX_EPOCH}; 16 16 use tokio::net::{TcpListener, ToSocketAddrs}; 17 17 use tokio::task::block_in_place; ··· 238 238 collection: String, 239 239 path: String, 240 240 cursor: Option<OpaqueApiCursor>, 241 + did: Vec<String>, 241 242 limit: Option<u64>, 242 243 // TODO: allow reverse (er, forward) order as well 243 244 } ··· 270 271 return Err(http::StatusCode::BAD_REQUEST); 271 272 } 272 273 274 + // ugh could have just passed the zero-len hashmap through, same check in the impl 275 + // but now i feel lazy 276 + let empty = query.did.is_empty(); 277 + let dids = if !empty { 278 + None 279 + } else { 280 + let mut out = HashSet::new(); 281 + for d in &query.did { 282 + out.insert(Did(d.clone())); 283 + } 284 + Some(out) 285 + }; 286 + 273 287 let paged = store 274 288 .get_links( 275 289 &query.target, ··· 277 291 &query.path, 278 292 limit, 279 293 until, 280 - None, 294 + dids.as_ref(), 281 295 ) 282 296 .map_err(|_| http::StatusCode::INTERNAL_SERVER_ERROR)?; 283 297