From f8df6ed1e782b1358c8402b0b248583855ba939f Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 11 Jun 2019 16:59:27 +0200 Subject: [PATCH] split human-readable interface and hkp --- database/src/lib.rs | 6 +- dist/templates/search-form.html.hbs | 5 +- hagrid-routes.conf | 4 + src/web/hkp.rs | 44 ++++----- src/web/mod.rs | 140 ++++++++++------------------ src/web/vks_api.rs | 42 ++++++++- src/web/vks_web.rs | 47 +++++++++- 7 files changed, 162 insertions(+), 126 deletions(-) diff --git a/database/src/lib.rs b/database/src/lib.rs index db04dda..20799af 100644 --- a/database/src/lib.rs +++ b/database/src/lib.rs @@ -64,6 +64,10 @@ impl FromStr for Query { fn from_str(term: &str) -> Result { use self::Query::*; + if term.starts_with("0x") && term.len() < 16 && !term.contains('@') { + return Err(failure::err_msg( + "Search by Short Key ID is not supported, sorry!")); + } if let Ok(fp) = Fingerprint::from_str(term) { Ok(ByFingerprint(fp)) } else if let Ok(keyid) = KeyID::from_str(term) { @@ -71,7 +75,7 @@ impl FromStr for Query { } else if let Ok(email) = Email::from_str(term) { Ok(ByEmail(email)) } else { - Err(failure::err_msg("Malformed query")) + Err(failure::err_msg("Invalid search query!")) } } } diff --git a/dist/templates/search-form.html.hbs b/dist/templates/search-form.html.hbs index 6159fe4..de5a6f0 100644 --- a/dist/templates/search-form.html.hbs +++ b/dist/templates/search-form.html.hbs @@ -1,8 +1,7 @@
-
+