rename gelocation, and move the request to nominatim server side

This commit is contained in:
sedum
2022-09-08 20:37:20 +02:00
parent dcdefec6de
commit 6e182b5de1
8 changed files with 28 additions and 28 deletions

View File

@@ -5,7 +5,8 @@ const exportController = require('./export')
const log = require('../../log')
const { Op, where, col, fn, cast } = require('sequelize')
const NOMINATIM_URL = 'https://nominatim.openstreetmap.org/search?limit=3&format=geocodejson&accept-language=it&q='
const NOMINATIM_URL = 'https://nominatim.openstreetmap.org/search?limit=3&format=json&namedetails=1&q='
const axios = require('axios')
module.exports = {
@@ -73,14 +74,10 @@ module.exports = {
return res.json(places.slice(0, 10))
},
// async _nominatim (req, res) {
// const details = req.params.place_details
// const ret = await axios.get(`${NOMINATIM_URL}${details}`, { headers: { 'User-Agent': 'gancio 0.20' } })
// debug(`${NOMINATIM_URL}${details}`)
// debug(ret.status)
// debug(ret.statusText)
// debug(ret.data)
// return ret
// },
async _nominatim (req, res) {
const details = req.params.place_details
const ret = await axios.get(`${NOMINATIM_URL}${details}`, { headers: { 'User-Agent': 'gancio 0.20' } })
return res.json(ret.data)
},
}

View File

@@ -29,7 +29,7 @@ const defaultSettings = {
allow_anon_event: true,
allow_recurrent_event: false,
recurrent_event_visible: false,
allow_geolocalization: false,
allow_geolocation: false,
enable_federation: true,
enable_resources: false,
hide_boosts: true,