aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-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