]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/static.ts
Refactor video playlist middlewares
[github/Chocobozzz/PeerTube.git] / server / controllers / static.ts
index f16a7d72bbd802aa0e1c1a7af8efa41876dc30d2..b21f9da004ea87b63dee0fb2d11af60796f5f0d7 100644 (file)
@@ -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'
@@ -37,12 +37,12 @@ staticRouter.use(
 staticRouter.use(
   STATIC_PATHS.WEBSEED,
   cors(),
-  express.static(CONFIG.STORAGE.VIDEOS_DIR)
+  express.static(CONFIG.STORAGE.VIDEOS_DIR, { fallthrough: false }) // 404 because we don't have this video
 )
 staticRouter.use(
-  STATIC_PATHS.WEBSEED,
+  STATIC_PATHS.REDUNDANCY,
   cors(),
-  express.static(CONFIG.STORAGE.REDUNDANCY_DIR, { fallthrough: false }) // 404, because we don't have this video
+  express.static(CONFIG.STORAGE.REDUNDANCY_DIR, { fallthrough: false }) // 404 because we don't have this video
 )
 
 staticRouter.use(
@@ -51,6 +51,13 @@ staticRouter.use(
   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(
@@ -136,6 +143,12 @@ staticRouter.use('/.well-known/dnt/',
   }
 )
 
+staticRouter.use('/.well-known/change-password',
+  (_, res: express.Response) => {
+    res.redirect('/my-account/settings')
+  }
+)
+
 // ---------------------------------------------------------------------------
 
 export {