mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Add debug component to help admins to fix IP issues
This commit is contained in:
parent
2b3f1919fd
commit
5d79474cc6
19 changed files with 242 additions and 10 deletions
25
server/controllers/api/server/debug.ts
Normal file
25
server/controllers/api/server/debug.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import * as express from 'express'
|
||||
import { UserRight } from '../../../../shared/models/users'
|
||||
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
|
||||
|
||||
const debugRouter = express.Router()
|
||||
|
||||
debugRouter.get('/debug',
|
||||
authenticate,
|
||||
ensureUserHasRight(UserRight.MANAGE_DEBUG),
|
||||
asyncMiddleware(getDebug)
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
debugRouter
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function getDebug (req: express.Request, res: express.Response) {
|
||||
return res.json({
|
||||
ip: req.ip
|
||||
}).end()
|
||||
}
|
|
@ -5,6 +5,7 @@ import { serverRedundancyRouter } from './redundancy'
|
|||
import { serverBlocklistRouter } from './server-blocklist'
|
||||
import { contactRouter } from './contact'
|
||||
import { logsRouter } from './logs'
|
||||
import { debugRouter } from './debug'
|
||||
|
||||
const serverRouter = express.Router()
|
||||
|
||||
|
@ -14,6 +15,7 @@ serverRouter.use('/', statsRouter)
|
|||
serverRouter.use('/', serverBlocklistRouter)
|
||||
serverRouter.use('/', contactRouter)
|
||||
serverRouter.use('/', logsRouter)
|
||||
serverRouter.use('/', debugRouter)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue