]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/static.ts
draft "security.txt" spec integration (#1020)
[github/Chocobozzz/PeerTube.git] / server / controllers / static.ts
index df31c313455149b0345a71862bf98d89672709bf..63f78b3b3e11799bdbebe1a57467ac1975aa3081 100644 (file)
@@ -79,6 +79,21 @@ staticRouter.get('/robots.txt',
   }
 )
 
+// security.txt service
+staticRouter.get('/security.txt',
+  (_, res: express.Response) => {
+    return res.redirect(301, '/.well-known/security.txt')
+  }
+)
+
+staticRouter.get('/.well-known/security.txt',
+  asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.SECURITYTXT)),
+  (_, res: express.Response) => {
+    res.type('text/plain')
+    return res.send(CONFIG.INSTANCE.SECURITYTXT + CONFIG.INSTANCE.SECURITYTXT_CONTACT)
+  }
+)
+
 // nodeinfo service
 staticRouter.use('/.well-known/nodeinfo',
   asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)),