diff --git a/crates/ptth_relay/src/relay_state.rs b/crates/ptth_relay/src/relay_state.rs index 4987446..f9dfbf0 100644 --- a/crates/ptth_relay/src/relay_state.rs +++ b/crates/ptth_relay/src/relay_state.rs @@ -121,6 +121,11 @@ pub enum AuditData { server: crate::config::file::Server, }, RelayStart, + ScraperGet { + key_name: String, + server_name: String, + uri: String, + }, WebClientGet { user: Option , server_name: String, diff --git a/docs/reference/scraper-keys.md b/docs/reference/scraper-keys.md new file mode 100644 index 0000000..38dbad3 --- /dev/null +++ b/docs/reference/scraper-keys.md @@ -0,0 +1,33 @@ +# How scraper keys work + +Come up with a random passphrase: + +`not this, this is a bogus passphrase for documentation` + +Run that through the `hash-api-key` subcommand of any `ptth_relay` instance: + +`ptth_relay hash-api-key` + +You'll get a hash like this: + +`RUWt1hQQuHIRjftOdgeZf0PG/DtAmIaMqot/nwBAZXQ=` + +Make sure that gets into the relay's config file, `ptth_relay.toml`: + +``` +[[scraper_keys]] +name = "shudder_mummy" +not_before = "2021-08-27T19:20:25-05:00" +not_after = "2031-08-27T19:20:25-05:00" +hash = "RUWt1hQQuHIRjftOdgeZf0PG/DtAmIaMqot/nwBAZXQ=" +``` + +Use curl to like, try it out: + +``` +curl \ +--header "X-ApiKey: not this, this is a bogus passphrase for documentation" \ +http://localhost:4000/scraper/v1/server/$SERVER_NAME/files/ +``` + +(Replace `$SERVER_NAME` with the name of the server you want to reach. And change the URL so it's not going to localhost.)