revert(catalog): drop de-account demo fallback (de lacks EUR/TR catalogs)

Confirmed via dev probes: the de account is non-demo (licensed) for Hyundai
parts but does NOT have the EUR/TR-region catalogs our vehicles use, so the
fallback returned non-demo-but-empty and just doubled upstream load. Root cause
of empty Hyundai/Kia/Nissan parts is PL24 licensing/region (tr account not
licensed for these brands' parts) — a commercial issue, not code-fixable.
Keeping only the explanatory comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-05 16:10:29 +03:00
parent 220988c02e
commit 9da0d4df75

View File

@@ -3256,38 +3256,21 @@ export class PL24FordLegacyService {
const html = await response.text();
// Demo mode: PL24 serves a stripped NOT_LOGGED_IN_DEMO page (no real
// groups/parts) when the service token is stale OR the account is not
// licensed for this brand. Retry once with fresh auth; if still demo on the
// primary (tr) account, fall back to the secondary (de) account whose
// license set may include this brand (e.g. Hyundai/Kia/Nissan parts).
const supportOf = (h: string) =>
h.includes("PL24_SUPPORT")
? this.extractScriptVariable<FordPL24Support>(h, "PL24_SUPPORT")
: null;
const isDemo = (h: string) => {
const s = supportOf(h);
return !!(s?.demo || s?.role === "NOT_LOGGED_IN_DEMO");
};
if (isDemo(html)) {
if (!retried) {
this.logger.warn(`Ford legacy: demo page for ${serviceName} (account=${account}), re-auth + retry`);
// groups/parts) when the service token is stale. decodeVinForService
// retries on this, but drill paths reach upstream only through here —
// so retry once with fresh auth before parsing an empty page.
// NOTE: Hyundai/Kia/Nissan parts are demo-gated on the tr account
// (not licensed); the de account is licensed but lacks the EUR/TR-region
// catalogs, so a de fallback returns non-demo-but-empty — a PL24 commercial
// licensing/region issue, not fixable here.
if (!retried && html.includes("PL24_SUPPORT")) {
const support = this.extractScriptVariable<FordPL24Support>(html, "PL24_SUPPORT");
if (support?.demo || support?.role === "NOT_LOGGED_IN_DEMO") {
this.logger.warn(`Ford legacy: demo page for ${serviceName}, re-authing + retry`);
this.authService.clearTokensForAccount(account);
await this.authService.authorizeServiceForAccount(serviceName, account);
return this.fetchP4Page(url, serviceName, isFullUrl, account, true);
}
if (account === "tr") {
// License may live on the de account — try it once (own re-auth allowed).
try {
await this.authService.authorizeServiceForAccount(serviceName, "de");
const deHtml = await this.fetchP4Page(url, serviceName, isFullUrl, "de", false);
if (deHtml && !isDemo(deHtml)) {
this.logger.log(`Ford legacy: ${serviceName} served by de account (tr was demo)`);
return deHtml;
}
} catch (e) {
this.logger.warn(`Ford legacy: de fallback failed for ${serviceName}: ${(e as Error).message}`);
}
}
}
return html;
} catch (error) {