]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/static.ts
Refactor AP playlists
[github/Chocobozzz/PeerTube.git] / server / controllers / static.ts
index 3870ebfe9bd942e2b41dc8c5d0e3446e204b1071..52e10434683f30089fc31b42d8ff9d56e5c83d0f 100644 (file)
@@ -160,10 +160,9 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
   const { totalVideos } = await VideoModel.getStats()
   const { totalLocalVideoComments } = await VideoCommentModel.getStats()
   const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
-  let json = {}
 
   if (req.params.version && (req.params.version === '2.0')) {
-    json = {
+    const json = {
       version: '2.0',
       software: {
         name: 'peertube',
@@ -291,12 +290,14 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
       }
     } as HttpNodeinfoDiasporaSoftwareNsSchema20
     res.contentType('application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"')
-  } else {
-    json = { error: 'Nodeinfo schema version not handled' }
-    res.status(HttpStatusCode.NOT_FOUND_404)
+       .send(json)
+       .end()
   }
 
-  return res.send(json).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) {