Kibou is a federated social networking server.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

routes.rs 840B

1234567891011121314151617
  1. use activitypub::activity as ap_activity;
  2. use activitypub::actor as ap_actor;
  3. use activitypub::controller;
  4. use rocket_contrib::json::JsonValue;
  5. use serde_json;
  6. #[get("/actors/<handle>", format="application/activity+json")]
  7. pub fn actor(handle: String) -> JsonValue { ap_actor::get_json_by_preferred_username(handle)}
  8. #[post("/actors/<id>/inbox", data="<activity>")]
  9. pub fn actor_inbox(id: String, activity: String) { controller::prepare_incoming(serde_json::from_str(&activity).unwrap_or_else(|_| serde_json::json!({}))); }
  10. #[post("/inbox", data="<activity>")]
  11. pub fn inbox(activity: String) { controller::prepare_incoming(serde_json::from_str(&activity).unwrap_or_else(|_| serde_json::json!({}))); }
  12. #[get("/objects/<id>", format="application/activity+json")]
  13. pub fn object(id: String) -> JsonValue { ap_activity::get_json_by_id(id) }