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
433 B

  1. var ipLocation = require('./ip-location')
  2. register_hook('init_callback', function (initState, callback) {
  3. if ('checkIpLocation' in config && !config.checkIpLocation) {
  4. return callback()
  5. }
  6. ipLocation('', function (err, ipLoc) {
  7. if (typeof ipLoc === 'object' && 'latitude' in ipLoc) {
  8. initState.zoom = 14
  9. initState.lat = ipLoc.latitude
  10. initState.lon = ipLoc.longitude
  11. }
  12. callback(err)
  13. })
  14. })