Skip to content

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

fix config round-trip for retained network bodies

Mario2490791f3c93
diff --git a/internal/config/config_file_json.go b/internal/config/config_file_json.go
index 969e7d82..34afe3ca 100644
--- a/internal/config/config_file_json.go
+++ b/internal/config/config_file_json.go
@@ -17,14 +17,16 @@ type fileConfigJSON struct {
}
type serverConfigJSON struct {
- Port string `json:"port"`
- Bind string `json:"bind"`
- Token string `json:"token"`
- StateDir string `json:"stateDir"`
- Engine string `json:"engine"`
- NetworkBufferSize *int `json:"networkBufferSize,omitempty"`
- TrustProxyHeaders *bool `json:"trustProxyHeaders,omitempty"`
- CookieSecure *bool `json:"cookieSecure,omitempty"`
+ Port string `json:"port"`
+ Bind string `json:"bind"`
+ Token string `json:"token"`
+ StateDir string `json:"stateDir"`
+ Engine string `json:"engine"`
+ NetworkBufferSize *int `json:"networkBufferSize,omitempty"`
+ RetainNetworkBodies *bool `json:"retainNetworkBodies,omitempty"`
+ RetainNetworkBodyMaxBytes *int `json:"retainNetworkBodyMaxBytes,omitempty"`
+ TrustProxyHeaders *bool `json:"trustProxyHeaders,omitempty"`
+ CookieSecure *bool `json:"cookieSecure,omitempty"`
}
type browserConfigJSON struct {
diff --git a/internal/config/config_file_marshal.go b/internal/config/config_file_marshal.go
index 8c8904cc..f9958a0a 100644
--- a/internal/config/config_file_marshal.go
+++ b/internal/config/config_file_marshal.go
@@ -57,14 +57,16 @@ func (fc FileConfig) MarshalJSON() ([]byte, error) {
Schema: fc.Schema,
ConfigVersion: fc.ConfigVersion,
Server: serverConfigJSON{
- Port: fc.Server.Port,
- Bind: fc.Server.Bind,
- Token: fc.Server.Token,
- StateDir: fc.Server.StateDir,
- Engine: fc.Server.Engine,
- NetworkBufferSize: fc.Server.NetworkBufferSize,
- TrustProxyHeaders: fc.Server.TrustProxyHeaders,
- CookieSecure: fc.Server.CookieSecure,
+ Port: fc.Server.Port,
+ Bind: fc.Server.Bind,
+ Token: fc.Server.Token,
+ StateDir: fc.Server.StateDir,
+ Engine: fc.Server.Engine,
+ NetworkBufferSize: fc.Server.NetworkBufferSize,
+ RetainNetworkBodies: fc.Server.RetainNetworkBodies,
+ RetainNetworkBodyMaxBytes: fc.Server.RetainNetworkBodyMaxBytes,
+ TrustProxyHeaders: fc.Server.TrustProxyHeaders,
+ CookieSecure: fc.Server.CookieSecure,
},
Browser: browserConfigJSON{
ChromeVersion: fc.Browser.ChromeVersion,
@@ -309,18 +311,22 @@ func FileConfigFromRuntime(cfg *RuntimeConfig) FileConfig {
v := cfg.NetworkBufferSize
netBufSize = &v
}
+ retainBodies := cfg.RetainNetworkBodies
+ retainBodyMaxBytes := cfg.RetainNetworkBodyMaxBytes
fc := FileConfig{
Schema: CurrentConfigSchemaURL(),
Server: ServerConfig{
- Port: cfg.Port,
- Bind: cfg.Bind,
- Token: cfg.Token,
- StateDir: cfg.StateDir,
- Engine: cfg.Engine,
- NetworkBufferSize: netBufSize,
- TrustProxyHeaders: &cfg.TrustProxyHeaders,
- CookieSecure: cfg.CookieSecure,
+ Port: cfg.Port,
+ Bind: cfg.Bind,
+ Token: cfg.Token,
+ StateDir: cfg.StateDir,
+ Engine: cfg.Engine,
+ NetworkBufferSize: netBufSize,
+ RetainNetworkBodies: &retainBodies,
+ RetainNetworkBodyMaxBytes: &retainBodyMaxBytes,
+ TrustProxyHeaders: &cfg.TrustProxyHeaders,
+ CookieSecure: cfg.CookieSecure,
},
Browser: BrowserConfig{
ChromeVersion: cfg.ChromeVersion,
diff --git a/internal/config/fileio_test.go b/internal/config/fileio_test.go
index 6ca64776..f9ca584c 100644
--- a/internal/config/fileio_test.go
+++ b/internal/config/fileio_test.go
@@ -24,6 +24,10 @@ func TestLoadAndSaveFileConfig(t *testing.T) {
// Modify
fc.Server.Port = "8080"
+ retainBodies := true
+ retainBytes := 262144
+ fc.Server.RetainNetworkBodies = &retainBodies
+ fc.Server.RetainNetworkBodyMaxBytes = &retainBytes
fc.InstanceDefaults.StealthLevel = "full"
// Save
@@ -40,6 +44,12 @@ func TestLoadAndSaveFileConfig(t *testing.T) {
if fc2.Server.Port != "8080" {
t.Errorf("loaded port = %v, want 8080", fc2.Server.Port)
}
+ if fc2.Server.RetainNetworkBodies == nil || !*fc2.Server.RetainNetworkBodies {
+ t.Errorf("loaded retainNetworkBodies = %v, want true", fc2.Server.RetainNetworkBodies)
+ }
+ if fc2.Server.RetainNetworkBodyMaxBytes == nil || *fc2.Server.RetainNetworkBodyMaxBytes != 262144 {
+ t.Errorf("loaded retainNetworkBodyMaxBytes = %v, want 262144", fc2.Server.RetainNetworkBodyMaxBytes)
+ }
if fc2.InstanceDefaults.StealthLevel != "full" {
t.Errorf("loaded stealthLevel = %v, want full", fc2.InstanceDefaults.StealthLevel)
}