Feature: Mega-Debrid-Account beim Hinzufuegen sofort pruefen (Gueltigkeit + Premium)
Beim "Hinzufuegen" eines Mega-Debrid-Accounts im Bearbeiten-Dialog wird der Account jetzt sofort einzeln geprueft (connectUser) — Login-Gueltigkeit + Premium-Restlaufzeit erscheinen direkt als Badge, ohne den Tab schliessen und "Alle pruefen" klicken zu muessen. Waehrend der Pruefung zeigt das Badge "Pruefe…". Neue Einzel-Check-IPC (Spiegel von checkDebridAccounts): CHECK_MEGA_DEBRID_ACCOUNT -> app-controller.checkSingleMegaDebridAccount(login, password) baut den Account-Entry (id via getMegaDebridAccountId), ruft die bestehende checkMegaDebridAccount() und merged das Ergebnis via applyDebridAccountStatuses -> Snapshot -> Badge (gleicher Pfad wie "Alle pruefen"). Funktioniert fuer den noch nicht gespeicherten Draft-Account, weil applyDebridAccountStatuses merged (kein Pruning) + emitState. Kern-Check-Logik unveraendert + weiterhin durch account-check.test.ts gedeckt. 643 Tests gruen, tsc 9 (unveraendert), Build sauber. GUI compile-/build-verifiziert, im laufenden Electron noch nicht click-getestet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4a883fb93f
commit
efb5696c13
@@ -24,7 +24,8 @@ import { importDlcContainers } from "./container";
|
||||
import { APP_VERSION } from "./constants";
|
||||
import { DownloadManager } from "./download-manager";
|
||||
import { fetchAllDebridHostInfo, fetchDebridLinkHostLimits } from "./debrid";
|
||||
import { checkAllDebridAccounts } from "./account-check";
|
||||
import { checkAllDebridAccounts, checkMegaDebridAccount } from "./account-check";
|
||||
import { parseMegaDebridAccounts } from "../shared/mega-debrid-accounts";
|
||||
import { parseCollectorInput } from "./link-parser";
|
||||
import { configureLogger, getLogFilePath, logger } from "./logger";
|
||||
import { AllDebridWebFallback } from "./all-debrid-web";
|
||||
@@ -389,6 +390,20 @@ public async checkDebridAccounts(): Promise<DebridAccountStatus[]> {
|
||||
});
|
||||
return statuses;
|
||||
}
|
||||
|
||||
/** Check a SINGLE Mega-Debrid account by raw credentials (used when an account
|
||||
* is added in the dialog, before it is saved) and merge the result so the
|
||||
* validity/premium badge updates immediately — without a full "Alle pruefen". */
|
||||
public async checkSingleMegaDebridAccount(login: string, password: string): Promise<DebridAccountStatus | null> {
|
||||
const entry = parseMegaDebridAccounts(`${login.trim()}:${password.trim()}`)[0];
|
||||
if (!entry) {
|
||||
return null;
|
||||
}
|
||||
const status = await checkMegaDebridAccount(entry);
|
||||
this.manager.applyDebridAccountStatuses([status]);
|
||||
this.audit("INFO", "Mega-Debrid-Account einzeln geprueft", { valid: status.valid, premium: status.isPremium });
|
||||
return status;
|
||||
}
|
||||
public async checkUpdates(): Promise<UpdateCheckResult> {
|
||||
const result = await checkGitHubUpdate(this.settings.updateRepo);
|
||||
if (!result.error) {
|
||||
|
||||
@@ -648,6 +648,10 @@ function registerIpcHandlers(): void {
|
||||
return controller.checkDebridAccounts();
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.CHECK_MEGA_DEBRID_ACCOUNT, async (_event, login: string, password: string) => {
|
||||
return controller.checkSingleMegaDebridAccount(String(login || ""), String(password || ""));
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.IMPORT_BACKUP, async () => {
|
||||
const options = {
|
||||
properties: ["openFile"] as Array<"openFile">,
|
||||
|
||||
Reference in New Issue
Block a user