Return proper HTTP response when Geo lookup is not ready

master
Manuel Kasper 2022-08-15 11:22:09 +02:00
rodzic f8db795a1d
commit b785ea782a
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -296,6 +296,10 @@ app.get('/activators/:callsign', (req, res) => {
});
app.get('/map_server', (req, res) => {
if (!geoLookup) {
res.status(503).end();
return;
}
let mapServer = 'us';
let geo = geoLookup.get(req.ip);
if (geo.continent.code === 'AF' || geo.continent.code === 'EU') {
@ -305,6 +309,10 @@ app.get('/map_server', (req, res) => {
});
app.get('/my_coordinates', (req, res) => {
if (!geoLookup) {
res.status(503).end();
return;
}
let geo = geoLookup.get(req.ip);
if (!geo) {
res.json({});
@ -314,6 +322,10 @@ app.get('/my_coordinates', (req, res) => {
});
app.get('/my_country', (req, res) => {
if (!geoLookup) {
res.status(503).end();
return;
}
let geo = geoLookup.get(req.ip);
if (!geo) {
res.json({});