staticRouter.use(
STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+).torrent',
asyncMiddleware(videosDownloadValidator),
- asyncMiddleware(downloadTorrent)
+ downloadTorrent
)
staticRouter.use(
STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+)-hls.torrent',
asyncMiddleware(videosDownloadValidator),
- asyncMiddleware(downloadHLSVideoFileTorrent)
+ downloadHLSVideoFileTorrent
)
// Videos path for webseeding
staticRouter.use(
STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension',
asyncMiddleware(videosDownloadValidator),
- asyncMiddleware(downloadVideoFile)
+ downloadVideoFile
)
staticRouter.use(
STATIC_DOWNLOAD_PATHS.HLS_VIDEOS + ':id-:resolution([0-9]+)-fragmented.:extension',
asyncMiddleware(videosDownloadValidator),
- asyncMiddleware(downloadHLSVideoFile)
+ downloadHLSVideoFile
)
// HLS
// robots.txt service
staticRouter.get('/robots.txt',
- asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS)),
+ asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.ROBOTS)),
(_, res: express.Response) => {
res.type('text/plain')
return res.send(CONFIG.INSTANCE.ROBOTS)
)
staticRouter.get('/.well-known/security.txt',
- asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.SECURITYTXT)),
+ 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)),
+ asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.NODEINFO)),
(_, res: express.Response) => {
return res.json({
links: [
}
)
staticRouter.use('/nodeinfo/:version.json',
- asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)),
+ asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.NODEINFO)),
asyncMiddleware(generateNodeinfo)
)
// dnt-policy.txt service (see https://www.eff.org/dnt-policy)
staticRouter.use('/.well-known/dnt-policy.txt',
- asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)),
+ asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.DNT_POLICY)),
(_, res: express.Response) => {
res.type('text/plain')
return res.send(json).end()
}
-async function downloadTorrent (req: express.Request, res: express.Response) {
+function downloadTorrent (req: express.Request, res: express.Response) {
const video = res.locals.videoAll
const videoFile = getVideoFile(req, video.VideoFiles)
return res.download(getTorrentFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p.torrent`)
}
-async function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) {
+function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) {
const video = res.locals.videoAll
const playlist = getHLSPlaylist(video)
return res.download(getTorrentFilePath(playlist, videoFile), `${video.name}-${videoFile.resolution}p-hls.torrent`)
}
-async function downloadVideoFile (req: express.Request, res: express.Response) {
+function downloadVideoFile (req: express.Request, res: express.Response) {
const video = res.locals.videoAll
const videoFile = getVideoFile(req, video.VideoFiles)
return res.download(getVideoFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`)
}
-async function downloadHLSVideoFile (req: express.Request, res: express.Response) {
+function downloadHLSVideoFile (req: express.Request, res: express.Response) {
const video = res.locals.videoAll
const playlist = getHLSPlaylist(video)
if (!playlist) return res.status(404).end