Atproto, Router, add atproto api mod with Nsid

Sets up a generic atproto module to store atproto implementation. Mainly
doing this so that I can switch between rsky/atrium as well as add my
own layers on top.

This also switches the old Xrpc/Router use of Nsid to the atproto api
implementation of it. Next up is the DB where I'll need a bunch of
these.
This commit is contained in:
Julia Lange 2025-04-25 13:52:02 -07:00
parent d4a3a71e2f
commit db33099405
Signed by: Julia
SSH key fingerprint: SHA256:50XUMcOFYPUs9/1j7p9SPnwASZ7QnxXm7THF7HkbqzQ
6 changed files with 858 additions and 32 deletions

View file

@ -1,4 +1,6 @@
use crate::router::{
use crate::{
atproto::Nsid,
router::{
Router,
Endpoint,
xrpc::{
@ -7,18 +9,21 @@ use crate::router::{
Response,
error,
},
},
};
use axum::http::StatusCode;
use http::status::StatusCode;
mod atproto;
mod router;
mod db;
#[tokio::main]
async fn main() {
let mut router = Router::new();
router = router.add_endpoint(Endpoint::new_xrpc_query(String::from("me.woach.get"), test));
router = router.add_endpoint(Endpoint::new_xrpc_procedure(String::from("me.woach.post"), test2));
let get_nsid = Nsid::new(String::from("me.woach.get")).expect("me.woach.get is a valid nsid");
let post_nsid = Nsid::new(String::from("me.woach.post")).expect("me.woach.post is a valid nsid");
router = router.add_endpoint(Endpoint::new_xrpc_query(get_nsid, test));
router = router.add_endpoint(Endpoint::new_xrpc_procedure(post_nsid, test2));
router.serve().await;
}