diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6b0a89 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Northbound Train + +Translate Cohost users and posts into ActivityPub actors and activities. + +> Till we feel the far track humming, +> and we see her headlight plain, +> and we gather and wait her coming -- +> the wonderful north-bound train. +> +> - *Bridge-Guard in the Karroo*, Rudyard Kipling + +## What it currently does + +Right now northbound-train just proxies Webfinger requests to Cohost project lookups using the v1 API. + +Place it at `.well-known/webfinger` and set your domain name with `--domain`. + +If you must, you can configure the base URL with `--base-url`. + +## Todo + +- [x] Webfinger for Cohost users + - [ ] Handle redirects if they exist (?) +- [ ] Expose ActivityPub actors for Cohost users +- [ ] Permit following ActivityPub actors for Cohost users +- [ ] Deliver posts from Cohost users to ActivityPub followers \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 71dd35e..4d43a6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,7 @@ static ARGS: once_cell::sync::Lazy = once_cell::sync::Lazy::new(|| { Args::parse() }); -#[get("/.well-known/webfinger?")] +#[get("/?")] async fn webfinger_route(params: HashMap) -> Option> { if params.len() != 1 { eprintln!("Too may or too few parameters. Expected 1, got {}", params.len()); @@ -62,7 +62,7 @@ async fn main() -> Result<(), Box> { // Set up the global config once_cell::sync::Lazy::force(&ARGS); let _rocket = rocket::build() - .mount("/", routes![webfinger_route]) + .mount(&ARGS.base_url, routes![webfinger_route]) .ignite().await?.launch().await?; Ok(()) }