You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
544 B
17 lines
544 B
var ipLocation = require('./ip-location')
|
|
|
|
register_hook('init_callback', function (initState, callback) {
|
|
initState.map = ('zoom' in config.defaultView ? config.defaultView.zoom : 14) + '/' + config.defaultView.lat + '/' + config.defaultView.lon
|
|
|
|
if ('checkIpLocation' in config && !config.checkIpLocation) {
|
|
return callback()
|
|
}
|
|
|
|
ipLocation('', function (err, ipLoc) {
|
|
if (typeof ipLoc === 'object' && 'latitude' in ipLoc) {
|
|
initState.map = '14/' + ipLoc.latitude + '/' + ipLoc.longitude
|
|
}
|
|
|
|
callback(err)
|
|
})
|
|
})
|