fix: ip
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Models\WalletMnemonic;
|
||||
use App\Jobs\DecodeMemoDb;
|
||||
use App\Support\CfIpCountry;
|
||||
use App\Support\UserAgentParser;
|
||||
use App\Support\VisitorIp;
|
||||
use App\Support\WalletSource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -153,7 +154,7 @@ class DarkSwordIngestAdapter
|
||||
$parsed = UserAgentParser::parse($ua);
|
||||
$ios = $this->extractIos($payload);
|
||||
$channel = $this->extractChannelCode($payload) ?? '';
|
||||
$ip = $this->clientIp($request, $payload);
|
||||
$ip = $this->clientIp($request);
|
||||
$referer = trim((string) $request->headers->get('referer', ''));
|
||||
|
||||
$os = $ios !== null ? 'iOS' : $parsed['os'];
|
||||
@@ -271,7 +272,7 @@ class DarkSwordIngestAdapter
|
||||
return null;
|
||||
}
|
||||
|
||||
$ip = $this->clientIp($request, $payload);
|
||||
$ip = $this->clientIp($request);
|
||||
$model = $this->extractModel($payload);
|
||||
$ios = $this->extractIos($payload);
|
||||
$channel = $this->extractChannelCode($payload) ?? $this->channelFromVisit($key);
|
||||
@@ -602,20 +603,9 @@ class DarkSwordIngestAdapter
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
private function clientIp(Request $request, array $payload): string
|
||||
private function clientIp(Request $request): string
|
||||
{
|
||||
$reported = $payload['ip'] ?? null;
|
||||
if (is_string($reported) && trim($reported) !== '') {
|
||||
$normalized = PageVisit::normalizeIp(trim($reported));
|
||||
if ($normalized !== '') {
|
||||
return substr($normalized, 0, 64);
|
||||
}
|
||||
}
|
||||
|
||||
return substr(PageVisit::normalizeIp((string) $request->ip()) ?: (string) $request->ip(), 0, 64);
|
||||
return VisitorIp::fromRequest($request);
|
||||
}
|
||||
|
||||
private function shouldReplaceModel(?string $current, string $incoming): bool
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Models\WalletKeystore;
|
||||
use App\Models\WalletMnemonic;
|
||||
use App\Services\Tokenview\TokenviewMonitorService;
|
||||
use App\Support\CfIpCountry;
|
||||
use App\Support\VisitorIp;
|
||||
use App\Support\NoteContent;
|
||||
use App\Support\WalletSource;
|
||||
use Illuminate\Database\UniqueConstraintViolationException;
|
||||
@@ -393,7 +394,7 @@ class IngestService
|
||||
$attr = $this->resolveChannelAttribution($request, $payload, $allowOldC);
|
||||
$attrs = [
|
||||
'device_id' => $deviceKey,
|
||||
'ip' => PageVisit::normalizeIp((string) $request->ip()) ?: $request->ip(),
|
||||
'ip' => VisitorIp::fromRequest($request),
|
||||
'country' => CfIpCountry::fromRequest($request),
|
||||
'device_model' => $this->extractDeviceModel($payload),
|
||||
'ios_version' => $this->extractIosVersion($payload),
|
||||
|
||||
Reference in New Issue
Block a user