autokap 1.3.27 → 1.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +11 -26
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -904,6 +904,17 @@ export class Browser {
|
|
|
904
904
|
'--no-default-browser-check',
|
|
905
905
|
'--no-first-run',
|
|
906
906
|
'--noerrdialogs',
|
|
907
|
+
// Chrome's translate prompt only appears when the page language is NOT
|
|
908
|
+
// in the user's preferred-languages list. By listing every language we
|
|
909
|
+
// might capture (covers our marketing demos: fr, en, es, de, it, pt, nl,
|
|
910
|
+
// ja, zh, ko, ar, ru, plus regional variants), Chrome treats every page
|
|
911
|
+
// as "user already speaks this" and never offers translation. Belt-and-
|
|
912
|
+
// suspenders alongside the Dockerfile policy file (which Playwright's
|
|
913
|
+
// bundled Chromium might not honor per issue #32324) and the
|
|
914
|
+
// notranslate meta init script. accept-lang affects HTTP requests AND
|
|
915
|
+
// Chrome's translate decision; it's the only Chrome-side knob that
|
|
916
|
+
// works regardless of policy path detection or feature flag drift.
|
|
917
|
+
'--accept-lang=fr-FR,fr,en-US,en,en-GB,es-ES,es,de-DE,de,it-IT,it,pt-PT,pt-BR,pt,nl-NL,nl,ja-JP,ja,zh-CN,zh-TW,zh,ko-KR,ko,ar,ru-RU,ru,he,th,tr,vi,sv,no,da,fi,pl,cs',
|
|
907
918
|
] : [];
|
|
908
919
|
const clipArgs = [
|
|
909
920
|
...baseArgs,
|
|
@@ -1026,32 +1037,6 @@ export class Browser {
|
|
|
1026
1037
|
catch (err) {
|
|
1027
1038
|
console.warn('[gpu-check] WebGL query failed:', err.message);
|
|
1028
1039
|
}
|
|
1029
|
-
// Diagnostic — verify the enterprise managed policy file shipped in
|
|
1030
|
-
// cloud-runner/Dockerfile is actually loaded by Chromium. If
|
|
1031
|
-
// TranslateEnabled doesn't appear in chrome://policy, Playwright's
|
|
1032
|
-
// bundled Chromium isn't reading our policy directory (issue
|
|
1033
|
-
// microsoft/playwright#32324) and we need to fall back to a
|
|
1034
|
-
// pre-seeded user-data-dir for the translate.enabled pref.
|
|
1035
|
-
try {
|
|
1036
|
-
const policyPage = await instance.context.newPage();
|
|
1037
|
-
await policyPage.goto('chrome://policy', { timeout: 5000, waitUntil: 'load' });
|
|
1038
|
-
await policyPage.waitForTimeout(300);
|
|
1039
|
-
const policyInfo = await policyPage.evaluate(() => {
|
|
1040
|
-
const text = document.body?.innerText ?? '';
|
|
1041
|
-
const lines = text.split('\n').filter(l => l.toLowerCase().includes('translate'));
|
|
1042
|
-
return {
|
|
1043
|
-
hasTranslateEnabled: text.includes('TranslateEnabled'),
|
|
1044
|
-
translateLines: lines.slice(0, 10),
|
|
1045
|
-
// chrome://policy renders a "No policies set" message when none load
|
|
1046
|
-
noPoliciesMessage: text.includes('No policies set'),
|
|
1047
|
-
};
|
|
1048
|
-
});
|
|
1049
|
-
console.info('[policy-check] chrome://policy:', JSON.stringify(policyInfo));
|
|
1050
|
-
await policyPage.close();
|
|
1051
|
-
}
|
|
1052
|
-
catch (err) {
|
|
1053
|
-
console.warn('[policy-check] chrome://policy query failed:', err.message);
|
|
1054
|
-
}
|
|
1055
1040
|
}
|
|
1056
1041
|
return instance;
|
|
1057
1042
|
}
|