Skip to content

Commit 677d2f4

Browse files
committed
fix: use ipinfo only as fallback when ip-api fails, stricter keywords
1 parent 2299c6f commit 677d2f4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

routes/auth.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async function isVpnOrProxy(ip) {
111111
const res = await fetchWithTimeout(`http://ip-api.com/json/${cleanIp}?fields=proxy,hosting,isp,org,query`);
112112
const data = await res.json();
113113
console.log('[VPN] ip-api response for', cleanIp, ':', JSON.stringify(data));
114-
if (data.proxy === true || data.hosting === true) return true;
114+
return data.proxy === true || data.hosting === true;
115115
} catch (err) {
116116
console.log('[VPN] ip-api failed for', cleanIp, ':', err.message);
117117
}
@@ -121,8 +121,7 @@ async function isVpnOrProxy(ip) {
121121
const data = await res.json();
122122
console.log('[VPN] ipinfo response for', cleanIp, ':', JSON.stringify({ org: data.org }));
123123
const orgLower = (data.org || '').toLowerCase();
124-
if (orgLower.includes('vpn') || orgLower.includes('proxy') || orgLower.includes('tor') ||
125-
orgLower.includes('hosting') || orgLower.includes('cloud') || orgLower.includes('datacenter')) {
124+
if (orgLower.includes('vpn') || orgLower.includes('proxy') || orgLower.includes('tor')) {
126125
return true;
127126
}
128127
} catch (err) {

0 commit comments

Comments
 (0)