fix(analyzer): extract loginPath/mainPath as bootstrap fallback

When HTML/JS contains loginPath or mainPath variables (common in
95598 and similar scenes), extract the domain as expected_domain and
the full URL as target_url. This fixes the bootstrap_resolved gate
failure for scenes that use loginPath/mainPath instead of meta tags
or explicit bootstrap configuration.

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
木炎
2026-04-17 19:44:13 +08:00
parent 475e460eb1
commit 4215d49f3f
2 changed files with 407 additions and 52 deletions

View File

@@ -445,14 +445,21 @@ function collectBootstrapHints(files, indexHtml) {
for (const file of files) {
const namedUrlMatches = file.content.matchAll(
/\b(sourceUrl|sourceURL|baseUrl|baseURL|targetUrl|requestUrl|apiUrl|gatewayUrl)\b\s*[:=]\s*(['"`])(https?:\/\/[^'"`\s]+)\2/gi
/\b(sourceUrl|sourceURL|baseUrl|baseURL|targetUrl|requestUrl|apiUrl|gatewayUrl|loginPath|mainPath)\b\s*[:=]\s*(['"`])(https?:\/\/[^'"`\s]+)\2/gi
);
for (const match of namedUrlMatches) {
const url = match[3];
const type = String(match[1] || "").toLowerCase();
if (url && !seen.has(url)) {
seen.add(url);
hints.push({ type, url, path: file.path });
// loginPath/mainPath are bootstrap hints — the domain is expected_domain
if (type === "loginpath" || type === "mainpath") {
const domain = new URL(url).hostname;
hints.push({ type: "expected_domain", value: domain, path: file.path });
hints.push({ type: "target_url", value: url, path: file.path });
} else {
hints.push({ type, url, path: file.path });
}
}
}