gourami

[UNMAINTAINED] Activitypub server in Rust
Log | Files | Refs | README | LICENSE

commit 3c1a49d5cf199f67200a330e72c8cc877d02a3ec
parent df6bd711aef66db1ec25486217dd338eef5231bb
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat,  9 May 2020 20:23:29 -0500

fix bugs with test notes

Diffstat:
Msrc/ap.rs | 6++++--
Msrc/main.rs | 20++++++++------------
2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/ap.rs b/src/ap.rs @@ -90,8 +90,10 @@ pub fn process_create_note( // TODO inbox forwarding https://www.w3.org/TR/activitypub/#inbox-forwarding // let conn = &POOL.get().unwrap(); + // Get actor let object = v.get("object").ok_or("No object found")?; let _type = object.get("type").ok_or("No object type found")?; + // match type == note let content = object .get("content") .ok_or("No content found")? @@ -267,7 +269,7 @@ pub fn new_note_to_ap_message(note: &NoteInput, user: &User) -> Value { "@context": "https://www.w3.org/ns/activitystreams", "id": "someid", "type": "Create", - "actor": "my_server/actor", // get from DEPLOY_URL + "actor": server_actor(), // get from DEPLOY_URL "published": "now", "to": [ "destination.server" @@ -277,7 +279,7 @@ pub fn new_note_to_ap_message(note: &NoteInput, user: &User) -> Value { "type": "note", "url": "abc", "inReplyTo": "none", - "attributedTo": user.username, + "attributedTo": "a remote user", "content": note.content } }) diff --git a/src/main.rs b/src/main.rs @@ -9,24 +9,20 @@ async fn main() { .author("Alex Wennerberg <alex@alexwennerberg.com>") .about("Gourami server and admin tools") .subcommand(App::new("run").about("Run server")) - .subcommand(App::new("admin").about("Admin Tools") - .subcommand(App::new("follow") - .arg(Arg::with_name("URL") - .help("url of the remote server to follow") - .required(true) - .index(1) - ) - ) + .subcommand(App::new("follow") + .arg(Arg::with_name("URL") + .help("url of the remote server to follow") + .required(true) + .index(1) + ) ) .get_matches(); if let Some(m) = matches.subcommand_matches("run") { run_server().await; - } else if let Some(m) = matches.subcommand_matches("admin") { - if let Some(m) = m.subcommand_matches("follow") { + } else if let Some(m) = matches.subcommand_matches("follow") { let url = m.value_of("URL").unwrap(); ap::follow_remote_server(url).await.unwrap(); - } + } // reset password // follow remote - } }