From 6b3eb7617ddbb831a08ac62b9f3bd4f8c2a495fa Mon Sep 17 00:00:00 2001 From: effakt Date: Sat, 4 Feb 2023 08:46:32 +1300 Subject: [PATCH] Adding registered_country fallback to getCountry --- lib/request.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/request.js b/lib/request.js index 210921b9..78e0e351 100644 --- a/lib/request.js +++ b/lib/request.js @@ -73,7 +73,8 @@ export async function getCountry(req, ip) { const result = lookup.get(ip); - return result?.country?.iso_code; + // country can not be set, fallback to registerd_country in this case + return result?.country?.iso_code ?? result?.registered_country?.iso_code; } export async function getClientInfo(req, { screen }) {