fix: base app Actor, domain stripper

This commit is contained in:
əlemi 2024-03-21 01:11:20 +01:00
parent 4f4cd5bf9b
commit 1215f49499
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 8 additions and 0 deletions

View file

@ -19,6 +19,13 @@ pub fn split_id(id: &str) -> (String, String) {
(first.to_string(), last.to_string()) (first.to_string(), last.to_string())
} }
pub fn domain(domain: &str) -> String {
domain
.replace("http://", "")
.replace("https://", "")
.replace('/', "")
}
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize)]
// TODO i don't really like how pleroma/mastodon do it actually, maybe change this? // TODO i don't really like how pleroma/mastodon do it actually, maybe change this?

View file

@ -74,6 +74,7 @@ pub async fn serve(db: DatabaseConnection, domain: String) {
// build our application with a single route // build our application with a single route
let app = Router::new() let app = Router::new()
// core server inbox/outbox, maybe for feeds? TODO do we need these? // core server inbox/outbox, maybe for feeds? TODO do we need these?
.route("/", get(ap::view))
.route("/inbox", post(ap::inbox)) .route("/inbox", post(ap::inbox))
.route("/outbox", get(ap::outbox)) .route("/outbox", get(ap::outbox))
// actor routes // actor routes