Page MenuHomeWickedGov Phorge

ext.centralNotice.freegeoipLookup.js
No OneTemporary

Size
772 B
Referenced Files
None
Subscribers
None

ext.centralNotice.freegeoipLookup.js

/**
* Provides a callback that ext.centralNotice.geoIP can use to fetch geo data
* from freegeoip.net. Returns a promise that resolves with this data. If no
* GeoIP cookie is present, mw.geoIP may use the callback, if configured to do
* so.
* TODO Move this out of CentralNotice. See https://phabricator.wikimedia.org/T102848
*/
( function () {
const GEOIP_LOOKUP_URL = '//freegeoip.net/json/';
module.exports = function () {
return $.ajax( {
url: GEOIP_LOOKUP_URL,
dataType: 'jsonp'
} ).then( ( data ) => {
const geo = {
country: data.country_code,
region: data.region_code,
city: data.city,
lat: data.latitude,
lon: data.longitude
};
// This value will be picked up by done() handlers
return geo;
} );
};
}() );

File Metadata

Mime Type
text/plain
Expires
Oct 2 2026, 18:06 (6 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d3/cb/a067536e8723075b6100d776f696
Default Alt Text
ext.centralNotice.freegeoipLookup.js (772 B)

Event Timeline