autokap 1.3.23 → 1.3.25
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 +43 -0
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -929,6 +929,24 @@ export class Browser {
|
|
|
929
929
|
storageState: options.storageState,
|
|
930
930
|
};
|
|
931
931
|
instance.context = await instance.browser.newContext(contextOptions);
|
|
932
|
+
// Cloud Run only: inject the notranslate meta on every navigation so
|
|
933
|
+
// Chromium's translate UI never prompts. The --disable-features=Translate*
|
|
934
|
+
// launch flags are unreliable across Chromium versions (some translate
|
|
935
|
+
// surfaces are still gated by other features), but `<meta name="google"
|
|
936
|
+
// content="notranslate">` is Google's official, page-level opt-out
|
|
937
|
+
// mechanism — Chrome respects it regardless of feature flags. The
|
|
938
|
+
// `translate="no"` html attribute is the W3C standard backup. Both run
|
|
939
|
+
// BEFORE page scripts via addInitScript, so they're in the DOM by the
|
|
940
|
+
// time Chromium decides whether to show the translate bubble.
|
|
941
|
+
if (isLinuxWithGpu) {
|
|
942
|
+
await instance.context.addInitScript(() => {
|
|
943
|
+
const meta = document.createElement('meta');
|
|
944
|
+
meta.setAttribute('name', 'google');
|
|
945
|
+
meta.setAttribute('content', 'notranslate');
|
|
946
|
+
(document.head ?? document.documentElement).appendChild(meta);
|
|
947
|
+
document.documentElement.setAttribute('translate', 'no');
|
|
948
|
+
});
|
|
949
|
+
}
|
|
932
950
|
// Inject cursor overlay at context level — survives all navigations in this session
|
|
933
951
|
await instance.context.addInitScript(cursorScript);
|
|
934
952
|
// Also hide dev/prototype chrome on every document, including navigations
|
|
@@ -954,6 +972,31 @@ export class Browser {
|
|
|
954
972
|
}
|
|
955
973
|
}, { styleId: CAPTURE_HIDE_STYLE_ID, css: getCaptureHideCSS() });
|
|
956
974
|
instance.page = await instance.context.newPage();
|
|
975
|
+
// Cloud Run only: force the page window to fullscreen via CDP. The
|
|
976
|
+
// --kiosk launch flag is silently ignored by Chromium for windows
|
|
977
|
+
// created by Playwright via Target.createTarget (CDP) — kiosk only
|
|
978
|
+
// applies to the initial window opened by Chrome at startup, and
|
|
979
|
+
// Playwright doesn't open one (it uses --no-startup-window). Without
|
|
980
|
+
// explicit fullscreen, the CDP-created window has the full chrome UI
|
|
981
|
+
// (tab strip, address bar, omnibox, extension icons) which leaks into
|
|
982
|
+
// ffmpeg x11grab captures regardless of matchbox WM. Browser.setWindowBounds
|
|
983
|
+
// with windowState=fullscreen hides the chrome from the page side and
|
|
984
|
+
// matchbox honors the fullscreen request on the X side.
|
|
985
|
+
if (isLinuxWithGpu) {
|
|
986
|
+
try {
|
|
987
|
+
const cdp = await instance.context.newCDPSession(instance.page);
|
|
988
|
+
const { windowId } = await cdp.send('Browser.getWindowForTarget');
|
|
989
|
+
await cdp.send('Browser.setWindowBounds', {
|
|
990
|
+
windowId,
|
|
991
|
+
bounds: { windowState: 'fullscreen' },
|
|
992
|
+
});
|
|
993
|
+
logger.info(`[capture] Cloud clip capture: window ${windowId} forced to fullscreen via CDP`);
|
|
994
|
+
await cdp.detach().catch(() => undefined);
|
|
995
|
+
}
|
|
996
|
+
catch (err) {
|
|
997
|
+
logger.warn(`[capture] Cloud clip capture: CDP fullscreen request failed: ${err.message}`);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
957
1000
|
// Cloud Run only: query the WebGL UNMASKED_RENDERER_WEBGL string once
|
|
958
1001
|
// per browser launch and log it. This is the source of truth for which
|
|
959
1002
|
// GPU backend Chromium picked — flag combinations alone are not enough,
|