X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fstatic.ts;h=a6b46244379bcfc0af5b490d0fbb63e07540c75d;hb=e0ce715a1ded6e84c877004dae3e354c8716fb06;hp=d75b95f5231014dae4ecf6e7c6ff4b168bec3071;hpb=e8bafea35bc930cb8ac5b2d521a188642a1adffe;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/static.ts b/server/controllers/static.ts index d75b95f52..a6b462443 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -156,6 +156,19 @@ staticRouter.use('/.well-known/change-password', } ) +staticRouter.use('/.well-known/host-meta', + (_, res: express.Response) => { + res.type('application/xml') + + const xml = '\n' + + '\n' + + ` \n` + + '' + + res.send(xml).end() + } +) + // --------------------------------------------------------------------------- export { @@ -165,23 +178,23 @@ export { // --------------------------------------------------------------------------- async function getPreview (req: express.Request, res: express.Response) { - const path = await VideosPreviewCache.Instance.getFilePath(req.params.uuid) - if (!path) return res.sendStatus(404) + const result = await VideosPreviewCache.Instance.getFilePath(req.params.uuid) + if (!result) return res.sendStatus(404) - return res.sendFile(path, { maxAge: STATIC_MAX_AGE }) + return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE }) } async function getVideoCaption (req: express.Request, res: express.Response) { - const path = await VideosCaptionCache.Instance.getFilePath({ + const result = await VideosCaptionCache.Instance.getFilePath({ videoId: req.params.videoId, language: req.params.captionLanguage }) - if (!path) return res.sendStatus(404) + if (!result) return res.sendStatus(404) - return res.sendFile(path, { maxAge: STATIC_MAX_AGE }) + return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE }) } -async function generateNodeinfo (req: express.Request, res: express.Response, next: express.NextFunction) { +async function generateNodeinfo (req: express.Request, res: express.Response) { const { totalVideos } = await VideoModel.getStats() const { totalLocalVideoComments } = await VideoCommentModel.getStats() const { totalUsers } = await UserModel.getStats()