getobsrv 0.14.0 → 0.14.1

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/out/main/cli.js CHANGED
@@ -3,7 +3,7 @@ const electron = require("electron");
3
3
  const node_fs = require("node:fs");
4
4
  const node_os = require("node:os");
5
5
  const node_path = require("node:path");
6
- const targetSource = require("./targetSource-W6YddYef.js");
6
+ const targetSource = require("./targetSource-BNB1X7ds.js");
7
7
  function boxDownsample(src, factor) {
8
8
  if (!Number.isInteger(factor) || factor < 1) throw new RangeError("factor must be an integer >= 1");
9
9
  const width = Math.floor(src.width / factor);
@@ -256,7 +256,7 @@ ${usage()}`);
256
256
  return { command, url, spec, profileId, outDir, waitMs, timeoutMs };
257
257
  }
258
258
  const sleep$1 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
259
- const DEFAULT_SETTLE_MS = 400;
259
+ const DEFAULT_SETTLE_MS = targetSource.SETTLE_QUIET_MS;
260
260
  function uncoveredBounds(mask, width, height) {
261
261
  const rowHasGap = (y) => {
262
262
  const row = y * width;
package/out/main/index.js CHANGED
@@ -4,7 +4,7 @@ const node_fs = require("node:fs");
4
4
  const promises = require("node:fs/promises");
5
5
  const node_path = require("node:path");
6
6
  const node_crypto = require("node:crypto");
7
- const targetSource = require("./targetSource-W6YddYef.js");
7
+ const targetSource = require("./targetSource-BNB1X7ds.js");
8
8
  const node_http = require("node:http");
9
9
  const node_url = require("node:url");
10
10
  const MAX_SCROLL_SELECTOR = 512;
@@ -999,6 +999,7 @@ function registerIpc(ctx) {
999
999
  const SETTLE_STABLE_READS = 2;
1000
1000
  const SETTLE_BUDGET_MS = 4e3;
1001
1001
  const SETTLE_DRAW_MS = 120;
1002
+ const SETTLE_QUIET_BUDGET_MS = 3e3;
1002
1003
  const nextFrame = (t, budgetMs) => new Promise((resolve) => {
1003
1004
  if (!t.painting) {
1004
1005
  resolve(false);
@@ -1016,6 +1017,26 @@ function registerIpc(ctx) {
1016
1017
  t.on("frame", onFrame);
1017
1018
  t.invalidate();
1018
1019
  });
1020
+ const quiesce = (t, budgetMs) => new Promise((resolve) => {
1021
+ if (!t.painting) {
1022
+ resolve(false);
1023
+ return;
1024
+ }
1025
+ let quiet;
1026
+ const done = (ok) => {
1027
+ clearTimeout(quiet);
1028
+ clearTimeout(cap);
1029
+ t.off("frame", onFrame);
1030
+ resolve(ok);
1031
+ };
1032
+ const onFrame = () => {
1033
+ clearTimeout(quiet);
1034
+ quiet = setTimeout(() => done(true), targetSource.SETTLE_QUIET_MS);
1035
+ };
1036
+ const cap = setTimeout(() => done(false), budgetMs);
1037
+ t.on("frame", onFrame);
1038
+ quiet = setTimeout(() => done(true), targetSource.SETTLE_QUIET_MS);
1039
+ });
1019
1040
  const settleTarget = async (t = tab().target) => {
1020
1041
  const deadline = Date.now() + SETTLE_BUDGET_MS;
1021
1042
  let last = "";
@@ -1028,10 +1049,11 @@ function registerIpc(ctx) {
1028
1049
  if (stable >= SETTLE_STABLE_READS) break;
1029
1050
  await new Promise((r) => setTimeout(r, SETTLE_POLL_MS));
1030
1051
  }
1031
- if (stable < SETTLE_STABLE_READS) return false;
1052
+ if (stable < SETTLE_STABLE_READS) return "resizing";
1032
1053
  const painted = await nextFrame(t, Math.max(0, deadline - Date.now()));
1054
+ const quiet = painted && await quiesce(t, SETTLE_QUIET_BUDGET_MS);
1033
1055
  await new Promise((r) => setTimeout(r, SETTLE_DRAW_MS));
1034
- return painted;
1056
+ return quiet ? "settled" : "painting";
1035
1057
  };
1036
1058
  const roundRect = (r) => ({
1037
1059
  x: Math.round(r.x),
@@ -1260,7 +1282,8 @@ function registerIpc(ctx) {
1260
1282
  const warnings = [];
1261
1283
  if (!known) warnings.push("the renderer has not reported the pane bounds yet; captured the full window instead");
1262
1284
  else if (canvasBounds === null) warnings.push("the renderer has not reported the render bounds yet; captured the whole pane instead");
1263
- if (!settled) warnings.push("the target was still resizing when the capture budget ran out; the PNG may show a transitional frame");
1285
+ if (settled === "resizing") warnings.push("the target was still resizing when the capture budget ran out; the PNG may show a transitional frame");
1286
+ else if (settled === "painting") warnings.push("the page was still painting when the capture budget ran out; the PNG may show a transitional frame — an animation, or a load that had not finished");
1264
1287
  return {
1265
1288
  data: image.toPNG().toString("base64"),
1266
1289
  width: size.width,
@@ -88,6 +88,7 @@ function isFullFrame(dirty, frameWidth, frameHeight, deviceScaleFactor) {
88
88
  function fitsFrame(dirty, frameWidth, frameHeight) {
89
89
  return dirty.x >= 0 && dirty.y >= 0 && dirty.width > 0 && dirty.height > 0 && dirty.x + dirty.width <= frameWidth && dirty.y + dirty.height <= frameHeight;
90
90
  }
91
+ const SETTLE_QUIET_MS = 400;
91
92
  const SCHEME = /^[a-z][a-z0-9+.-]*:/i;
92
93
  const LOOPBACK = /^(localhost|127\.0\.0\.1|\[::1\])(:\d+)?(\/|$)/i;
93
94
  function normalizeUrl(input) {
@@ -427,6 +428,7 @@ exports.MAX_TABS_MAX = MAX_TABS_MAX;
427
428
  exports.MAX_TABS_MIN = MAX_TABS_MIN;
428
429
  exports.PANEL_PROFILES = PANEL_PROFILES;
429
430
  exports.SCREEN_PRESETS = SCREEN_PRESETS;
431
+ exports.SETTLE_QUIET_MS = SETTLE_QUIET_MS;
430
432
  exports.SPLIT_MAX = SPLIT_MAX;
431
433
  exports.SPLIT_MIN = SPLIT_MIN;
432
434
  exports.TargetSource = TargetSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getobsrv",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "See your site the way 1x screens see it",
5
5
  "main": "./out/main/index.js",
6
6
  "bin": {