diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-04 16:14:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-04 16:18:01 +0100 |
commit | 2c8776fc316da9719e5ebc55dfabdcac9e197ac4 (patch) | |
tree | b8e8365092437ee69f2ef88d0e9d858fae15ec45 /server/controllers/api | |
parent | 943e5193905908dd1f2800d8810c635d86e3b28f (diff) | |
download | PeerTube-2c8776fc316da9719e5ebc55dfabdcac9e197ac4.tar.gz PeerTube-2c8776fc316da9719e5ebc55dfabdcac9e197ac4.tar.zst PeerTube-2c8776fc316da9719e5ebc55dfabdcac9e197ac4.zip |
Optimize view endpoint
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/videos/index.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 1d61f8427..eb46ea01f 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -135,7 +135,7 @@ videosRouter.get('/:id', | |||
135 | asyncMiddleware(getVideo) | 135 | asyncMiddleware(getVideo) |
136 | ) | 136 | ) |
137 | videosRouter.post('/:id/views', | 137 | videosRouter.post('/:id/views', |
138 | asyncMiddleware(videosGetValidator), | 138 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), |
139 | asyncMiddleware(viewVideo) | 139 | asyncMiddleware(viewVideo) |
140 | ) | 140 | ) |
141 | 141 | ||
@@ -458,7 +458,7 @@ async function getVideo (req: express.Request, res: express.Response) { | |||
458 | } | 458 | } |
459 | 459 | ||
460 | async function viewVideo (req: express.Request, res: express.Response) { | 460 | async function viewVideo (req: express.Request, res: express.Response) { |
461 | const videoInstance = res.locals.videoAll | 461 | const videoInstance = res.locals.onlyImmutableVideo |
462 | 462 | ||
463 | const ip = req.ip | 463 | const ip = req.ip |
464 | const exists = await Redis.Instance.doesVideoIPViewExist(ip, videoInstance.uuid) | 464 | const exists = await Redis.Instance.doesVideoIPViewExist(ip, videoInstance.uuid) |