feat: Make ENCRYPT and VERIFY buttons optional

For now, these functions will be hardcoded off until a decent opt-in solution is found.
This commit is contained in:
Yarmo Mackenbach 2023-03-01 18:20:45 +01:00
parent d5fb80cf2c
commit dfc28173a5
2 changed files with 71 additions and 33 deletions

View file

@ -42,42 +42,74 @@ router.post('/sig', bodyParser, async (req, res) => {
const data = await generateSignatureProfile(req.body.signature)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data, isSignature: true, signature: req.body.signature })
res.render('profile', {
title,
data,
isSignature: true,
signature: req.body.signature,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/wkd/:id', async (req, res) => {
const data = await generateWKDProfile(req.params.id)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/hkp/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/hkp/:server/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id, req.params.server)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/keybase/:username/:fingerprint', async (req, res) => {
const data = await generateKeybaseProfile(req.params.username, req.params.fingerprint)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/:id', async (req, res) => {
const data = await generateAutoProfile(req.params.id)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
export default router

View file

@ -62,6 +62,7 @@ block content
noscript
p Keyoxide requires JavaScript to function.
if (enable_message_encryption)
dialog#dialog--encryptMessage
div
form(method='post')
@ -75,6 +76,7 @@ block content
form(method="dialog")
input(type="submit" value="Close")
if (enable_signature_verification)
dialog#dialog--verifySignature
div
form(method='post')
@ -109,8 +111,12 @@ block content
img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar")
p#profileName.p-name= data.keyData.users[data.keyData.primaryUserIndex].userData.name
if (enable_message_encryption || enable_signature_verification)
.button-wrapper
if (enable_message_encryption)
button(onClick="document.querySelector('#dialog--encryptMessage').showModal();") Encrypt message
if (enable_signature_verification)
button(onClick="document.querySelector('#dialog--verifySignature').showModal();") Verify signature
#profileProofs.card.card--transparent