forked from Mirrors/keyoxide-web
fix: move version endpoint
This commit is contained in:
parent
6950170cc9
commit
e52d965d02
2 changed files with 14 additions and 14 deletions
|
@ -30,23 +30,9 @@ more information on this, and how to apply and follow the GNU AGPL, see <https:/
|
|||
import express from 'express'
|
||||
import keyoxideProfileApiRouter from './keyoxide_profile.js'
|
||||
import proxyGetApiRouter from './proxy_get.js'
|
||||
import app from '../../index.js'
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
router.get('/version', async (req, res) => {
|
||||
// TODO Support responding with JSON object when requested
|
||||
|
||||
let versionDetails = app.get('git_branch')
|
||||
? `+${app.get('git_branch')}`
|
||||
: ''
|
||||
versionDetails += (app.get('git_branch') && app.get('git_hash'))
|
||||
? `.${app.get('git_hash').substring(0, 10)}`
|
||||
: ''
|
||||
|
||||
return res.status(200).contentType('text/plain').send(`${app.get('keyoxide_name')}/${app.get('keyoxide_version')}${versionDetails}`)
|
||||
})
|
||||
|
||||
if ((process.env.ENABLE_MAIN_MODULE ?? 'true') === 'true') {
|
||||
router.use('/profile', keyoxideProfileApiRouter)
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import express from 'express'
|
|||
import markdownImport from 'markdown-it'
|
||||
import { readFileSync } from 'fs'
|
||||
import { getMetaFromReq } from '../server/utils.js'
|
||||
import app from '../index.js'
|
||||
|
||||
const router = express.Router()
|
||||
const md = markdownImport({ typographer: true })
|
||||
|
@ -79,6 +80,19 @@ router.get('/.well-known/webfinger', (req, res) => {
|
|||
res.json(body)
|
||||
})
|
||||
|
||||
router.get('/.well-known/keyoxide/version', async (req, res) => {
|
||||
// TODO Support responding with JSON object when requested
|
||||
|
||||
let versionDetails = app.get('git_branch')
|
||||
? `+${app.get('git_branch')}`
|
||||
: ''
|
||||
versionDetails += (app.get('git_branch') && app.get('git_hash'))
|
||||
? `.${app.get('git_hash').substring(0, 10)}`
|
||||
: ''
|
||||
|
||||
return res.status(200).contentType('text/plain').send(`${app.get('keyoxide_name')}/${app.get('keyoxide_version')}${versionDetails}`)
|
||||
})
|
||||
|
||||
router.get('/users/keyoxide', (req, res) => {
|
||||
if (!(process.env.DOMAIN && process.env.ACTIVITYPUB_PUBLIC_KEY)) {
|
||||
res.status(404).send('<body><pre>Cannot GET /keyoxide</pre></body>')
|
||||
|
|
Loading…
Reference in a new issue