← Commit history

fusion live-proof snap via hwnd chain (state capture too big for inline)

John Lauer ·fb9a33c024 ·2mo ago ·parent 0f667ee
1 file changed +20−5
web-control-demo.html+20−5
@@ -454,15 +454,30 @@ for (const w of mine) {       function maybeSnap(label) {         if (!cfg.snap || snapBusy) return;         snapBusy = true;+        var done = function () { snapBusy = false; };+        var pin = function (img, title) { addShot(c.card, img, "live: " + label); clog(c, "  [proof] captured \"" + (title || label) + "\""); };+        if (cfg.snap.viaHwnd) {+          // fusion_state's own screenshot exceeds the 4MB inline cap (it comes+          // back as a PATH on the far machine), so snap via the hwnd instead:+          // state verb -> hwnd -> desktop_screenshot_base64 (always inline).+          postVerb(cfg.snap.viaHwnd, { screenshot: false }, target).then(function (wr) {+            var wd = (wr.j && (wr.j.data || wr.j)) || {};+            if (!wd.hwnd) { done(); return; }+            return postVerb("desktop_screenshot_base64", { hwnd: wd.hwnd, maxWidth: 640 }, target).then(function (sh) {+              done();+              if (sh.s === 200 && sh.j && sh.j.image) pin(sh.j.image, wd.title);+            });+          }).catch(done);+          return;+        }         postVerb(cfg.snap.cmd, Object.assign({}, cfg.snap.args || {}), target).then(function (sr) {-          snapBusy = false;+          done();           if (!(sr.s === 200 && sr.j)) return;           var withImg = findShots(sr.j).filter(function (s) { return s && (s.image || s.base64 || s.png); });           if (!withImg.length) return;           var s = withImg[withImg.length - 1]; // the newest window is the step's surface-          addShot(c.card, s.image || s.base64 || s.png, "live: " + label);-          clog(c, "  [proof] captured \"" + (s.title || label) + "\"");-        }).catch(function () { snapBusy = false; });+          pin(s.image || s.base64 || s.png, s.title);+        }).catch(done);       }       // 2) Poll progress every 2.5s (the Allow-1hr grant makes these silent).       var polls = 0, maxPolls = 240; // ~10 min ceiling@@ -743,7 +758,7 @@ for (const w of mine) {       pollCmd: "fusion_demo_progress", pollArgs: {},       idFrom: "demoId", idAs: "demoId",       stateCmd: "fusion_state",-      snap: { cmd: "fusion_state", args: { screenshot: true, imageAs: "base64", maxWidth: 640 } }+      snap: { viaHwnd: "fusion_state" }     });   };   // ---- The wiki part every surface button shows: Inolux IN-S42ATR ----