mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
feat: display version
This commit is contained in:
parent
aeee377ea3
commit
8eb90beda2
5 changed files with 46 additions and 23 deletions
|
@ -30,6 +30,7 @@ more information on this, and how to apply and follow the GNU AGPL, see <https:/
|
|||
import express from 'express'
|
||||
import markdownImport from 'markdown-it'
|
||||
import { readFileSync } from 'fs'
|
||||
import { getMetaFromReq } from '../server/utils.js'
|
||||
|
||||
const router = express.Router()
|
||||
const md = markdownImport({ typographer: true })
|
||||
|
@ -47,13 +48,13 @@ router.get('/', (req, res) => {
|
|||
}
|
||||
}
|
||||
|
||||
res.render('index', { highlights })
|
||||
res.render('index', { highlights, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/privacy', (req, res) => {
|
||||
const rawContent = readFileSync('./content/privacy-policy.md', 'utf8')
|
||||
const content = md.render(rawContent)
|
||||
res.render('article', { title: 'Privacy policy', content })
|
||||
res.render('article', { title: 'Privacy policy', content, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/.well-known/webfinger', (req, res) => {
|
||||
|
|
|
@ -31,12 +31,13 @@ import express from 'express'
|
|||
import bodyParserImport from 'body-parser'
|
||||
import { generateSignatureProfile, utils, generateWKDProfile, generateHKPProfile, generateAutoProfile, generateKeybaseProfile } from '../server/index.js'
|
||||
import { Profile } from 'doipjs'
|
||||
import { getMetaFromReq } from '../server/utils.js'
|
||||
|
||||
const router = express.Router()
|
||||
const bodyParser = bodyParserImport.urlencoded({ extended: false })
|
||||
|
||||
router.get('/sig', (req, res) => {
|
||||
res.render('profile', { isSignature: true, signature: null })
|
||||
res.render('profile', { isSignature: true, signature: null, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.post('/sig', bodyParser, async (req, res) => {
|
||||
|
@ -49,7 +50,8 @@ router.post('/sig', bodyParser, async (req, res) => {
|
|||
isSignature: true,
|
||||
signature: req.body.signature,
|
||||
enable_message_encryption: false,
|
||||
enable_signature_verification: false
|
||||
enable_signature_verification: false,
|
||||
meta: getMetaFromReq(req)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -61,7 +63,8 @@ router.get('/wkd/:id', async (req, res) => {
|
|||
title,
|
||||
data: data instanceof Profile ? data.toJSON() : data,
|
||||
enable_message_encryption: false,
|
||||
enable_signature_verification: false
|
||||
enable_signature_verification: false,
|
||||
meta: getMetaFromReq(req)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -73,7 +76,8 @@ router.get('/hkp/:id', async (req, res) => {
|
|||
title,
|
||||
data: data instanceof Profile ? data.toJSON() : data,
|
||||
enable_message_encryption: false,
|
||||
enable_signature_verification: false
|
||||
enable_signature_verification: false,
|
||||
meta: getMetaFromReq(req)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -85,7 +89,8 @@ router.get('/hkp/:server/:id', async (req, res) => {
|
|||
title,
|
||||
data: data instanceof Profile ? data.toJSON() : data,
|
||||
enable_message_encryption: false,
|
||||
enable_signature_verification: false
|
||||
enable_signature_verification: false,
|
||||
meta: getMetaFromReq(req)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -97,7 +102,8 @@ router.get('/keybase/:username/:fingerprint', async (req, res) => {
|
|||
title,
|
||||
data: data instanceof Profile ? data.toJSON() : data,
|
||||
enable_message_encryption: false,
|
||||
enable_signature_verification: false
|
||||
enable_signature_verification: false,
|
||||
meta: getMetaFromReq(req)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -109,7 +115,8 @@ router.get('/:id', async (req, res) => {
|
|||
title,
|
||||
data: data instanceof Profile ? data.toJSON() : data,
|
||||
enable_message_encryption: false,
|
||||
enable_signature_verification: false
|
||||
enable_signature_verification: false,
|
||||
meta: getMetaFromReq(req)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -28,52 +28,53 @@ if any, to sign a "copyright disclaimer" for the program, if necessary. For
|
|||
more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import express from 'express'
|
||||
import { getMetaFromReq } from '../server/utils.js'
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
router.get('/', function (req, res) {
|
||||
res.render('util/index')
|
||||
res.render('util/index', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/profile-url', function (req, res) {
|
||||
res.render('util/profile-url')
|
||||
res.render('util/profile-url', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/profile-url/:input', function (req, res) {
|
||||
res.render('util/profile-url', { input: req.params.input })
|
||||
res.render('util/profile-url', { input: req.params.input, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/qr', function (req, res) {
|
||||
res.render('util/qr')
|
||||
res.render('util/qr', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/qr/:input', function (req, res) {
|
||||
res.render('util/qr', { input: req.params.input })
|
||||
res.render('util/qr', { input: req.params.input, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/qrfp', function (req, res) {
|
||||
res.render('util/qrfp')
|
||||
res.render('util/qrfp', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/qrfp/:input', function (req, res) {
|
||||
res.render('util/qrfp', { input: req.params.input })
|
||||
res.render('util/qrfp', { input: req.params.input, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/wkd', function (req, res) {
|
||||
res.render('util/wkd')
|
||||
res.render('util/wkd', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/wkd/:input', function (req, res) {
|
||||
res.render('util/wkd', { input: req.params.input })
|
||||
res.render('util/wkd', { input: req.params.input, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/argon2', function (req, res) {
|
||||
res.render('util/argon2')
|
||||
res.render('util/argon2', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/argon2/:input', function (req, res) {
|
||||
res.render('util/argon2', { input: req.params.input })
|
||||
res.render('util/argon2', { input: req.params.input, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
router.get('/bcrypt', function (req, res) {
|
||||
res.render('util/bcrypt')
|
||||
res.render('util/bcrypt', { meta: getMetaFromReq(req) })
|
||||
})
|
||||
router.get('/bcrypt/:input', function (req, res) {
|
||||
res.render('util/bcrypt', { input: req.params.input })
|
||||
res.render('util/bcrypt', { input: req.params.input, meta: getMetaFromReq(req) })
|
||||
})
|
||||
|
||||
export default router
|
||||
|
|
|
@ -78,3 +78,12 @@ export function encodeZBase32 (data) {
|
|||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function getMetaFromReq (req) {
|
||||
return {
|
||||
env: req.app.get('env'),
|
||||
keyoxide: {
|
||||
version: req.app.get('keyoxide_version')
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,4 +27,9 @@ footer
|
|||
br
|
||||
a(href="https://ariadne.id") ariadne.id
|
||||
|
||||
p.copyright © 2022 Keyoxide project contributors
|
||||
p.copyright
|
||||
| Version #{meta.keyoxide.version}
|
||||
if (meta.env === "development")
|
||||
| -dev
|
||||
br
|
||||
| © 2023 Keyoxide project contributors
|
Loading…
Reference in a new issue