From 39c0ea11c3d8fa1f7167bde407cb5cbe00f86ac3 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 23 Aug 2022 12:12:28 -0700 Subject: [PATCH] Updated request-ip package. --- lib/request.js | 3 ++- package.json | 2 +- yarn.lock | 15 ++++----------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/request.js b/lib/request.js index 6ca684e2..210921b9 100644 --- a/lib/request.js +++ b/lib/request.js @@ -1,3 +1,4 @@ +import path from 'path'; import requestIp from 'request-ip'; import { browserName, detectOS } from 'detect-browser'; import isLocalhost from 'is-localhost-ip'; @@ -67,7 +68,7 @@ export async function getCountry(req, ip) { // Database lookup if (!lookup) { - lookup = await maxmind.open('node_modules/.geo/GeoLite2-Country.mmdb'); + lookup = await maxmind.open(path.resolve('node_modules/.geo/GeoLite2-Country.mmdb')); } const result = lookup.get(ip); diff --git a/package.json b/package.json index cd078391..b0ee7429 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "react-tooltip": "^4.2.21", "react-use-measure": "^2.0.4", "react-window": "^1.8.6", - "request-ip": "^2.1.3", + "request-ip": "^3.3.0", "semver": "^7.3.6", "thenby": "^1.3.4", "timezone-support": "^2.0.2", diff --git a/yarn.lock b/yarn.lock index e448c012..98144f5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4081,11 +4081,6 @@ is-weakref@^1.0.2: dependencies: call-bind "^1.0.2" -is_js@^0.9.0: - version "0.9.0" - resolved "https://registry.npmjs.org/is_js/-/is_js-0.9.0.tgz" - integrity sha512-8Y5EHSH+TonfUHX2g3pMJljdbGavg55q4jmHzghJCdqYDbdNROC8uw/YFQwIRCRqRJT1EY3pJefz+kglw+o7sg== - isbot@^3.4.5: version "3.5.0" resolved "https://registry.npmjs.org/isbot/-/isbot-3.5.0.tgz" @@ -5669,12 +5664,10 @@ regjsparser@^0.8.2: dependencies: jsesc "~0.5.0" -request-ip@^2.1.3: - version "2.2.0" - resolved "https://registry.npmjs.org/request-ip/-/request-ip-2.2.0.tgz" - integrity sha512-Hn4zUAr+XHbUs2RrfHur62t7+UhvtevqK32ordFewguEfNHUkhSdYgbG7PDGmXZEzqEXll9bei0+VMe6gkmuUQ== - dependencies: - is_js "^0.9.0" +request-ip@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/request-ip/-/request-ip-3.3.0.tgz#863451e8fec03847d44f223e30a5d63e369fa611" + integrity sha512-cA6Xh6e0fDBBBwH77SLJaJPBmD3nWVAcF9/XAcsrIHdjhFzFiB5aNQFytdjCGPezU3ROwrR11IddKAM08vohxA== request@2.88.0: version "2.88.0"