fix(accounts): separate Debrid-Link username and email
Persist the username and email returned by the Debrid-Link account endpoint as distinct identity fields and project them into their matching account-table columns. Migrate cached legacy statuses that stored a username in the email field, preserve both fields through renderer validation and sanitization, and cover API responses with and without an email address.
This commit is contained in:
@@ -245,15 +245,17 @@ export async function checkDebridLinkKey(
|
||||
const premiumLeftSec = Number(value.premiumLeft || 0);
|
||||
const accountType = Number(value.accountType || 0);
|
||||
const premiumUntilMs = Number.isFinite(premiumLeftSec) && premiumLeftSec > 0 ? now + premiumLeftSec * 1000 : 0;
|
||||
const isPremium = premiumUntilMs > now || accountType > 0;
|
||||
const username = String(value.username || "").trim() || undefined;
|
||||
return {
|
||||
...base,
|
||||
valid: true,
|
||||
isPremium,
|
||||
premiumUntilMs: premiumUntilMs > 0 ? premiumUntilMs : (accountType > 0 ? null : 0),
|
||||
email: username,
|
||||
message: premiumUntilMs > 0
|
||||
const isPremium = premiumUntilMs > now || accountType > 0;
|
||||
const username = String(value.username || "").trim() || undefined;
|
||||
const email = String(value.email || "").trim() || undefined;
|
||||
return {
|
||||
...base,
|
||||
valid: true,
|
||||
isPremium,
|
||||
premiumUntilMs: premiumUntilMs > 0 ? premiumUntilMs : (accountType > 0 ? null : 0),
|
||||
username,
|
||||
email,
|
||||
message: premiumUntilMs > 0
|
||||
? formatRemaining(premiumUntilMs, now)
|
||||
: (accountType > 0 ? "Premium aktiv" : "Kein Premium (Free)")
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user