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 data = await generateSignatureProfile(req.body.signature)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/wkd/:id', async (req, res) => {
const data = await generateWKDProfile(req.params.id) const data = await generateWKDProfile(req.params.id)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/hkp/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id) const data = await generateHKPProfile(req.params.id)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/hkp/:server/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id, req.params.server) const data = await generateHKPProfile(req.params.id, req.params.server)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/keybase/:username/:fingerprint', async (req, res) => {
const data = await generateKeybaseProfile(req.params.username, req.params.fingerprint) const data = await generateKeybaseProfile(req.params.username, req.params.fingerprint)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/:id', async (req, res) => {
const data = await generateAutoProfile(req.params.id) const data = await generateAutoProfile(req.params.id)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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 export default router

View file

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