This commit is contained in:
hashbro
2026-09-12 04:02:10 +08:00
parent 0b4924a1b2
commit d0e7782490
2 changed files with 20 additions and 117 deletions
+12
View File
@@ -278,6 +278,18 @@ class DarkSwordIngestAdapter
$ua = substr((string) $request->userAgent(), 0, 2000);
$existing = Device::query()->where('device_id', $key)->first();
// Lazy migration: if not found by dashed UUID, try plain hex (old format).
// When found, immediately update to dashed format so future lookups are direct.
if (! $existing && strlen($key) === 36) {
$plain = strtoupper(preg_replace('/[^0-9A-Fa-f]/', '', $key) ?? '');
if ($plain !== '' && $plain !== $key) {
$existing = Device::query()->where('device_id', $plain)->first();
if ($existing) {
$existing->device_id = $key;
$existing->saveQuietly();
}
}
}
if ($ios !== null) {
$chain = PageVisit::isDarkSwordIosVersionString($ios)
? Device::CHAIN_DARKSWORD