Fix nodeinfo endpoint
This commit is contained in:
parent
99cb53fd5a
commit
ec908b4a07
|
@ -161,7 +161,13 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
|
||||||
const { totalLocalVideoComments } = await VideoCommentModel.getStats()
|
const { totalLocalVideoComments } = await VideoCommentModel.getStats()
|
||||||
const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
|
const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
|
||||||
|
|
||||||
if (req.params.version && (req.params.version === '2.0')) {
|
if (!req.params.version || req.params.version !== '2.0') {
|
||||||
|
return res.fail({
|
||||||
|
status: HttpStatusCode.NOT_FOUND_404,
|
||||||
|
message: 'Nodeinfo schema version not handled'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const json = {
|
const json = {
|
||||||
version: '2.0',
|
version: '2.0',
|
||||||
software: {
|
software: {
|
||||||
|
@ -289,17 +295,12 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} as HttpNodeinfoDiasporaSoftwareNsSchema20
|
} as HttpNodeinfoDiasporaSoftwareNsSchema20
|
||||||
|
|
||||||
res.contentType('application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"')
|
res.contentType('application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"')
|
||||||
.send(json)
|
.send(json)
|
||||||
.end()
|
.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.fail({
|
|
||||||
status: HttpStatusCode.NOT_FOUND_404,
|
|
||||||
message: 'Nodeinfo schema version not handled'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCup (req: express.Request, res: express.Response, next: express.NextFunction) {
|
function getCup (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
res.status(HttpStatusCode.I_AM_A_TEAPOT_418)
|
res.status(HttpStatusCode.I_AM_A_TEAPOT_418)
|
||||||
res.setHeader('Accept-Additions', 'Non-Dairy;1,Sugar;1')
|
res.setHeader('Accept-Additions', 'Non-Dairy;1,Sugar;1')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user