🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 22:19:41 +01:00
parent e561acb897
commit 8f2a2fdc37
3 changed files with 27 additions and 13 deletions
@@ -40,7 +40,18 @@ class VPNCheckerMiddleware
$userIp = $request->ip();
$apiResponse = $ipService->ipLookup($userIp);
$asn = $apiResponse['asn']['asn'] ?? '';
$asn = '';
if (is_array($apiResponse)) {
$asnSection = $apiResponse['asn'] ?? null;
if (is_array($asnSection)) {
$asnValue = $asnSection['asn'] ?? null;
if (is_string($asnValue)) {
$asn = $asnValue;
} elseif (is_int($asnValue)) {
$asn = (string) $asnValue;
}
}
}
$asnWhitelisted = WebsiteIpWhitelist::where('asn', $asn)
->where('whitelist_asn', '=', '1')
->exists();
@@ -61,8 +72,11 @@ class VPNCheckerMiddleware
]);
}
if (isset($apiResponse['threat']) && is_array($apiResponse['threat'])) {
$filteredThreats = array_diff_key($apiResponse['threat'], array_flip(['blocklists', 'is_icloud_relay', 'is_datacenter', 'is_tor', 'is_proxy']));
if (is_array($apiResponse) && isset($apiResponse['threat']) && is_array($apiResponse['threat'])) {
$filteredThreats = array_diff_key(
$apiResponse['threat'],
array_flip(['blocklists', 'is_icloud_relay', 'is_datacenter', 'is_tor', 'is_proxy'])
);
if (in_array(true, $filteredThreats, true)) {
WebsiteIpBlacklist::create([