From 81c516b831e6d1e9d62e508d2161625f8186a0db Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Wed, 17 Jun 2026 02:52:00 +0200 Subject: [PATCH] fix(magic): robust hostname matching for current device detection --- apps/rebreak-magic/app/composables/useDeviceStatus.ts | 2 +- apps/rebreak-magic/app/composables/useProtectionStatus.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/rebreak-magic/app/composables/useDeviceStatus.ts b/apps/rebreak-magic/app/composables/useDeviceStatus.ts index a12c1fe..81efc6e 100644 --- a/apps/rebreak-magic/app/composables/useDeviceStatus.ts +++ b/apps/rebreak-magic/app/composables/useDeviceStatus.ts @@ -30,7 +30,7 @@ function normalizePlatform(value: string | null | undefined): ComputedDevice["pl } function normalizeHostname(value: string): string { - return (value.toLowerCase().split(".")[0] ?? "").trim(); + return (value.toLowerCase().split(".")[0] ?? "").replace(/[^a-z0-9]/g, ""); } export function useDeviceStatus( diff --git a/apps/rebreak-magic/app/composables/useProtectionStatus.ts b/apps/rebreak-magic/app/composables/useProtectionStatus.ts index 6e0f1a2..43d6def 100644 --- a/apps/rebreak-magic/app/composables/useProtectionStatus.ts +++ b/apps/rebreak-magic/app/composables/useProtectionStatus.ts @@ -16,7 +16,7 @@ const IPHONE_POLL_INTERVAL = 5000; const DEVICE_REFRESH_INTERVAL = 30000; function normalizeHostname(value: string): string { - return (value.toLowerCase().split(".")[0] ?? "").trim(); + return (value.toLowerCase().split(".")[0] ?? "").replace(/[^a-z0-9]/g, ""); } export function useProtectionStatus() {