fix(accounts): refresh status before enabling accounts
Validate Real-Debrid, Mega-Debrid, and Debrid-Link accounts silently before exposing a newly enabled account to active downloads. Keep the row toggle optimistic, skip network checks while disabling, persist direct account-check results, and avoid the browser-login race for an already authenticated Real-Debrid web session.
This commit is contained in:
@@ -598,15 +598,21 @@ export class AppController {
|
||||
? parseMegaDebridAccounts(`${input.identity.trim()}:${input.secret}`)[0]
|
||||
: getMegaDebridAccountsForMode(this.settings, mode).find((entry) => entry.id === input.accountId);
|
||||
if (!account) throw new Error("Account-Payload ist ungültig");
|
||||
const status = await checkMegaDebridAccount(account);
|
||||
return sanitizeDebridAccountStatus(status, redactions);
|
||||
const status = sanitizeDebridAccountStatus(await checkMegaDebridAccount(account), redactions);
|
||||
if (!input.secret && getMegaDebridAccountsForMode(this.settings, mode).some((entry) => entry.id === status.accountId)) {
|
||||
this.manager.applyDebridAccountStatuses([status]);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
const key = input.secret?.trim()
|
||||
? parseDebridLinkApiKeys(input.secret)[0]
|
||||
: parseDebridLinkApiKeys(this.settings.debridLinkApiKeys).find((entry) => entry.id === input.accountId);
|
||||
if (!key) throw new Error("Account-Payload ist ungültig");
|
||||
const status = await checkDebridLinkKey(key);
|
||||
return sanitizeDebridAccountStatus(status, redactions);
|
||||
const status = sanitizeDebridAccountStatus(await checkDebridLinkKey(key), redactions);
|
||||
if (!input.secret && parseDebridLinkApiKeys(this.settings.debridLinkApiKeys).some((entry) => entry.id === status.accountId)) {
|
||||
this.manager.applyDebridAccountStatuses([status]);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
public resetProviderDailyUsage(provider: DebridProvider): AppSettings {
|
||||
|
||||
Reference in New Issue
Block a user