Document domain and base-url
This commit is contained in:
		
							parent
							
								
									6a5efb48d9
								
							
						
					
					
						commit
						e07c0e9e11
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -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(())
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue