- } 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(404)
- }
-
- return res.send(json).end()
-}
-
-function downloadTorrent (req: express.Request, res: express.Response) {
- const video = res.locals.videoAll
-
- const videoFile = getVideoFile(req, video.VideoFiles)
- if (!videoFile) return res.status(404).end()
-
- return res.download(getTorrentFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p.torrent`)
-}
-
-function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) {
- const video = res.locals.videoAll
-
- const playlist = getHLSPlaylist(video)
- if (!playlist) return res.status(404).end
-
- const videoFile = getVideoFile(req, playlist.VideoFiles)
- if (!videoFile) return res.status(404).end()
-
- return res.download(getTorrentFilePath(playlist, videoFile), `${video.name}-${videoFile.resolution}p-hls.torrent`)
-}
-
-function downloadVideoFile (req: express.Request, res: express.Response) {
- const video = res.locals.videoAll
-
- const videoFile = getVideoFile(req, video.VideoFiles)
- if (!videoFile) return res.status(404).end()
-
- return res.download(getVideoFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`)
-}
-
-function downloadHLSVideoFile (req: express.Request, res: express.Response) {
- const video = res.locals.videoAll
- const playlist = getHLSPlaylist(video)
- if (!playlist) return res.status(404).end
-
- const videoFile = getVideoFile(req, playlist.VideoFiles)
- if (!videoFile) return res.status(404).end()
-
- const filename = `${video.name}-${videoFile.resolution}p-${playlist.getStringType()}${videoFile.extname}`
- return res.download(getVideoFilePath(playlist, videoFile), filename)
-}