diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-09 14:05:21 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-09 14:09:24 +0100 |
commit | 650580504cf14a87bd4025eec9673eb5642dc71d (patch) | |
tree | ae5dce55a9cbe8c392db4668bb599c74a17b241d /server/controllers/api | |
parent | a554bc1a260a525cd635d62404b9fe76fdb9e36b (diff) | |
download | PeerTube-650580504cf14a87bd4025eec9673eb5642dc71d.tar.gz PeerTube-650580504cf14a87bd4025eec9673eb5642dc71d.tar.zst PeerTube-650580504cf14a87bd4025eec9673eb5642dc71d.zip |
Add filter:api.server.stats.get.result hook
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/server/stats.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/controllers/api/server/stats.ts b/server/controllers/api/server/stats.ts index d661144ca..2ab398f4d 100644 --- a/server/controllers/api/server/stats.ts +++ b/server/controllers/api/server/stats.ts | |||
@@ -3,6 +3,7 @@ import { StatsManager } from '@server/lib/stat-manager' | |||
3 | import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' | 3 | import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' |
4 | import { asyncMiddleware } from '../../../middlewares' | 4 | import { asyncMiddleware } from '../../../middlewares' |
5 | import { cacheRoute } from '../../../middlewares/cache/cache' | 5 | import { cacheRoute } from '../../../middlewares/cache/cache' |
6 | import { Hooks } from '@server/lib/plugins/hooks' | ||
6 | 7 | ||
7 | const statsRouter = express.Router() | 8 | const statsRouter = express.Router() |
8 | 9 | ||
@@ -12,7 +13,8 @@ statsRouter.get('/stats', | |||
12 | ) | 13 | ) |
13 | 14 | ||
14 | async function getStats (_req: express.Request, res: express.Response) { | 15 | async function getStats (_req: express.Request, res: express.Response) { |
15 | const data = await StatsManager.Instance.getStats() | 16 | let data = await StatsManager.Instance.getStats() |
17 | data = await Hooks.wrapObject(data, 'filter:api.server.stats.get.result') | ||
16 | 18 | ||
17 | return res.json(data) | 19 | return res.json(data) |
18 | } | 20 | } |