diff --git a/routes/profile.js b/routes/profile.js index ab50bb3..37f969f 100644 --- a/routes/profile.js +++ b/routes/profile.js @@ -37,6 +37,10 @@ router.get('/hkp/:input', function(req, res) { res.render('profile', { mode: "hkp", uid: req.params.input }) }); +router.get('/hkp/:server/:input', function(req, res) { + res.render('profile', { mode: "hkp", uid: req.params.input, server: req.params.server }) +}); + router.get('/keybase/:username/:fingerprint', function(req, res) { res.render('profile', { mode: "keybase", uid: `${req.params.username}/${req.params.fingerprint}` }) }); diff --git a/static/scripts.js b/static/scripts.js index a740527..4b6be52 100644 --- a/static/scripts.js +++ b/static/scripts.js @@ -235,9 +235,14 @@ async function displayProfile(opts) { let icon_qr = ''; try { - keyData = await doip.keys.fetch.uri(`${opts.mode}:${opts.input}`); + let keyURI; + if (opts.mode === 'hkp' && opts.server) { + keyURI = `${opts.mode}:${opts.server}:${opts.input}` + } else { + keyURI = `${opts.mode}:${opts.input}` + } + keyData = await doip.keys.fetch.uri(keyURI); fingerprint = keyData.keyPacket.getFingerprint(); - // keyData = await fetchKeys(opts); } catch (e) { feedback += `
There was a problem fetching the keys.
`; feedback += `${e}
`;
@@ -1026,6 +1031,7 @@ let elFormVerify = document.body.querySelector("#form-verify"),
elFormProofs = document.body.querySelector("#form-proofs"),
elProfileUid = document.body.querySelector("#profileUid"),
elProfileMode = document.body.querySelector("#profileMode"),
+ elProfileServer = document.body.querySelector("#profileServer"),
elModeSelect = document.body.querySelector("#modeSelect"),
elUtilWKD = document.body.querySelector("#form-util-wkd"),
elUtilQRFP = document.body.querySelector("#form-util-qrfp"),
@@ -1171,7 +1177,7 @@ if (elFormProofs) {
}
if (elProfileUid) {
- let match, opts, profileUid = elProfileUid.innerHTML;
+ let opts, profileUid = elProfileUid.innerHTML;
switch (elProfileMode.innerHTML) {
default:
case "auto":
@@ -1191,6 +1197,13 @@ if (elProfileUid) {
break;
case "hkp":
+ opts = {
+ input: profileUid,
+ server: elProfileServer.innerHTML,
+ mode: elProfileMode.innerHTML
+ }
+ break;
+
case "wkd":
opts = {
input: profileUid,
diff --git a/views/profile.pug b/views/profile.pug
index d714f7e..1b1c81d 100644
--- a/views/profile.pug
+++ b/views/profile.pug
@@ -9,6 +9,7 @@ head
main.container.container--profile
.content
span#profileUid(style='display: none;') #{uid}
+ span#profileServer(style='display: none;') #{server}
span#profileMode(style='display: none;') #{mode}
#profileHeader
img#profileAvatar(src='/static/img/avatar_placeholder.png' alt='avatar' style='display: none')