Simplify the Inbox trait
If we want to add, for instance, streams in the future, we could introduce a new trait for that, similar to FromActivity or Notify We also display inbox errors to the "client" if something fails, which could be useful for debugging.
This commit is contained in:
@@ -35,8 +35,13 @@ fn index(conn: DbConn, user: Option<User>) -> Template {
|
||||
fn shared_inbox(conn: DbConn, data: String) -> String {
|
||||
let act: serde_json::Value = serde_json::from_str(&data[..]).unwrap();
|
||||
let instance = Instance::get_local(&*conn).unwrap();
|
||||
instance.received(&*conn, act);
|
||||
String::from("")
|
||||
match instance.received(&*conn, act) {
|
||||
Ok(_) => String::new(),
|
||||
Err(e) => {
|
||||
println!("Shared inbox error: {}\n{}", e.cause(), e.backtrace());
|
||||
format!("Error: {}", e.cause())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/nodeinfo")]
|
||||
|
||||
Reference in New Issue
Block a user