X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fstatic.ts;h=b21f9da004ea87b63dee0fb2d11af60796f5f0d7;hb=09979f8959425390b879bce22101a9bc061ae9a0;hp=baafe1ac45b45d256bfc8c0e4adcf5135d51401c;hpb=aac0118dc3a563f4923426ec580a8491874922f4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/static.ts b/server/controllers/static.ts index baafe1ac4..b21f9da00 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -1,6 +1,6 @@ import * as cors from 'cors' import * as express from 'express' -import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' +import { CONFIG, HLS_PLAYLIST_DIRECTORY, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' import { VideosPreviewCache } from '../lib/cache' import { cacheRoute } from '../middlewares/cache' import { asyncMiddleware, videosGetValidator } from '../middlewares' @@ -34,18 +34,30 @@ staticRouter.use( ) // Videos path for webseeding -const videosPhysicalPath = CONFIG.STORAGE.VIDEOS_DIR staticRouter.use( STATIC_PATHS.WEBSEED, cors(), - express.static(videosPhysicalPath) + express.static(CONFIG.STORAGE.VIDEOS_DIR, { fallthrough: false }) // 404 because we don't have this video ) +staticRouter.use( + STATIC_PATHS.REDUNDANCY, + cors(), + express.static(CONFIG.STORAGE.REDUNDANCY_DIR, { fallthrough: false }) // 404 because we don't have this video +) + staticRouter.use( STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', asyncMiddleware(videosGetValidator), asyncMiddleware(downloadVideoFile) ) +// HLS +staticRouter.use( + STATIC_PATHS.PLAYLISTS.HLS, + cors(), + express.static(HLS_PLAYLIST_DIRECTORY, { fallthrough: false }) // 404 if the file does not exist +) + // Thumbnails path for express const thumbnailsPhysicalPath = CONFIG.STORAGE.THUMBNAILS_DIR staticRouter.use( @@ -120,7 +132,7 @@ staticRouter.use('/.well-known/dnt-policy.txt', (_, res: express.Response) => { res.type('text/plain') - return res.sendFile(join(root(), 'server/static/dnt-policy/dnt-policy-1.0.txt')) + return res.sendFile(join(root(), 'dist/server/static/dnt-policy/dnt-policy-1.0.txt')) } ) @@ -131,6 +143,12 @@ staticRouter.use('/.well-known/dnt/', } ) +staticRouter.use('/.well-known/change-password', + (_, res: express.Response) => { + res.redirect('/my-account/settings') + } +) + // --------------------------------------------------------------------------- export {