Document domain and base-url

This commit is contained in:
Leonora Tindall 2022-10-30 12:44:07 -05:00
parent 6a5efb48d9
commit e07c0e9e11
Signed by: nora
GPG Key ID: 7A8B52EC67E09AAF
2 changed files with 28 additions and 2 deletions

26
README.md Normal file
View File

@ -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

View File

@ -28,7 +28,7 @@ static ARGS: once_cell::sync::Lazy<Args> = once_cell::sync::Lazy::new(|| {
Args::parse()
});
#[get("/.well-known/webfinger?<params..>")]
#[get("/?<params..>")]
async fn webfinger_route(params: HashMap<String, String>) -> Option<Json<CohostWebfingerResource>> {
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<dyn Error>> {
// 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(())
}