Fix QR code

This commit is contained in:
Yarmo Mackenbach 2021-03-31 15:11:12 +02:00
parent c5014e5e73
commit d2aa3f0c0f
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
3 changed files with 15 additions and 2 deletions

View file

@ -262,6 +262,7 @@ async function displayProfile(opts) {
// Generate output for each claim // Generate output for each claim
claims.forEach((claim, i) => { claims.forEach((claim, i) => {
console.log(claim);
const claimData = claim.serviceproviderData; const claimData = claim.serviceproviderData;
if (!claimData.serviceprovider.name) { if (!claimData.serviceprovider.name) {
return; return;
@ -278,6 +279,13 @@ async function displayProfile(opts) {
<span>${capitalizeLetteredServices(claimData.serviceprovider.name)}</span> <span>${capitalizeLetteredServices(claimData.serviceprovider.name)}</span>
<a href="${claimData.profile.uri}">View&nbsp;account</a> <a href="${claimData.profile.uri}">View&nbsp;account</a>
<a href="${claimData.proof.uri}">View&nbsp;proof</a> <a href="${claimData.proof.uri}">View&nbsp;proof</a>
`;
if (claimData.profile.qr) {
output += `
<a href="/util/qr/${encodeURIComponent(claimData.profile.qr)}">View&nbsp;QR</a>
`;
}
output += `
<button onClick="document.querySelector('#dialog--${dialogIds[i]}').showModal();">Details</button> <button onClick="document.querySelector('#dialog--${dialogIds[i]}').showModal();">Details</button>
</p> </p>
</div> </div>
@ -350,7 +358,6 @@ async function displayProfile(opts) {
/// MAIN /// MAIN
// Init variables // Init variables
let keyData, keyLink, sigVerification, sigKeyUri, fingerprint, feedback = "", verifications = []; let keyData, keyLink, sigVerification, sigKeyUri, fingerprint, feedback = "", verifications = [];
let icon_qr = '<svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="#ffffff" d="M3,11H5V13H3V11M11,5H13V9H11V5M9,11H13V15H11V13H9V11M15,11H17V13H19V11H21V13H19V15H21V19H19V21H17V19H13V21H11V17H15V15H17V13H15V11M19,19V15H17V19H19M15,3H21V9H15V3M17,5V7H19V5H17M3,3H9V9H3V3M5,5V7H7V5H5M3,15H9V21H3V15M5,17V19H7V17H5Z" /></svg>';
const doipOpts = { const doipOpts = {
proxyPolicy: 'adaptive', proxyPolicy: 'adaptive',

View file

@ -531,3 +531,8 @@ dialog p {
dialog p:first-of-type { dialog p:first-of-type {
margin-top: 0; margin-top: 0;
} }
#qrcode {
display: block;
margin: 0 auto 16px;
}

View file

@ -8,6 +8,7 @@ block content
section.narrow section.narrow
h1 QR Code h1 QR Code
form#form-util-qr(method='post') form#form-util-qr(method='post')
pre
code#input.full-width !{input} code#input.full-width !{input}
canvas#qrcode canvas#qrcode
a#qrcode--altLink(href='#') Press this link to directly open the URI a#qrcode--altLink(href='#') Press this link to directly open the URI