aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 10:56:29 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 10:58:09 +0200
commit5d79474cc66383ecbfcef6366f63a34c3af21cbf (patch)
tree6b2cd85c25294ca04c94cbbcc90353d25e9cee06 /server/controllers
parent2b3f1919fda81c2781ceeb9071d426c184e1b21c (diff)
downloadPeerTube-5d79474cc66383ecbfcef6366f63a34c3af21cbf.tar.gz
PeerTube-5d79474cc66383ecbfcef6366f63a34c3af21cbf.tar.zst
PeerTube-5d79474cc66383ecbfcef6366f63a34c3af21cbf.zip
Add debug component to help admins to fix IP issues
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/server/debug.ts25
-rw-r--r--server/controllers/api/server/index.ts2
2 files changed, 27 insertions, 0 deletions
diff --git a/server/controllers/api/server/debug.ts b/server/controllers/api/server/debug.ts
new file mode 100644
index 000000000..4450038f6
--- /dev/null
+++ b/server/controllers/api/server/debug.ts
@@ -0,0 +1,25 @@
1import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users'
3import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
4
5const debugRouter = express.Router()
6
7debugRouter.get('/debug',
8 authenticate,
9 ensureUserHasRight(UserRight.MANAGE_DEBUG),
10 asyncMiddleware(getDebug)
11)
12
13// ---------------------------------------------------------------------------
14
15export {
16 debugRouter
17}
18
19// ---------------------------------------------------------------------------
20
21async function getDebug (req: express.Request, res: express.Response) {
22 return res.json({
23 ip: req.ip
24 }).end()
25}
diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts
index de09588df..6b8793a19 100644
--- a/server/controllers/api/server/index.ts
+++ b/server/controllers/api/server/index.ts
@@ -5,6 +5,7 @@ import { serverRedundancyRouter } from './redundancy'
5import { serverBlocklistRouter } from './server-blocklist' 5import { serverBlocklistRouter } from './server-blocklist'
6import { contactRouter } from './contact' 6import { contactRouter } from './contact'
7import { logsRouter } from './logs' 7import { logsRouter } from './logs'
8import { debugRouter } from './debug'
8 9
9const serverRouter = express.Router() 10const serverRouter = express.Router()
10 11
@@ -14,6 +15,7 @@ serverRouter.use('/', statsRouter)
14serverRouter.use('/', serverBlocklistRouter) 15serverRouter.use('/', serverBlocklistRouter)
15serverRouter.use('/', contactRouter) 16serverRouter.use('/', contactRouter)
16serverRouter.use('/', logsRouter) 17serverRouter.use('/', logsRouter)
18serverRouter.use('/', debugRouter)
17 19
18// --------------------------------------------------------------------------- 20// ---------------------------------------------------------------------------
19 21