]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/controllers/static.js
3 const express
= require('express')
4 const cors
= require('cors')
6 const constants
= require('../initializers/constants')
8 const router
= express
.Router()
11 Cors is very important to let other pods access torrent and video files
14 const torrentsPhysicalPath
= constants
.CONFIG
.STORAGE
.TORRENTS_DIR
16 constants
.STATIC_PATHS
.TORRENTS
,
18 express
.static(torrentsPhysicalPath
, { maxAge: constants
.STATIC_MAX_AGE
})
21 // Videos path for webseeding
22 const videosPhysicalPath
= constants
.CONFIG
.STORAGE
.VIDEOS_DIR
24 constants
.STATIC_PATHS
.WEBSEED
,
26 express
.static(videosPhysicalPath
, { maxAge: constants
.STATIC_MAX_AGE
})
29 // Thumbnails path for express
30 const thumbnailsPhysicalPath
= constants
.CONFIG
.STORAGE
.THUMBNAILS_DIR
32 constants
.STATIC_PATHS
.THUMBNAILS
,
33 express
.static(thumbnailsPhysicalPath
, { maxAge: constants
.STATIC_MAX_AGE
})
36 // Video previews path for express
37 const previewsPhysicalPath
= constants
.CONFIG
.STORAGE
.PREVIEWS_DIR
39 constants
.STATIC_PATHS
.PREVIEWS
,
40 express
.static(previewsPhysicalPath
, { maxAge: constants
.STATIC_MAX_AGE
})
43 // ---------------------------------------------------------------------------
45 module
.exports
= router