check if I'm reachable to myself to help in #298

This commit is contained in:
lesion 2023-10-25 09:47:17 +02:00
parent 829de697f2
commit 98c56b6d32
No known key found for this signature in database
GPG key ID: 352918250B012177
3 changed files with 16 additions and 2 deletions

View file

@ -3,6 +3,8 @@ v-container.container.pa-0.pa-md-3
v-card
v-alert(v-if='url!==settings.baseurl' outlined type='warning' show-icon :icon='mdiAlert')
span(v-html="$t('admin.wrong_domain_warning', { url, baseurl: settings.baseurl })")
v-alert(v-if='!selfReachable' outlined type='warning' show-icon :icon='mdiAlert')
span(v-html="$t('admin.not_reachable')")
v-tabs(v-model='selectedTab' show-arrows :next-icon='mdiChevronRight' :prev-icon='mdiChevronLeft')
//- SETTINGS
@ -101,9 +103,10 @@ export default {
try {
const users = await $axios.$get('/users')
const unconfirmedEvents = await $axios.$get('/event/unconfirmed')
return { users, unconfirmedEvents, url }
const selfReachable = await $axios.$get('/reachable')
return { users, unconfirmedEvents, url, selfReachable }
} catch (e) {
return { users: [], unconfirmedEvents: [], url }
return { users: [], unconfirmedEvents: [], url, selfReachable: false }
}
},
data () {
@ -112,6 +115,7 @@ export default {
users: [],
description: '',
unconfirmedEvents: [],
selfReachable: false
}
},
head () {

View file

@ -71,6 +71,7 @@ module.exports = () => {
```
*/
api.get('/ping', (_req, res) => res.sendStatus(200))
api.get('/reachable', helpers.reachable)
api.get('/user', isAuth, (req, res) => res.json(req.user))
api.post('/user/recover', SPAMProtectionApiRateLimiter, userController.forgotPassword)

View file

@ -287,6 +287,15 @@ module.exports = {
next()
},
async reachable(req, res) {
try {
const response = await axios({ url: config.baseurl })
return res.sendStatus(200)
} catch(e) {
return res.status(400).json(e)
}
},
async isGeocodingEnabled(req, res, next) {
if (res.locals.settings.allow_geolocation) {
next()