From 10162c6f88f16091e22bf676b42836d264034d23 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 5 Nov 2020 12:51:00 +0100 Subject: [PATCH] Revert social-proof commits This reverts commit 149a698a3f74caff79b7ae7fac0fea686930fbf1. This reverts commit 29018f024d967020f5395aaa6c7ffd6b38fe4e9a. This reverts commit 42372f27cb78677f94c88ca2a8175779d0cfe2d9. This reverts commit a424642256ea59e2d04b55beed3078ed5c197317. --- .tx/config | 8 - dist/assets/img/certificate.svg | 1 - dist/assets/img/envelope.svg | 1 - dist/assets/img/github.png | Bin 1309 -> 0 bytes dist/assets/img/github.svg | 1 - dist/assets/img/globe.svg | 1 - dist/assets/img/hackernews.svg | 1 - dist/assets/img/key.svg | 1 - dist/assets/img/mastodon.svg | 1 - dist/assets/img/reddit.svg | 1 - dist/assets/js/proofs.js | 295 -------------------------- dist/assets/openpgp.min.js | 2 - dist/assets/proofs.css | 251 ---------------------- dist/assets/proofs.json | 143 ------------- dist/templates/about/proofs.html.hbs | 59 ------ dist/templates/found-profile.html.hbs | 75 ------- hagrid-routes.conf | 14 -- src/web/mod.rs | 7 - src/web/vks_web.rs | 37 ---- 19 files changed, 899 deletions(-) delete mode 100644 dist/assets/img/certificate.svg delete mode 100644 dist/assets/img/envelope.svg delete mode 100644 dist/assets/img/github.png delete mode 100644 dist/assets/img/github.svg delete mode 100644 dist/assets/img/globe.svg delete mode 100644 dist/assets/img/hackernews.svg delete mode 100644 dist/assets/img/key.svg delete mode 100644 dist/assets/img/mastodon.svg delete mode 100644 dist/assets/img/reddit.svg delete mode 100644 dist/assets/js/proofs.js delete mode 100644 dist/assets/openpgp.min.js delete mode 100644 dist/assets/proofs.css delete mode 100644 dist/assets/proofs.json delete mode 100644 dist/templates/about/proofs.html.hbs delete mode 100644 dist/templates/found-profile.html.hbs diff --git a/.tx/config b/.tx/config index 95c0e8d..582c055 100644 --- a/.tx/config +++ b/.tx/config @@ -9,14 +9,6 @@ file_filter = po/hagrid/.po trans.zh-Hans = po/hagrid/zh_Hans.po type = PO -[hagrid.about-proofs] -minimum_perc = 100 -source_file = templates-untranslated/about/proofs.html.hbs -file_filter = templates-translated//about/proofs.html.hbs -trans.zh-Hans = templates-translated/zh_Hans/about/proofs.html.hbs -source_lang = en -type = HTML - [hagrid.about-about] minimum_perc = 100 source_file = templates-untranslated/about/about.html.hbs diff --git a/dist/assets/img/certificate.svg b/dist/assets/img/certificate.svg deleted file mode 100644 index 0738c25..0000000 --- a/dist/assets/img/certificate.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/envelope.svg b/dist/assets/img/envelope.svg deleted file mode 100644 index edbcad3..0000000 --- a/dist/assets/img/envelope.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/github.png b/dist/assets/img/github.png deleted file mode 100644 index 6723d81a27ebbdf9d45b0b9161f7572968bc07c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1309 zcmbtU|2Go|0G~=m!wPHE)zq_{HEylCY5P#!j@2?mwnJx5SgyM2bUXbG_j&L0`Ml42pZ7k$eXfKA`P7P$(Q69Aq#U0)YUHMu&uiWMpKR zOeUF3#^G=j3WdR7&}cMlHhX1}$K&Dg`111d#l^*jh6W!WpN@_Wv)LRR94r=#)xV}V zuaumULW2$izzjjhB8)xAL+hCtoN}SUq%l};3Jn4P*0=@`e8bK}zSW+{QKG?F&l7s@ zKg*YwRknM!n%`^y@t;9w1jUDDrbe zDjTI#B6RyOQpNyLU4W&5XB|L}D0I9NeVqK#XUft31^=?S7ROg((_J03UXa&E?UG6_ zAN85pFerQrb;=4`1+;9vpgFhzOFI4=28^+&HeVOXL#gUO`d2h4BK%lW+n6*%ZdVA0*d(sQUPHQw`xYZfDN~6aGlfB;D_u8#Q!d2SZdGEdY z?r)3!BI^47##Q2;>hc=|=R5YzoUTGy#X{k1O;vpqKdGyZbJ#n%hj3*q6d?gI>RMXj zxUJW=&c8}IlAhE$E}eP!v;?yemATklXC)d2t&SO%_trx64t6x#Y-CaV#;M-Pgj?63 zbzDUuXJW#FtUP-TIj1@&zb$zp-UzguakoMhDY>oOPMm^kg+N*N1|TGM`Q)o&#!%uu za;EE^TcXU0lb&S0o43F%Ru+~^m)KCkPtjH#9g1E{=6iVao%r{!4}>x)1$1{PStSAG z#jqf>J8~D94ovr#!LOifb-N3a0dZE_>H%>Vk4q49DqKdhT05sZ)|k(n|3qU9*+^=8 z+w>R&ItAW@L{kgs{%H8t`ON-l<{Zl?aXeY=2r+xsIipTZj{D)re0OZFTcYe5et>;% zxi5LcE;=c3LaU+QHJrH(myNW%Ljh4A<6@=bd7^+82Y9AOIn^s7?m;+z4wN{b5Hb$auU?qkw+P^S&J9+jgG{G#fPz`%4_Pf%5yoj<4T zx8Gqk97=Ua`Kxr{{)sK*H^#m!XUgt2WO`>=?)wq1@0uZ&U!r3c?!}IKIDi}sAKM}k zr^C0cJ>ZG!tI;<6!0Qo2U}XE>&;nLrkqkGf+N)acpw2$doSE4cp_P6@NsHUK++f$Slmd6eB)|^ZlHhHmJnRKIw4W?Ln%#L9;&jZefY7dik(^ zXI)O_o=<0Uk5Ot2(Qa5^V^jb0;Nse4)(v%VaY1Vds%Ue2^k|sK%%HMJI^*PcgKtGO z(u=FxQyM2$`*Lnaz4iKgc{ zMMV58GH*GWSm6!n->yR%$3Atx8reRxjYnIIGL4d_*X?M-YB<c|Is_Oc9QzJ#ta1OaGnkdT7H> z^@!YyS`Azpo==TfgNJzPb#s?FetydY(%gr!rLp~AE%$NP)T}kuC44)%0Adh9x}SOB EKg<$Y*#H0l diff --git a/dist/assets/img/github.svg b/dist/assets/img/github.svg deleted file mode 100644 index 53bd7b2..0000000 --- a/dist/assets/img/github.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/globe.svg b/dist/assets/img/globe.svg deleted file mode 100644 index 93b6178..0000000 --- a/dist/assets/img/globe.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/hackernews.svg b/dist/assets/img/hackernews.svg deleted file mode 100644 index 0de37e6..0000000 --- a/dist/assets/img/hackernews.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/key.svg b/dist/assets/img/key.svg deleted file mode 100644 index e0bd494..0000000 --- a/dist/assets/img/key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/mastodon.svg b/dist/assets/img/mastodon.svg deleted file mode 100644 index bb7c428..0000000 --- a/dist/assets/img/mastodon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/img/reddit.svg b/dist/assets/img/reddit.svg deleted file mode 100644 index 262d0a7..0000000 --- a/dist/assets/img/reddit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/assets/js/proofs.js b/dist/assets/js/proofs.js deleted file mode 100644 index c39a5f0..0000000 --- a/dist/assets/js/proofs.js +++ /dev/null @@ -1,295 +0,0 @@ -(async function() { - function getVerifier(proofs, proofUrl, fingerprint) { - for (const proof of proofs) { - // check if the proof URI matches one of our known definitions - const matches = proofUrl.match(new RegExp(proof.matcher)); - if (!matches) continue; - - // get all variables that were matched from the URI - const bound = Object.entries(proof.variables) - .map(([key, value]) => [key, matches[value || 0]]) - .reduce((previous, current) => { - previous[current[0]] = current[1]; - return previous; - }, { FINGERPRINT: fingerprint }); - - // replacer function that will substitute variables in text - const replace = text => text.replace(/\{([A-Z]+)\}/g, (_, name) => bound[name]); - - // return description of what we matched including extracted data - return { - profile: [proof.profile, replace(proof.profile)], - proofUrl, - proofJson: [proof.proof, replace(proof.proof)], - username: [proof.username, replace(proof.username)], - service: proof.service, - checks: (proof.checks || []).map(check => ({ - relation: check.relation, - proof: check.proof, - claim: check.claim.replace(/\{([A-Z]+)\}/g, (_, name) => bound[name]) - })), - matcher: proof.matcher, - variables: Object.entries(proof.variables).map(entry => (entry[2] = matches[entry[1]], entry)) - }; - } - // no match - return null; - } - - const email = location.href.split('/').pop(); - const keyUrl = "/vks/v1/by-email/" + email; - const response = await fetch(keyUrl); - const armor = await response.text(); - const key = (await openpgp.key.readArmored(armor)).keys[0]; - - // add fingerprint header - const fingerprint = key.primaryKey.getFingerprint(); - - const fprLink = document.querySelector('.fpr'); - fprLink.href = keyUrl; - fprLink.firstElementChild.textContent = fingerprint; - - // verify primary user to use in the profile name - const primaryUser = await key.getPrimaryUser(); - - if (!await primaryUser.user.verify(key.primaryKey)) { - throw new Error('Primary user is not valid.'); - } - - document.title = primaryUser.user.userId.name + ' — ' + document.title; - const name = primaryUser.user.userId.name; - document.querySelector('.name').textContent = name; - - // grab avatar from MD5 of primary user's e-mail address - const util = openpgp.util; - const digest = await openpgp.crypto.hash.md5(util.str_to_Uint8Array(email)); - const profileHash = util.str_to_hex(util.Uint8Array_to_str(digest)); - - document.querySelector('.avatar').src = `https://www.gravatar.com/avatar/${profileHash}?s=148&d=mm`; - - // we support reading proof URIs from these notations - const supportedNotations = ['proof@metacode.biz', 'proof@keys.openpgp.org']; - const proofDefinitions = (await (await fetch('/assets/proofs.json')).json()).proofs; - - // proof URLs are gathered from all UIDs and sorted by insertion order - const proofUrls = new Set(); - const emails = new Set([email]); - - for (const user of key.users) { - // if verification fails for the User ID still continue with others - try { - const valid = await user.verify(key.primaryKey); - // validate the User ID to avoid issues like: - // https://bitbucket.org/skskeyserver/sks-keyserver/issues/41 - if (valid) { - // get latest self-certification - const cert = user.selfCertifications.reduce((a, b) => a.created > b.created ? a : b); - (cert.notations || []) - // filter out non-supported notations - .filter(notation => supportedNotations.includes(notation[0]) && typeof notation[1] === 'string') - // select only values (proof URIs) - .map(notation => notation[1]) - .forEach(proofUrls.add.bind(proofUrls)); - - // add proof links from User Attributes too - // this won't work on Hagrid as Hagrid never exposes User Attributes currently (2020-07-09) - // but would work on a custom page - if (user.userAttribute && user.userAttribute.attributes[0][0] === 'e') { - proofUrls.add(user.userAttribute.attributes[0].substring(user.userAttribute.attributes[0].indexOf('@') + 1)); - } - if (user.userId && user.userId.email) { - emails.add(user.userId.email); - } - } - } catch (e) { - console.error('User verification error:', e); - } - } - - // add e-mails to the UI - function addEmail(email) { - const li = document.createElement('li'); - const keyLink = document.createElement('a'); - keyLink.href = 'mailto:' + email; - keyLink.textContent = email; - keyLink.className = 'email'; - li.appendChild(keyLink); - return li; - } - - for (const email of emails) { - document.querySelector('.info').appendChild(addEmail(email)); - } - - // get text to be rendered, this could be improved by using