Adds fetched_at to RemoteActor, configurable TTL via builder (.actor_cache_ttl_secs, default 24h), and get_or_refresh_remote_actor helper that re-fetches stale actors from origin. Closes #3
58 lines
1.4 KiB
Rust
58 lines
1.4 KiB
Rust
mod activity;
|
|
mod actor;
|
|
mod blocklist;
|
|
mod follow;
|
|
|
|
pub use activity::ActivityRepository;
|
|
pub use actor::ActorRepository;
|
|
pub use blocklist::BlocklistRepository;
|
|
pub use follow::FollowRepository;
|
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum FollowerStatus {
|
|
Pending,
|
|
Accepted,
|
|
Rejected,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum FollowingStatus {
|
|
Pending,
|
|
Accepted,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub struct RemoteActor {
|
|
pub url: String,
|
|
pub handle: String,
|
|
pub inbox_url: String,
|
|
pub shared_inbox_url: Option<String>,
|
|
pub display_name: Option<String>,
|
|
pub avatar_url: Option<String>,
|
|
pub outbox_url: Option<String>,
|
|
pub bio: Option<String>,
|
|
pub banner_url: Option<String>,
|
|
pub followers_url: Option<String>,
|
|
pub following_url: Option<String>,
|
|
pub also_known_as: Vec<String>,
|
|
/// When this actor was last fetched from the origin instance.
|
|
/// `None` means unknown — treated as always-fresh to avoid
|
|
/// breaking existing consumers that don't populate this field.
|
|
pub fetched_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Follower {
|
|
pub actor: RemoteActor,
|
|
pub status: FollowerStatus,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct BlockedDomain {
|
|
pub domain: String,
|
|
pub reason: Option<String>,
|
|
pub blocked_at: String,
|
|
}
|