- Schema: lyraVoiceId stays, new os_version column on user_devices (Migration 20260515) - registerDevice() merge-heuristic: if existing record matches userId + same name + same model + lastSeen < 30 days, update existing instead of inserting new. Fixes iOS IDFV-reset creating phantom devices on Recovery-Restore. - register.post.ts: accepts osVersion in body, maps isCurrent in error-path payload - New util testUser.ts: isTestUser(email) — explicit allowlist for charioanouar@gmail.com plus existing @rebreak.internal suffix Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
23 lines
790 B
TypeScript
23 lines
790 B
TypeScript
/**
|
|
* Test-User-Detection.
|
|
*
|
|
* Primäre Methode: @rebreak.internal Email-Suffix (intern angelegte Test-Accounts,
|
|
* Login via /api/auth/login mit username-only).
|
|
*
|
|
* Whitelist-Methode: explizite Emails für externe Test-Accounts die NICHT das
|
|
* @rebreak.internal-System nutzen (z.B. existierende Supabase-Auth-Accounts).
|
|
*
|
|
* Wird genutzt um Test-Accounts Zugang zu Dev-Endpoints + verkürzten Timern zu geben,
|
|
* auch wenn die Umgebung nicht als "staging" konfiguriert ist.
|
|
*/
|
|
|
|
const TEST_USER_EMAILS: ReadonlyArray<string> = [
|
|
'charioanouar@gmail.com',
|
|
];
|
|
|
|
export function isTestUser(email: string | null | undefined): boolean {
|
|
if (!email) return false;
|
|
const lower = email.toLowerCase();
|
|
return lower.endsWith('@rebreak.internal') || TEST_USER_EMAILS.includes(lower);
|
|
}
|