diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-11 11:52:24 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-16 20:29:26 +0100 |
commit | 6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b (patch) | |
tree | 22397531c03da92be50e28703764405002acb926 /server.js | |
parent | 830bcd0f82c16b8b5f1259150a6d541a210693eb (diff) | |
download | PeerTube-6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b.tar.gz PeerTube-6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b.tar.zst PeerTube-6a94a109b4b89a97fe7bfeded3125fb7aad2ac3b.zip |
Server: add video preview
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -71,7 +71,8 @@ const apiRoute = '/api/' + constants.API_VERSION | |||
71 | app.use(apiRoute, routes.api) | 71 | app.use(apiRoute, routes.api) |
72 | app.use('/', routes.client) | 72 | app.use('/', routes.client) |
73 | 73 | ||
74 | // Static files | 74 | // Static client files |
75 | // TODO: move in client | ||
75 | app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE })) | 76 | app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE })) |
76 | // 404 for static files not found | 77 | // 404 for static files not found |
77 | app.use('/client/*', function (req, res, next) { | 78 | app.use('/client/*', function (req, res, next) { |
@@ -89,6 +90,10 @@ app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPat | |||
89 | const thumbnailsPhysicalPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR | 90 | const thumbnailsPhysicalPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR |
90 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | 91 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) |
91 | 92 | ||
93 | // Video previews path for express | ||
94 | const previewsPhysicalPath = constants.CONFIG.STORAGE.PREVIEWS_DIR | ||
95 | app.use(constants.STATIC_PATHS.PREVIEWS, express.static(previewsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | ||
96 | |||
92 | // Always serve index client page | 97 | // Always serve index client page |
93 | app.use('/*', function (req, res, next) { | 98 | app.use('/*', function (req, res, next) { |
94 | res.sendFile(path.join(__dirname, './client/dist/index.html')) | 99 | res.sendFile(path.join(__dirname, './client/dist/index.html')) |