diff --git a/README.md b/README.md index 2a1b80e..51c021e 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,14 @@ Retrieves the key with the given *User ID*. Only exact matches are accepted. Lookup by *User ID* requires opt-in by the key's owner. The returned key is *ASCII Armored*. +#### `POST /vks/v1/publish` + +Keys may be submitted using a POST request to `/vks/v1/publish`, the +body of the request being a `multipart/form-data` query. `keytext` +must be the keys to submit, either *ASCII Armored* or not. More than +one key may be submitted in one request. Hagrid will send +verification emails to every non-expired *User ID*. + Building -------- diff --git a/dist/templates/apidoc.html.hbs b/dist/templates/apidoc.html.hbs index a262ebb..7c0b00c 100644 --- a/dist/templates/apidoc.html.hbs +++ b/dist/templates/apidoc.html.hbs @@ -37,6 +37,17 @@ by the key's owner. The returned key is ASCII Armored.

+

POST /vks/v1/publish

+ +

+ Keys may be submitted using a POST request + to /vks/v1/publish, the body of the request being + a multipart/form-data query. keytext + must be the keys to submit, either ASCII Armored or not. + More than one key may be submitted in one request. Hagrid will + send verification emails to every non-expired User ID. +

+

HPK interface

Hagrid implements a subset of diff --git a/dist/templates/publish.html.hbs b/dist/templates/publish.html.hbs index 123f8c2..e476ef4 100644 --- a/dist/templates/publish.html.hbs +++ b/dist/templates/publish.html.hbs @@ -2,7 +2,7 @@

After uploading your key we will send a verification link to each email address we find inside. Clicking that link will make your key searchable by that email address.

-
+
diff --git a/src/web/mod.rs b/src/web/mod.rs index 9118cf9..06f3272 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -434,12 +434,12 @@ fn rocket_factory(rocket: rocket::Rocket) -> Result { vks_v1_by_email, vks_v1_by_fingerprint, vks_v1_by_keyid, + upload::vks_v1_publish_post, // User interaction. delete, delete_post, delete_confirm, upload::publish, - upload::publish_post, publish_verify, // HKP hkp::pks_lookup, @@ -904,7 +904,7 @@ pub mod tests { body.extend_from_slice(header); body.extend_from_slice(data); body.extend_from_slice(footer); - let response = client.post("/publish") + let response = client.post("/vks/v1/publish") .header(ct) .body(&body[..]) .dispatch(); diff --git a/src/web/upload.rs b/src/web/upload.rs index dfe5dc9..d6d75ba 100644 --- a/src/web/upload.rs +++ b/src/web/upload.rs @@ -36,8 +36,8 @@ pub fn publish() -> MyResponse { MyResponse::ok("publish", context) } -#[post("/publish", data = "")] -pub fn publish_post( +#[post("/vks/v1/publish", data = "")] +pub fn vks_v1_publish_post( db: rocket::State, cont_type: &ContentType, data: Data, mail_service: rocket::State, state: rocket::State, ) -> MyResponse {