1

Fix de playwright

This commit is contained in:
2025-12-11 00:53:08 +01:00
parent 8315fd2b21
commit 7231e4624c
3 changed files with 27 additions and 19 deletions

View File

@@ -76,24 +76,28 @@ const MAX_REDIRECTS = Math.max(
);
const DEFAULT_USER_AGENT = buildUserAgent(settings.userAgent);
const IGNORE_HOSTS = parseIgnoreHosts(settings.ignoreHosts);
const PLAYWRIGHT_RESOLUTION =
settings.usePlaywright === true
? resolvePlaywrightExecutable(settings.playwrightExecutablePath)
: { path: null, missing: null };
const PLAYWRIGHT_EXECUTABLE = PLAYWRIGHT_RESOLUTION.path;
const PLAYWRIGHT_ENABLED = settings.usePlaywright === true && !PLAYWRIGHT_RESOLUTION.missing;
if (settings.usePlaywright === true && PLAYWRIGHT_RESOLUTION.missing) {
console.warn(
[
"Playwright désactivé : impossible de trouver l'exécutable demandé",
`"${PLAYWRIGHT_RESOLUTION.missing}".`,
`Corrigez externalLinks.playwrightExecutablePath dans ${path.relative(
SITE_ROOT,
CONFIG_PATH
)} pour rétablir la vérification enrichie.`,
].join(" ")
);
let PLAYWRIGHT_EXECUTABLE = null;
if (settings.usePlaywright === true && typeof settings.playwrightExecutablePath === "string") {
const trimmedExecutable = settings.playwrightExecutablePath.trim();
if (trimmedExecutable) {
const resolution = resolvePlaywrightExecutable(trimmedExecutable);
if (resolution.missing) {
console.error(
[
"Playwright activé mais impossible de trouver l'exécutable demandé",
`"${resolution.missing}".`,
`Corrigez externalLinks.playwrightExecutablePath dans ${path.relative(
SITE_ROOT,
CONFIG_PATH
)} ou laissez ce champ vide pour utiliser la configuration Playwright par défaut.`,
].join(" ")
);
process.exit(1);
}
PLAYWRIGHT_EXECUTABLE = resolution.path;
}
}
const PLAYWRIGHT_ENABLED = settings.usePlaywright === true;
const PLAYWRIGHT_TIMEOUT_MS = Math.max(
1000,
(Number.isFinite(Number(settings.playwrightTimeoutSeconds))

View File

@@ -16,7 +16,7 @@
"cookieJar": "tools/cache/curl_cookies.txt",
"usePlaywright": true,
"playwrightTimeoutSeconds": 10,
"playwrightExecutablePath": "/nix/store/jaf9gnbln0cbs2vspfdblc4ff6vv1kk5-chromium-142.0.7444.175/bin/chromium",
"playwrightExecutablePath": null,
"ignoreHosts": [
"10.0.2.1",
"web.archive.org",
@@ -133,4 +133,4 @@
"post": 24
}
}
}
}