isGeocodingEnabled
This commit is contained in:
parent
2a59e45a3c
commit
ded3c2fd98
4 changed files with 33 additions and 7 deletions
|
@ -170,10 +170,12 @@ module.exports = () => {
|
|||
api.get('/places', isAdmin, placeController.getAll)
|
||||
api.get('/place/:placeName', cors, placeController.getEvents)
|
||||
api.get('/place', cors, placeController.search)
|
||||
api.get('/placeOSM/Nominatim/:place_details', cors, placeController._nominatim)
|
||||
api.get('/placeOSM/Photon/:place_details', cors, placeController._photon)
|
||||
api.put('/place', isAdmin, placeController.updatePlace)
|
||||
|
||||
// - GEOCODING
|
||||
api.get('/placeOSM/Nominatim/:place_details', helpers.isGeocodingEnabled, placeController._nominatim)
|
||||
api.get('/placeOSM/Photon/:place_details', helpers.isGeocodingEnabled, placeController._photon)
|
||||
|
||||
// - TAGS
|
||||
api.get('/tags', isAdmin, tagController.getAll)
|
||||
api.get('/tag', cors, tagController.search)
|
||||
|
|
|
@ -1,2 +1,20 @@
|
|||
// export default models
|
||||
|
||||
// Announcement: require('./announcement'),
|
||||
// APUser: require('./ap_user'),
|
||||
// Collection: require('./collection'),
|
||||
// Event: require('./event'),
|
||||
// EventNotification: require('./eventnotification'),
|
||||
// Filter: require('./filter'),
|
||||
// Instance: require('./instance'),
|
||||
// Notification: require('./notification'),
|
||||
// OAuthClient: require('./oauth_client'),
|
||||
// OAuthCode: require('./oauth_code'),
|
||||
// OAuthToken: require('./oauth_token'),
|
||||
// Place: require('./place'),
|
||||
// Resource: require('./resource'),
|
||||
// Setting: require('./setting'),
|
||||
// Tag: require('./tag'),
|
||||
// User: require('./user'),
|
||||
|
||||
module.exports = {}
|
|
@ -1,6 +1,5 @@
|
|||
const ical = require('ical.js')
|
||||
const settingsController = require('./api/controller/settings')
|
||||
const acceptLanguage = require('accept-language')
|
||||
const express = require('express')
|
||||
const dayjs = require('dayjs')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
@ -15,7 +14,6 @@ const axios = require('axios')
|
|||
const crypto = require('crypto')
|
||||
const Microformats = require('microformat-node')
|
||||
const get = require('lodash/get')
|
||||
const cloneDeep = require('lodash/cloneDeep')
|
||||
|
||||
const DOMPurify = require('dompurify')
|
||||
const { JSDOM } = require('jsdom')
|
||||
|
@ -119,9 +117,9 @@ module.exports = {
|
|||
log.warn(err)
|
||||
} else {
|
||||
res.status(404).send('Not found (but nice try 😊)')
|
||||
// }
|
||||
}
|
||||
}})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
router.use('/fallbackimage.png', (req, res, next) => {
|
||||
|
@ -287,5 +285,13 @@ module.exports = {
|
|||
return res.redirect((accepted === 'application/rss+xml' ? '/feed/rss' : '/feed/ics') + req.path)
|
||||
}
|
||||
next()
|
||||
},
|
||||
|
||||
async isGeocodingEnabled(req, res, next) {
|
||||
if (res.locals.settings.allow_geolocation) {
|
||||
next()
|
||||
} else {
|
||||
res.sendStatus(403)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const log = require('./log')
|
||||
const eventController = require('./api/controller/event')
|
||||
const placeHelpers = require('./helpers/place')
|
||||
const tagHelpers = require('./helpers/tag')
|
||||
// const notifier = require('./notifier')
|
||||
|
@ -54,6 +53,7 @@ class TaskManager {
|
|||
}
|
||||
|
||||
start (interval = loopInterval) {
|
||||
const eventController = require('./api/controller/event')
|
||||
|
||||
// create and clean recurrent events
|
||||
this.add(new Task({
|
||||
|
|
Loading…
Reference in a new issue