fix: refresh occluded browser windows before plugin capture

This commit is contained in:
chenmingxuan committed 2026-10-14 20:17:59 +08:00
1 parent 254ce4ffb3
commit 86dab41947
6 files changed
+127 -8

No files matched your search

+23 -1
View File
@@ -71,6 +71,25 @@ def build_windows(
"screenshotPngBase64 = Capture-WindowPngBase64 $bounds",
"screenshotPngBase64 = Capture-WindowPngBase64 $bounds ([IntPtr]$process.MainWindowHandle)",
)
snapshot_start = runtime.index("function Build-Snapshot(")
snapshot_end = runtime.index("function List-Apps", snapshot_start)
runtime = (
runtime[:snapshot_start]
+ adapter.with_name("window-snapshot.ps1").read_text(encoding="utf-8")
+ "\n\n"
+ runtime[snapshot_end:]
)
runtime = runtime.replace(
marker,
marker
+ """
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr after, int x, int y, int w, int height, uint flags);
[DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr h, int index);
[DllImport("user32.dll")] public static extern IntPtr GetWindow(IntPtr h, uint command);
[DllImport("user32.dll")] public static extern bool IsWindow(IntPtr h);
[DllImport("dwmapi.dll")] public static extern int DwmFlush();
""",
)
files["runtime.ps1"] = runtime.encode("utf-8")
# Advertise only methods this Windows runtime actually implements.
main = files["main.go"].decode("utf-8")
@@ -101,7 +120,7 @@ def build_windows(
"build",
"-trimpath",
"-buildvcs=false",
"-ldflags=-s -w -X main.version=1.1.0-artemis.1",
"-ldflags=-s -w -X main.version=1.1.0-artemis.2",
"-o",
str(output),
".",
@@ -168,6 +187,9 @@ def main():
source / "window-capture.ps1", "source/artemis-window-capture.ps1"
)
archive.write(source / "window-input.ps1", "source/artemis-window-input.ps1")
archive.write(
source / "window-snapshot.ps1", "source/artemis-window-snapshot.ps1"
)
archive.writestr(
"provenance.json",
json.dumps(