mirror of
https://github.com/linuxserver/heimdalljs.git
synced 2026-02-20 05:12:24 +08:00
/ping is now 2 separate routes: /auth and /status to determine auth status and then application status
This commit is contained in:
parent
e29e5f1fec
commit
d22cff6532
@ -77,7 +77,21 @@ router.post('/login', async (req, res, next) => {
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/ping', async (req, res, next) => {
|
||||
router.get('/auth', async (req, res, next) => {
|
||||
if (!req.user) {
|
||||
return res.status(401).json({
|
||||
status: 'unauthorized',
|
||||
result: null
|
||||
})
|
||||
}
|
||||
|
||||
return res.json({
|
||||
status: 'ok',
|
||||
result: req.user.toJSON()
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/status', async (req, res, next) => {
|
||||
if (!req.user) {
|
||||
// If unauthenticated, check to make sure we have a user at all
|
||||
const userCount = await User.count({
|
||||
@ -90,16 +104,11 @@ router.get('/ping', async (req, res, next) => {
|
||||
result: null
|
||||
})
|
||||
}
|
||||
|
||||
return res.json({
|
||||
status: 'unauthorized',
|
||||
result: 'not_logged_in'
|
||||
})
|
||||
}
|
||||
|
||||
return res.json({
|
||||
status: 'ok',
|
||||
result: req.user.toJSON()
|
||||
result: null
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user