Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: K11 file output honors path param + blockImages applied on CreateTab

botdda68e8a8f38
diff --git a/bridge.go b/bridge.go
index 253dd4c6..15b5b166 100644
--- a/bridge.go
+++ b/bridge.go
@@ -171,6 +171,13 @@ func (b *Bridge) CreateTab(url string) (string, context.Context, context.CancelF
// Inject stealth script before navigation so it applies to the first page load
b.injectStealth(ctx)
+ // Apply global resource blocking on new tabs
+ if blockMedia {
+ _ = setResourceBlocking(ctx, mediaBlockPatterns)
+ } else if blockImages {
+ _ = setResourceBlocking(ctx, imageBlockPatterns)
+ }
+
navURL := "about:blank"
if url != "" {
navURL = url
diff --git a/handler_snapshot.go b/handler_snapshot.go
index 44935ea1..992c40b2 100644
--- a/handler_snapshot.go
+++ b/handler_snapshot.go
@@ -22,6 +22,7 @@ func (b *Bridge) handleSnapshot(w http.ResponseWriter, r *http.Request) {
doDiff := r.URL.Query().Get("diff") == "true"
format := r.URL.Query().Get("format") // "text" for indented tree
output := r.URL.Query().Get("output") // "file" to save to disk
+ outputPath := r.URL.Query().Get("path") // custom file path for output=file
maxDepthStr := r.URL.Query().Get("depth")
maxDepth := -1
if maxDepthStr != "" {
@@ -157,8 +158,16 @@ func (b *Bridge) handleSnapshot(w http.ResponseWriter, r *http.Request) {
}
}
- // Write to file
+ // Write to file — use custom path if provided, otherwise default
filePath := filepath.Join(snapshotDir, filename)
+ if outputPath != "" {
+ filePath = outputPath
+ // Ensure parent directory exists for custom paths
+ if err := os.MkdirAll(filepath.Dir(filePath), 0755); err != nil {
+ jsonErr(w, 500, fmt.Errorf("create output dir: %w", err))
+ return
+ }
+ }
if err := os.WriteFile(filePath, content, 0644); err != nil {
jsonErr(w, 500, fmt.Errorf("write snapshot: %w", err))
return