aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/static.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-11 09:21:13 +0200
committerChocobozzz <me@florianbigard.com>2023-07-11 09:21:13 +0200
commit784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428 (patch)
tree29c46cfd6344065eb805680ed080cb05592ee1d4 /server/middlewares/validators/static.ts
parentc3030e944ad03c7fd7b5d668a2d88ff03e4cdf19 (diff)
downloadPeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.tar.gz
PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.tar.zst
PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.zip
Prefer web videos in favour of webtorrent
Diffstat (limited to 'server/middlewares/validators/static.ts')
-rw-r--r--server/middlewares/validators/static.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/validators/static.ts b/server/middlewares/validators/static.ts
index 36a94080c..86cc0a8d7 100644
--- a/server/middlewares/validators/static.ts
+++ b/server/middlewares/validators/static.ts
@@ -22,7 +22,7 @@ const staticFileTokenBypass = new LRUCache<string, LRUValue>({
22 ttl: LRU_CACHE.STATIC_VIDEO_FILES_RIGHTS_CHECK.TTL 22 ttl: LRU_CACHE.STATIC_VIDEO_FILES_RIGHTS_CHECK.TTL
23}) 23})
24 24
25const ensureCanAccessVideoPrivateWebTorrentFiles = [ 25const ensureCanAccessVideoPrivateWebVideoFiles = [
26 query('videoFileToken').optional().custom(exists), 26 query('videoFileToken').optional().custom(exists),
27 27
28 isValidVideoPasswordHeader(), 28 isValidVideoPasswordHeader(),
@@ -48,7 +48,7 @@ const ensureCanAccessVideoPrivateWebTorrentFiles = [
48 return res.sendStatus(HttpStatusCode.FORBIDDEN_403) 48 return res.sendStatus(HttpStatusCode.FORBIDDEN_403)
49 } 49 }
50 50
51 const result = await isWebTorrentAllowed(req, res) 51 const result = await isWebVideoAllowed(req, res)
52 52
53 staticFileTokenBypass.set(cacheKey, result) 53 staticFileTokenBypass.set(cacheKey, result)
54 54
@@ -122,13 +122,13 @@ const ensureCanAccessPrivateVideoHLSFiles = [
122] 122]
123 123
124export { 124export {
125 ensureCanAccessVideoPrivateWebTorrentFiles, 125 ensureCanAccessVideoPrivateWebVideoFiles,
126 ensureCanAccessPrivateVideoHLSFiles 126 ensureCanAccessPrivateVideoHLSFiles
127} 127}
128 128
129// --------------------------------------------------------------------------- 129// ---------------------------------------------------------------------------
130 130
131async function isWebTorrentAllowed (req: express.Request, res: express.Response) { 131async function isWebVideoAllowed (req: express.Request, res: express.Response) {
132 const filename = basename(req.path) 132 const filename = basename(req.path)
133 133
134 const file = await VideoFileModel.loadWithVideoByFilename(filename) 134 const file = await VideoFileModel.loadWithVideoByFilename(filename)