From 4351ef37f87f573e04d0195a97c0a7fa54e6e73e Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 14 Feb 2023 12:06:41 -0800 Subject: [PATCH] update to GeoLite2-City --- .eslintrc.json | 3 ++- lib/detect.js | 2 +- scripts/build-geo.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index de639b85..bcc38cf8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -48,7 +48,8 @@ "import/no-anonymous-default-export": "off", "@next/next/no-img-element": "off", "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-explicit-any": "off" + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-var-requires": "off" }, "globals": { "React": "writable" diff --git a/lib/detect.js b/lib/detect.js index 210921b9..44eaa26a 100644 --- a/lib/detect.js +++ b/lib/detect.js @@ -68,7 +68,7 @@ export async function getCountry(req, ip) { // Database lookup if (!lookup) { - lookup = await maxmind.open(path.resolve('node_modules/.geo/GeoLite2-Country.mmdb')); + lookup = await maxmind.open(path.resolve('node_modules/.geo/GeoLite2-City.mmdb')); } const result = lookup.get(ip); diff --git a/scripts/build-geo.js b/scripts/build-geo.js index 2ee601db..e84c1564 100644 --- a/scripts/build-geo.js +++ b/scripts/build-geo.js @@ -7,7 +7,7 @@ const zlib = require('zlib'); const tar = require('tar'); let url = - 'https://raw.githubusercontent.com/GitSquared/node-geolite2-redist/master/redist/GeoLite2-Country.tar.gz'; + 'https://raw.githubusercontent.com/GitSquared/node-geolite2-redist/master/redist/GeoLite2-City.tar.gz'; if (process.env.MAXMIND_LICENSE_KEY) { url =