refactor(config): remove unused video acceleration and codec preference config
- commit
- 6bf5e054faa676b9740edd225850f5063d70f59a
- author
- brice · · 2025-12-18 17:21 UTC
- parent
- ef844de
- signature
- unsigned
5 files · +13 -270
M internal/infrastructure/config/defaults.go +4 -47
| @@ -10,9 +10,7 @@ const ( | |||
| 10 | 10 | defaultMaxHistoryItems = 20 // items | |
| 11 | 11 | ||
| 12 | 12 | // Logging defaults | |
| 13 | - | defaultMaxLogSizeMB = 100 // MB | |
| 14 | - | defaultMaxBackups = 3 // backup files | |
| 15 | - | defaultMaxLogAgeDays = 7 // days | |
| 13 | + | defaultMaxLogAgeDays = 7 // days | |
| 16 | 14 | ||
| 17 | 15 | // Appearance defaults | |
| 18 | 16 | defaultFontSize = 16 // points | |
| @@ -80,20 +78,11 @@ func DefaultConfig() *Config { | |||
| 80 | 78 | }, | |
| 81 | 79 | Logging: LoggingConfig{ | |
| 82 | 80 | Level: "info", | |
| 83 | - | Format: "text", // text or json | |
| 84 | - | Filename: "", // empty means stdout | |
| 85 | - | MaxSize: defaultMaxLogSizeMB, // MB | |
| 86 | - | MaxBackups: defaultMaxBackups, | |
| 87 | - | MaxAge: defaultMaxLogAgeDays, // days | |
| 88 | - | Compress: true, | |
| 81 | + | Format: "text", // text or json | |
| 82 | + | MaxAge: defaultMaxLogAgeDays, | |
| 89 | 83 | LogDir: getDefaultLogDir(), | |
| 90 | 84 | EnableFileLog: true, | |
| 91 | - | CaptureStdout: false, | |
| 92 | - | CaptureStderr: false, | |
| 93 | - | CaptureCOutput: false, // Disabled by default to avoid performance impact | |
| 94 | 85 | CaptureConsole: false, // Disabled by default | |
| 95 | - | DebugFile: "debug.log", | |
| 96 | - | VerboseWebKit: false, | |
| 97 | 86 | }, | |
| 98 | 87 | Appearance: AppearanceConfig{ | |
| 99 | 88 | SansFont: "Fira Sans", | |
| @@ -120,40 +109,8 @@ func DefaultConfig() *Config { | |||
| 120 | 109 | }, | |
| 121 | 110 | ColorScheme: "default", // default follows system theme | |
| 122 | 111 | }, | |
| 123 | - | VideoAcceleration: VideoAccelerationConfig{ | |
| 124 | - | EnableVAAPI: true, | |
| 125 | - | AutoDetectGPU: true, | |
| 126 | - | VAAPIDriverName: "", // TODO: implement in Step 18 - will be auto-detected | |
| 127 | - | EnableAllDrivers: true, | |
| 128 | - | LegacyVAAPI: false, | |
| 129 | - | }, | |
| 130 | - | CodecPreferences: CodecConfig{ | |
| 131 | - | PreferredCodecs: "av1,h264", // AV1 first, but allow VP9 fallback for higher resolutions | |
| 132 | - | ForceAV1: false, // Use smart AV1 negotiation instead of forcing | |
| 133 | - | BlockVP9: false, // Allow VP9 for higher resolutions | |
| 134 | - | BlockVP8: false, // Allow VP8 fallback for ad segments (lower priority) | |
| 135 | - | AV1HardwareOnly: false, // Allow software AV1 fallback | |
| 136 | - | DisableVP9Hardware: false, // Allow VP9 hardware for high res content | |
| 137 | - | VideoBufferSizeMB: 64, // Larger buffer for bursty Twitch/AV1 segments | |
| 138 | - | QueueBufferTimeSec: 20, // More buffering time for smooth playback | |
| 139 | - | CustomUserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15", // WebKitGTK default (same as Epiphany) | |
| 140 | - | AV1MaxResolution: "1080p", // Optimal AV1 up to 1080p, fallback to VP9 for higher res | |
| 141 | - | DisableTwitchCodecControl: true, // Disable codec control on Twitch by default (prevents theater/fullscreen freezing) | |
| 142 | - | }, | |
| 143 | 112 | Debug: DebugConfig{ | |
| 144 | - | EnableDevTools: true, | |
| 145 | - | EnableWebKitDebug: false, | |
| 146 | - | WebKitDebugCategories: "Network:preconnectTo,ContentFilters", | |
| 147 | - | EnableFilteringDebug: false, | |
| 148 | - | EnableWebViewDebug: false, | |
| 149 | - | LogWebKitCrashes: true, // Always log crashes | |
| 150 | - | EnableScriptDebug: false, | |
| 151 | - | EnableGeneralDebug: false, | |
| 152 | - | EnableWorkspaceDebug: false, | |
| 153 | - | EnableFocusDebug: false, | |
| 154 | - | EnableCSSDebug: false, | |
| 155 | - | EnableFocusMetrics: false, | |
| 156 | - | EnablePaneCloseDebug: false, | |
| 113 | + | EnableDevTools: true, | |
| 157 | 114 | }, | |
| 158 | 115 | RenderingMode: RenderingModeGPU, | |
| 159 | 116 | DefaultWebpageZoom: 1.2, // 120% default zoom for better readability | |
| @@ -10,9 +10,7 @@ const ( | |||||
| 10 | defaultMaxHistoryItems = 20 // items | 10 | defaultMaxHistoryItems = 20 // items | ||
| 11 | 11 | ||||
| 12 | // Logging defaults | 12 | // Logging defaults | ||
| 13 | - | defaultMaxLogSizeMB = 100 // MB | 13 | + | defaultMaxLogAgeDays = 7 // days |
| 14 | - | defaultMaxBackups = 3 // backup files | |||
| 15 | - | defaultMaxLogAgeDays = 7 // days | |||
| 16 | 14 | ||||
| 17 | // Appearance defaults | 15 | // Appearance defaults | ||
| 18 | defaultFontSize = 16 // points | 16 | defaultFontSize = 16 // points | ||
| @@ -80,20 +78,11 @@ func DefaultConfig() *Config { | |||||
| 80 | }, | 78 | }, | ||
| 81 | Logging: LoggingConfig{ | 79 | Logging: LoggingConfig{ | ||
| 82 | Level: "info", | 80 | Level: "info", | ||
| 83 | - | Format: "text", // text or json | 81 | + | Format: "text", // text or json |
| 84 | - | Filename: "", // empty means stdout | 82 | + | MaxAge: defaultMaxLogAgeDays, |
| 85 | - | MaxSize: defaultMaxLogSizeMB, // MB | |||
| 86 | - | MaxBackups: defaultMaxBackups, | |||
| 87 | - | MaxAge: defaultMaxLogAgeDays, // days | |||
| 88 | - | Compress: true, | |||
| 89 | LogDir: getDefaultLogDir(), | 83 | LogDir: getDefaultLogDir(), | ||
| 90 | EnableFileLog: true, | 84 | EnableFileLog: true, | ||
| 91 | - | CaptureStdout: false, | |||
| 92 | - | CaptureStderr: false, | |||
| 93 | - | CaptureCOutput: false, // Disabled by default to avoid performance impact | |||
| 94 | CaptureConsole: false, // Disabled by default | 85 | CaptureConsole: false, // Disabled by default | ||
| 95 | - | DebugFile: "debug.log", | |||
| 96 | - | VerboseWebKit: false, | |||
| 97 | }, | 86 | }, | ||
| 98 | Appearance: AppearanceConfig{ | 87 | Appearance: AppearanceConfig{ | ||
| 99 | SansFont: "Fira Sans", | 88 | SansFont: "Fira Sans", | ||
| @@ -120,40 +109,8 @@ func DefaultConfig() *Config { | |||||
| 120 | }, | 109 | }, | ||
| 121 | ColorScheme: "default", // default follows system theme | 110 | ColorScheme: "default", // default follows system theme | ||
| 122 | }, | 111 | }, | ||
| 123 | - | VideoAcceleration: VideoAccelerationConfig{ | |||
| 124 | - | EnableVAAPI: true, | |||
| 125 | - | AutoDetectGPU: true, | |||
| 126 | - | VAAPIDriverName: "", // TODO: implement in Step 18 - will be auto-detected | |||
| 127 | - | EnableAllDrivers: true, | |||
| 128 | - | LegacyVAAPI: false, | |||
| 129 | - | }, | |||
| 130 | - | CodecPreferences: CodecConfig{ | |||
| 131 | - | PreferredCodecs: "av1,h264", // AV1 first, but allow VP9 fallback for higher resolutions | |||
| 132 | - | ForceAV1: false, // Use smart AV1 negotiation instead of forcing | |||
| 133 | - | BlockVP9: false, // Allow VP9 for higher resolutions | |||
| 134 | - | BlockVP8: false, // Allow VP8 fallback for ad segments (lower priority) | |||
| 135 | - | AV1HardwareOnly: false, // Allow software AV1 fallback | |||
| 136 | - | DisableVP9Hardware: false, // Allow VP9 hardware for high res content | |||
| 137 | - | VideoBufferSizeMB: 64, // Larger buffer for bursty Twitch/AV1 segments | |||
| 138 | - | QueueBufferTimeSec: 20, // More buffering time for smooth playback | |||
| 139 | - | CustomUserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15", // WebKitGTK default (same as Epiphany) | |||
| 140 | - | AV1MaxResolution: "1080p", // Optimal AV1 up to 1080p, fallback to VP9 for higher res | |||
| 141 | - | DisableTwitchCodecControl: true, // Disable codec control on Twitch by default (prevents theater/fullscreen freezing) | |||
| 142 | - | }, | |||
| 143 | Debug: DebugConfig{ | 112 | Debug: DebugConfig{ | ||
| 144 | - | EnableDevTools: true, | 113 | + | EnableDevTools: true, |
| 145 | - | EnableWebKitDebug: false, | |||
| 146 | - | WebKitDebugCategories: "Network:preconnectTo,ContentFilters", | |||
| 147 | - | EnableFilteringDebug: false, | |||
| 148 | - | EnableWebViewDebug: false, | |||
| 149 | - | LogWebKitCrashes: true, // Always log crashes | |||
| 150 | - | EnableScriptDebug: false, | |||
| 151 | - | EnableGeneralDebug: false, | |||
| 152 | - | EnableWorkspaceDebug: false, | |||
| 153 | - | EnableFocusDebug: false, | |||
| 154 | - | EnableCSSDebug: false, | |||
| 155 | - | EnableFocusMetrics: false, | |||
| 156 | - | EnablePaneCloseDebug: false, | |||
| 157 | }, | 114 | }, | ||
| 158 | RenderingMode: RenderingModeGPU, | 115 | RenderingMode: RenderingModeGPU, | ||
| 159 | DefaultWebpageZoom: 1.2, // 120% default zoom for better readability | 116 | DefaultWebpageZoom: 1.2, // 120% default zoom for better readability | ||
M internal/infrastructure/config/loader.go +0 -90
| @@ -56,44 +56,6 @@ func NewManager() (*Manager, error) { | |||
| 56 | 56 | return nil, fmt.Errorf("failed to bind DUMBER_DEFAULT_UI_SCALE: %w", err) | |
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | - | // Video acceleration environment variable bindings | |
| 60 | - | // These use system-standard env vars (LIBVA_*, GST_*, WEBKIT_*) and DUMBER_* prefix | |
| 61 | - | videoAccelEnvBindings := map[string]string{ | |
| 62 | - | "video_acceleration.enable_vaapi": "DUMBER_VIDEO_ACCELERATION_ENABLE", | |
| 63 | - | "video_acceleration.auto_detect_gpu": "DUMBER_VIDEO_AUTO_DETECT", | |
| 64 | - | "video_acceleration.vaapi_driver_name": "LIBVA_DRIVER_NAME", | |
| 65 | - | "video_acceleration.enable_all_drivers": "GST_VAAPI_ALL_DRIVERS", | |
| 66 | - | "video_acceleration.legacy_vaapi": "WEBKIT_GST_ENABLE_LEGACY_VAAPI", | |
| 67 | - | } | |
| 68 | - | ||
| 69 | - | for key, env := range videoAccelEnvBindings { | |
| 70 | - | if err := v.BindEnv(key, env); err != nil { | |
| 71 | - | return nil, fmt.Errorf("failed to bind environment variable %s: %w", env, err) | |
| 72 | - | } | |
| 73 | - | } | |
| 74 | - | ||
| 75 | - | // Codec preferences environment variable bindings | |
| 76 | - | // These use DUMBER_* prefix for shorter, more convenient env var names | |
| 77 | - | codecEnvBindings := map[string]string{ | |
| 78 | - | "codec_preferences.preferred_codecs": "DUMBER_PREFERRED_CODECS", | |
| 79 | - | "codec_preferences.force_av1": "DUMBER_FORCE_AV1", | |
| 80 | - | "codec_preferences.block_vp9": "DUMBER_BLOCK_VP9", | |
| 81 | - | "codec_preferences.block_vp8": "DUMBER_BLOCK_VP8", | |
| 82 | - | "codec_preferences.av1_hardware_only": "DUMBER_AV1_HW_ONLY", | |
| 83 | - | "codec_preferences.disable_vp9_hardware": "DUMBER_DISABLE_VP9_HW", | |
| 84 | - | "codec_preferences.video_buffer_size_mb": "DUMBER_VIDEO_BUFFER_MB", | |
| 85 | - | "codec_preferences.queue_buffer_time_sec": "DUMBER_QUEUE_BUFFER_SEC", | |
| 86 | - | "codec_preferences.custom_user_agent": "DUMBER_CUSTOM_UA", | |
| 87 | - | "codec_preferences.av1_max_resolution": "DUMBER_AV1_MAX_RES", | |
| 88 | - | "codec_preferences.disable_twitch_codec_control": "DUMBER_DISABLE_TWITCH_CODEC", | |
| 89 | - | } | |
| 90 | - | ||
| 91 | - | for key, env := range codecEnvBindings { | |
| 92 | - | if err := v.BindEnv(key, env); err != nil { | |
| 93 | - | return nil, fmt.Errorf("failed to bind environment variable %s: %w", env, err) | |
| 94 | - | } | |
| 95 | - | } | |
| 96 | - | ||
| 97 | 59 | // Logging environment variable bindings | |
| 98 | 60 | if err := v.BindEnv("logging.level", "DUMBER_LOG_LEVEL"); err != nil { | |
| 99 | 61 | return nil, fmt.Errorf("failed to bind DUMBER_LOG_LEVEL: %w", err) | |
| @@ -172,17 +134,6 @@ func (m *Manager) Load() error { | |||
| 172 | 134 | config.RenderingMode = RenderingModeAuto | |
| 173 | 135 | } | |
| 174 | 136 | ||
| 175 | - | // TODO: implement in Step 18 - Auto-detect GPU if enabled and driver name is not set | |
| 176 | - | // if config.VideoAcceleration.AutoDetectGPU && config.VideoAcceleration.VAAPIDriverName == "" { | |
| 177 | - | // gpuInfo := gpu.DetectGPU() | |
| 178 | - | // if gpuInfo.SupportsVAAPI() { | |
| 179 | - | // config.VideoAcceleration.VAAPIDriverName = gpuInfo.GetVAAPIDriverName() | |
| 180 | - | // } | |
| 181 | - | // } | |
| 182 | - | ||
| 183 | - | // TODO: implement in Step 18 - Validate and configure codec preferences based on GPU | |
| 184 | - | // config = m.validateAndConfigureCodecPreferences(config) | |
| 185 | - | ||
| 186 | 137 | // Validate ColorScheme setting using switch statement | |
| 187 | 138 | switch config.Appearance.ColorScheme { | |
| 188 | 139 | case "prefer-dark", "prefer-light", ThemeDefault: | |
| @@ -270,34 +221,13 @@ func (m *Manager) setDefaults() { | |||
| 270 | 221 | // Logging defaults | |
| 271 | 222 | m.viper.SetDefault("logging.level", defaults.Logging.Level) | |
| 272 | 223 | m.viper.SetDefault("logging.format", defaults.Logging.Format) | |
| 273 | - | m.viper.SetDefault("logging.filename", defaults.Logging.Filename) | |
| 274 | - | m.viper.SetDefault("logging.max_size", defaults.Logging.MaxSize) | |
| 275 | - | m.viper.SetDefault("logging.max_backups", defaults.Logging.MaxBackups) | |
| 276 | 224 | m.viper.SetDefault("logging.max_age", defaults.Logging.MaxAge) | |
| 277 | - | m.viper.SetDefault("logging.compress", defaults.Logging.Compress) | |
| 278 | 225 | m.viper.SetDefault("logging.log_dir", defaults.Logging.LogDir) | |
| 279 | 226 | m.viper.SetDefault("logging.enable_file_log", defaults.Logging.EnableFileLog) | |
| 280 | - | m.viper.SetDefault("logging.capture_stdout", defaults.Logging.CaptureStdout) | |
| 281 | - | m.viper.SetDefault("logging.capture_stderr", defaults.Logging.CaptureStderr) | |
| 282 | - | m.viper.SetDefault("logging.capture_c_output", defaults.Logging.CaptureCOutput) | |
| 283 | 227 | m.viper.SetDefault("logging.capture_console", defaults.Logging.CaptureConsole) | |
| 284 | - | m.viper.SetDefault("logging.debug_file", defaults.Logging.DebugFile) | |
| 285 | - | m.viper.SetDefault("logging.verbose_webkit", defaults.Logging.VerboseWebKit) | |
| 286 | 228 | ||
| 287 | 229 | // Debug defaults | |
| 288 | 230 | m.viper.SetDefault("debug.enable_devtools", defaults.Debug.EnableDevTools) | |
| 289 | - | m.viper.SetDefault("debug.enable_webkit_debug", defaults.Debug.EnableWebKitDebug) | |
| 290 | - | m.viper.SetDefault("debug.webkit_debug_categories", defaults.Debug.WebKitDebugCategories) | |
| 291 | - | m.viper.SetDefault("debug.enable_filtering_debug", defaults.Debug.EnableFilteringDebug) | |
| 292 | - | m.viper.SetDefault("debug.enable_webview_debug", defaults.Debug.EnableWebViewDebug) | |
| 293 | - | m.viper.SetDefault("debug.log_webkit_crashes", defaults.Debug.LogWebKitCrashes) | |
| 294 | - | m.viper.SetDefault("debug.enable_script_debug", defaults.Debug.EnableScriptDebug) | |
| 295 | - | m.viper.SetDefault("debug.enable_general_debug", defaults.Debug.EnableGeneralDebug) | |
| 296 | - | m.viper.SetDefault("debug.enable_workspace_debug", defaults.Debug.EnableWorkspaceDebug) | |
| 297 | - | m.viper.SetDefault("debug.enable_focus_debug", defaults.Debug.EnableFocusDebug) | |
| 298 | - | m.viper.SetDefault("debug.enable_css_debug", defaults.Debug.EnableCSSDebug) | |
| 299 | - | m.viper.SetDefault("debug.enable_focus_metrics", defaults.Debug.EnableFocusMetrics) | |
| 300 | - | m.viper.SetDefault("debug.enable_pane_close_debug", defaults.Debug.EnablePaneCloseDebug) | |
| 301 | 231 | ||
| 302 | 232 | // Appearance defaults | |
| 303 | 233 | m.viper.SetDefault("appearance.sans_font", defaults.Appearance.SansFont) | |
| @@ -308,26 +238,6 @@ func (m *Manager) setDefaults() { | |||
| 308 | 238 | m.viper.SetDefault("appearance.dark_palette", defaults.Appearance.DarkPalette) | |
| 309 | 239 | m.viper.SetDefault("appearance.color_scheme", defaults.Appearance.ColorScheme) | |
| 310 | 240 | ||
| 311 | - | // Video acceleration defaults | |
| 312 | - | m.viper.SetDefault("video_acceleration.enable_vaapi", defaults.VideoAcceleration.EnableVAAPI) | |
| 313 | - | m.viper.SetDefault("video_acceleration.auto_detect_gpu", defaults.VideoAcceleration.AutoDetectGPU) | |
| 314 | - | m.viper.SetDefault("video_acceleration.vaapi_driver_name", defaults.VideoAcceleration.VAAPIDriverName) | |
| 315 | - | m.viper.SetDefault("video_acceleration.enable_all_drivers", defaults.VideoAcceleration.EnableAllDrivers) | |
| 316 | - | m.viper.SetDefault("video_acceleration.legacy_vaapi", defaults.VideoAcceleration.LegacyVAAPI) | |
| 317 | - | ||
| 318 | - | // Codec preferences defaults | |
| 319 | - | m.viper.SetDefault("codec_preferences.preferred_codecs", defaults.CodecPreferences.PreferredCodecs) | |
| 320 | - | m.viper.SetDefault("codec_preferences.force_av1", defaults.CodecPreferences.ForceAV1) | |
| 321 | - | m.viper.SetDefault("codec_preferences.block_vp9", defaults.CodecPreferences.BlockVP9) | |
| 322 | - | m.viper.SetDefault("codec_preferences.block_vp8", defaults.CodecPreferences.BlockVP8) | |
| 323 | - | m.viper.SetDefault("codec_preferences.av1_hardware_only", defaults.CodecPreferences.AV1HardwareOnly) | |
| 324 | - | m.viper.SetDefault("codec_preferences.disable_vp9_hardware", defaults.CodecPreferences.DisableVP9Hardware) | |
| 325 | - | m.viper.SetDefault("codec_preferences.video_buffer_size_mb", defaults.CodecPreferences.VideoBufferSizeMB) | |
| 326 | - | m.viper.SetDefault("codec_preferences.queue_buffer_time_sec", defaults.CodecPreferences.QueueBufferTimeSec) | |
| 327 | - | m.viper.SetDefault("codec_preferences.custom_user_agent", defaults.CodecPreferences.CustomUserAgent) | |
| 328 | - | m.viper.SetDefault("codec_preferences.av1_max_resolution", defaults.CodecPreferences.AV1MaxResolution) | |
| 329 | - | m.viper.SetDefault("codec_preferences.disable_twitch_codec_control", defaults.CodecPreferences.DisableTwitchCodecControl) | |
| 330 | - | ||
| 331 | 241 | // Rendering defaults | |
| 332 | 242 | m.viper.SetDefault("rendering_mode", string(RenderingModeGPU)) | |
| 333 | 243 | m.viper.SetDefault("default_webpage_zoom", defaults.DefaultWebpageZoom) | |
| @@ -56,44 +56,6 @@ func NewManager() (*Manager, error) { | |||||
| 56 | return nil, fmt.Errorf("failed to bind DUMBER_DEFAULT_UI_SCALE: %w", err) | 56 | return nil, fmt.Errorf("failed to bind DUMBER_DEFAULT_UI_SCALE: %w", err) | ||
| 57 | } | 57 | } | ||
| 58 | 58 | ||||
| 59 | - | // Video acceleration environment variable bindings | |||
| 60 | - | // These use system-standard env vars (LIBVA_*, GST_*, WEBKIT_*) and DUMBER_* prefix | |||
| 61 | - | videoAccelEnvBindings := map[string]string{ | |||
| 62 | - | "video_acceleration.enable_vaapi": "DUMBER_VIDEO_ACCELERATION_ENABLE", | |||
| 63 | - | "video_acceleration.auto_detect_gpu": "DUMBER_VIDEO_AUTO_DETECT", | |||
| 64 | - | "video_acceleration.vaapi_driver_name": "LIBVA_DRIVER_NAME", | |||
| 65 | - | "video_acceleration.enable_all_drivers": "GST_VAAPI_ALL_DRIVERS", | |||
| 66 | - | "video_acceleration.legacy_vaapi": "WEBKIT_GST_ENABLE_LEGACY_VAAPI", | |||
| 67 | - | } | |||
| 68 | - | ||||
| 69 | - | for key, env := range videoAccelEnvBindings { | |||
| 70 | - | if err := v.BindEnv(key, env); err != nil { | |||
| 71 | - | return nil, fmt.Errorf("failed to bind environment variable %s: %w", env, err) | |||
| 72 | - | } | |||
| 73 | - | } | |||
| 74 | - | ||||
| 75 | - | // Codec preferences environment variable bindings | |||
| 76 | - | // These use DUMBER_* prefix for shorter, more convenient env var names | |||
| 77 | - | codecEnvBindings := map[string]string{ | |||
| 78 | - | "codec_preferences.preferred_codecs": "DUMBER_PREFERRED_CODECS", | |||
| 79 | - | "codec_preferences.force_av1": "DUMBER_FORCE_AV1", | |||
| 80 | - | "codec_preferences.block_vp9": "DUMBER_BLOCK_VP9", | |||
| 81 | - | "codec_preferences.block_vp8": "DUMBER_BLOCK_VP8", | |||
| 82 | - | "codec_preferences.av1_hardware_only": "DUMBER_AV1_HW_ONLY", | |||
| 83 | - | "codec_preferences.disable_vp9_hardware": "DUMBER_DISABLE_VP9_HW", | |||
| 84 | - | "codec_preferences.video_buffer_size_mb": "DUMBER_VIDEO_BUFFER_MB", | |||
| 85 | - | "codec_preferences.queue_buffer_time_sec": "DUMBER_QUEUE_BUFFER_SEC", | |||
| 86 | - | "codec_preferences.custom_user_agent": "DUMBER_CUSTOM_UA", | |||
| 87 | - | "codec_preferences.av1_max_resolution": "DUMBER_AV1_MAX_RES", | |||
| 88 | - | "codec_preferences.disable_twitch_codec_control": "DUMBER_DISABLE_TWITCH_CODEC", | |||
| 89 | - | } | |||
| 90 | - | ||||
| 91 | - | for key, env := range codecEnvBindings { | |||
| 92 | - | if err := v.BindEnv(key, env); err != nil { | |||
| 93 | - | return nil, fmt.Errorf("failed to bind environment variable %s: %w", env, err) | |||
| 94 | - | } | |||
| 95 | - | } | |||
| 96 | - | ||||
| 97 | // Logging environment variable bindings | 59 | // Logging environment variable bindings | ||
| 98 | if err := v.BindEnv("logging.level", "DUMBER_LOG_LEVEL"); err != nil { | 60 | if err := v.BindEnv("logging.level", "DUMBER_LOG_LEVEL"); err != nil { | ||
| 99 | return nil, fmt.Errorf("failed to bind DUMBER_LOG_LEVEL: %w", err) | 61 | return nil, fmt.Errorf("failed to bind DUMBER_LOG_LEVEL: %w", err) | ||
| @@ -172,17 +134,6 @@ func (m *Manager) Load() error { | |||||
| 172 | config.RenderingMode = RenderingModeAuto | 134 | config.RenderingMode = RenderingModeAuto | ||
| 173 | } | 135 | } | ||
| 174 | 136 | ||||
| 175 | - | // TODO: implement in Step 18 - Auto-detect GPU if enabled and driver name is not set | |||
| 176 | - | // if config.VideoAcceleration.AutoDetectGPU && config.VideoAcceleration.VAAPIDriverName == "" { | |||
| 177 | - | // gpuInfo := gpu.DetectGPU() | |||
| 178 | - | // if gpuInfo.SupportsVAAPI() { | |||
| 179 | - | // config.VideoAcceleration.VAAPIDriverName = gpuInfo.GetVAAPIDriverName() | |||
| 180 | - | // } | |||
| 181 | - | // } | |||
| 182 | - | ||||
| 183 | - | // TODO: implement in Step 18 - Validate and configure codec preferences based on GPU | |||
| 184 | - | // config = m.validateAndConfigureCodecPreferences(config) | |||
| 185 | - | ||||
| 186 | // Validate ColorScheme setting using switch statement | 137 | // Validate ColorScheme setting using switch statement | ||
| 187 | switch config.Appearance.ColorScheme { | 138 | switch config.Appearance.ColorScheme { | ||
| 188 | case "prefer-dark", "prefer-light", ThemeDefault: | 139 | case "prefer-dark", "prefer-light", ThemeDefault: | ||
| @@ -270,34 +221,13 @@ func (m *Manager) setDefaults() { | |||||
| 270 | // Logging defaults | 221 | // Logging defaults | ||
| 271 | m.viper.SetDefault("logging.level", defaults.Logging.Level) | 222 | m.viper.SetDefault("logging.level", defaults.Logging.Level) | ||
| 272 | m.viper.SetDefault("logging.format", defaults.Logging.Format) | 223 | m.viper.SetDefault("logging.format", defaults.Logging.Format) | ||
| 273 | - | m.viper.SetDefault("logging.filename", defaults.Logging.Filename) | |||
| 274 | - | m.viper.SetDefault("logging.max_size", defaults.Logging.MaxSize) | |||
| 275 | - | m.viper.SetDefault("logging.max_backups", defaults.Logging.MaxBackups) | |||
| 276 | m.viper.SetDefault("logging.max_age", defaults.Logging.MaxAge) | 224 | m.viper.SetDefault("logging.max_age", defaults.Logging.MaxAge) | ||
| 277 | - | m.viper.SetDefault("logging.compress", defaults.Logging.Compress) | |||
| 278 | m.viper.SetDefault("logging.log_dir", defaults.Logging.LogDir) | 225 | m.viper.SetDefault("logging.log_dir", defaults.Logging.LogDir) | ||
| 279 | m.viper.SetDefault("logging.enable_file_log", defaults.Logging.EnableFileLog) | 226 | m.viper.SetDefault("logging.enable_file_log", defaults.Logging.EnableFileLog) | ||
| 280 | - | m.viper.SetDefault("logging.capture_stdout", defaults.Logging.CaptureStdout) | |||
| 281 | - | m.viper.SetDefault("logging.capture_stderr", defaults.Logging.CaptureStderr) | |||
| 282 | - | m.viper.SetDefault("logging.capture_c_output", defaults.Logging.CaptureCOutput) | |||
| 283 | m.viper.SetDefault("logging.capture_console", defaults.Logging.CaptureConsole) | 227 | m.viper.SetDefault("logging.capture_console", defaults.Logging.CaptureConsole) | ||
| 284 | - | m.viper.SetDefault("logging.debug_file", defaults.Logging.DebugFile) | |||
| 285 | - | m.viper.SetDefault("logging.verbose_webkit", defaults.Logging.VerboseWebKit) | |||
| 286 | 228 | ||||
| 287 | // Debug defaults | 229 | // Debug defaults | ||
| 288 | m.viper.SetDefault("debug.enable_devtools", defaults.Debug.EnableDevTools) | 230 | m.viper.SetDefault("debug.enable_devtools", defaults.Debug.EnableDevTools) | ||
| 289 | - | m.viper.SetDefault("debug.enable_webkit_debug", defaults.Debug.EnableWebKitDebug) | |||
| 290 | - | m.viper.SetDefault("debug.webkit_debug_categories", defaults.Debug.WebKitDebugCategories) | |||
| 291 | - | m.viper.SetDefault("debug.enable_filtering_debug", defaults.Debug.EnableFilteringDebug) | |||
| 292 | - | m.viper.SetDefault("debug.enable_webview_debug", defaults.Debug.EnableWebViewDebug) | |||
| 293 | - | m.viper.SetDefault("debug.log_webkit_crashes", defaults.Debug.LogWebKitCrashes) | |||
| 294 | - | m.viper.SetDefault("debug.enable_script_debug", defaults.Debug.EnableScriptDebug) | |||
| 295 | - | m.viper.SetDefault("debug.enable_general_debug", defaults.Debug.EnableGeneralDebug) | |||
| 296 | - | m.viper.SetDefault("debug.enable_workspace_debug", defaults.Debug.EnableWorkspaceDebug) | |||
| 297 | - | m.viper.SetDefault("debug.enable_focus_debug", defaults.Debug.EnableFocusDebug) | |||
| 298 | - | m.viper.SetDefault("debug.enable_css_debug", defaults.Debug.EnableCSSDebug) | |||
| 299 | - | m.viper.SetDefault("debug.enable_focus_metrics", defaults.Debug.EnableFocusMetrics) | |||
| 300 | - | m.viper.SetDefault("debug.enable_pane_close_debug", defaults.Debug.EnablePaneCloseDebug) | |||
| 301 | 231 | ||||
| 302 | // Appearance defaults | 232 | // Appearance defaults | ||
| 303 | m.viper.SetDefault("appearance.sans_font", defaults.Appearance.SansFont) | 233 | m.viper.SetDefault("appearance.sans_font", defaults.Appearance.SansFont) | ||
| @@ -308,26 +238,6 @@ func (m *Manager) setDefaults() { | |||||
| 308 | m.viper.SetDefault("appearance.dark_palette", defaults.Appearance.DarkPalette) | 238 | m.viper.SetDefault("appearance.dark_palette", defaults.Appearance.DarkPalette) | ||
| 309 | m.viper.SetDefault("appearance.color_scheme", defaults.Appearance.ColorScheme) | 239 | m.viper.SetDefault("appearance.color_scheme", defaults.Appearance.ColorScheme) | ||
| 310 | 240 | ||||
| 311 | - | // Video acceleration defaults | |||
| 312 | - | m.viper.SetDefault("video_acceleration.enable_vaapi", defaults.VideoAcceleration.EnableVAAPI) | |||
| 313 | - | m.viper.SetDefault("video_acceleration.auto_detect_gpu", defaults.VideoAcceleration.AutoDetectGPU) | |||
| 314 | - | m.viper.SetDefault("video_acceleration.vaapi_driver_name", defaults.VideoAcceleration.VAAPIDriverName) | |||
| 315 | - | m.viper.SetDefault("video_acceleration.enable_all_drivers", defaults.VideoAcceleration.EnableAllDrivers) | |||
| 316 | - | m.viper.SetDefault("video_acceleration.legacy_vaapi", defaults.VideoAcceleration.LegacyVAAPI) | |||
| 317 | - | ||||
| 318 | - | // Codec preferences defaults | |||
| 319 | - | m.viper.SetDefault("codec_preferences.preferred_codecs", defaults.CodecPreferences.PreferredCodecs) | |||
| 320 | - | m.viper.SetDefault("codec_preferences.force_av1", defaults.CodecPreferences.ForceAV1) | |||
| 321 | - | m.viper.SetDefault("codec_preferences.block_vp9", defaults.CodecPreferences.BlockVP9) | |||
| 322 | - | m.viper.SetDefault("codec_preferences.block_vp8", defaults.CodecPreferences.BlockVP8) | |||
| 323 | - | m.viper.SetDefault("codec_preferences.av1_hardware_only", defaults.CodecPreferences.AV1HardwareOnly) | |||
| 324 | - | m.viper.SetDefault("codec_preferences.disable_vp9_hardware", defaults.CodecPreferences.DisableVP9Hardware) | |||
| 325 | - | m.viper.SetDefault("codec_preferences.video_buffer_size_mb", defaults.CodecPreferences.VideoBufferSizeMB) | |||
| 326 | - | m.viper.SetDefault("codec_preferences.queue_buffer_time_sec", defaults.CodecPreferences.QueueBufferTimeSec) | |||
| 327 | - | m.viper.SetDefault("codec_preferences.custom_user_agent", defaults.CodecPreferences.CustomUserAgent) | |||
| 328 | - | m.viper.SetDefault("codec_preferences.av1_max_resolution", defaults.CodecPreferences.AV1MaxResolution) | |||
| 329 | - | m.viper.SetDefault("codec_preferences.disable_twitch_codec_control", defaults.CodecPreferences.DisableTwitchCodecControl) | |||
| 330 | - | ||||
| 331 | // Rendering defaults | 241 | // Rendering defaults | ||
| 332 | m.viper.SetDefault("rendering_mode", string(RenderingModeGPU)) | 242 | m.viper.SetDefault("rendering_mode", string(RenderingModeGPU)) | ||
| 333 | m.viper.SetDefault("default_webpage_zoom", defaults.DefaultWebpageZoom) | 243 | m.viper.SetDefault("default_webpage_zoom", defaults.DefaultWebpageZoom) | ||
M internal/infrastructure/config/schema.go +9 -98
| @@ -6,13 +6,11 @@ type Config struct { | |||
| 6 | 6 | History HistoryConfig `mapstructure:"history" yaml:"history" toml:"history"` | |
| 7 | 7 | SearchShortcuts map[string]SearchShortcut `mapstructure:"search_shortcuts" yaml:"search_shortcuts" toml:"search_shortcuts"` | |
| 8 | 8 | // DefaultSearchEngine is the URL template for the default search engine (must contain %s placeholder) | |
| 9 | - | DefaultSearchEngine string `mapstructure:"default_search_engine" yaml:"default_search_engine" toml:"default_search_engine"` | |
| 10 | - | Dmenu DmenuConfig `mapstructure:"dmenu" yaml:"dmenu" toml:"dmenu"` | |
| 11 | - | Logging LoggingConfig `mapstructure:"logging" yaml:"logging" toml:"logging"` | |
| 12 | - | Appearance AppearanceConfig `mapstructure:"appearance" yaml:"appearance" toml:"appearance"` | |
| 13 | - | VideoAcceleration VideoAccelerationConfig `mapstructure:"video_acceleration" yaml:"video_acceleration" toml:"video_acceleration"` | |
| 14 | - | CodecPreferences CodecConfig `mapstructure:"codec_preferences" yaml:"codec_preferences" toml:"codec_preferences"` | |
| 15 | - | Debug DebugConfig `mapstructure:"debug" yaml:"debug" toml:"debug"` | |
| 9 | + | DefaultSearchEngine string `mapstructure:"default_search_engine" yaml:"default_search_engine" toml:"default_search_engine"` | |
| 10 | + | Dmenu DmenuConfig `mapstructure:"dmenu" yaml:"dmenu" toml:"dmenu"` | |
| 11 | + | Logging LoggingConfig `mapstructure:"logging" yaml:"logging" toml:"logging"` | |
| 12 | + | Appearance AppearanceConfig `mapstructure:"appearance" yaml:"appearance" toml:"appearance"` | |
| 13 | + | Debug DebugConfig `mapstructure:"debug" yaml:"debug" toml:"debug"` | |
| 16 | 14 | // RenderingMode controls GPU/CPU rendering selection for WebKit | |
| 17 | 15 | RenderingMode RenderingMode `mapstructure:"rendering_mode" yaml:"rendering_mode" toml:"rendering_mode"` | |
| 18 | 16 | // DefaultWebpageZoom sets the default zoom level for pages without saved zoom settings (1.0 = 100%, 1.2 = 120%) | |
| @@ -71,27 +69,16 @@ type DmenuConfig struct { | |||
| 71 | 69 | ||
| 72 | 70 | // LoggingConfig holds logging configuration. | |
| 73 | 71 | type LoggingConfig struct { | |
| 74 | - | Level string `mapstructure:"level" yaml:"level" toml:"level"` | |
| 75 | - | Format string `mapstructure:"format" yaml:"format" toml:"format"` | |
| 76 | - | Filename string `mapstructure:"filename" yaml:"filename" toml:"filename"` | |
| 77 | - | MaxSize int `mapstructure:"max_size" yaml:"max_size" toml:"max_size"` | |
| 78 | - | MaxBackups int `mapstructure:"max_backups" yaml:"max_backups" toml:"max_backups"` | |
| 79 | - | MaxAge int `mapstructure:"max_age" yaml:"max_age" toml:"max_age"` | |
| 80 | - | Compress bool `mapstructure:"compress" yaml:"compress" toml:"compress"` | |
| 72 | + | Level string `mapstructure:"level" yaml:"level" toml:"level"` | |
| 73 | + | Format string `mapstructure:"format" yaml:"format" toml:"format"` | |
| 74 | + | MaxAge int `mapstructure:"max_age" yaml:"max_age" toml:"max_age"` | |
| 81 | 75 | ||
| 82 | 76 | // File output configuration | |
| 83 | 77 | LogDir string `mapstructure:"log_dir" yaml:"log_dir" toml:"log_dir"` | |
| 84 | 78 | EnableFileLog bool `mapstructure:"enable_file_log" yaml:"enable_file_log" toml:"enable_file_log"` | |
| 85 | 79 | ||
| 86 | - | // Capture settings | |
| 87 | - | CaptureStdout bool `mapstructure:"capture_stdout" yaml:"capture_stdout" toml:"capture_stdout" json:"capture_stdout"` | |
| 88 | - | CaptureStderr bool `mapstructure:"capture_stderr" yaml:"capture_stderr" toml:"capture_stderr" json:"capture_stderr"` | |
| 89 | - | CaptureCOutput bool `mapstructure:"capture_c_output" yaml:"capture_c_output" toml:"capture_c_output" json:"capture_c_output"` | |
| 80 | + | // Capture browser console to logs | |
| 90 | 81 | CaptureConsole bool `mapstructure:"capture_console" yaml:"capture_console" toml:"capture_console" json:"capture_console"` | |
| 91 | - | ||
| 92 | - | // Debug output | |
| 93 | - | DebugFile string `mapstructure:"debug_file" yaml:"debug_file" toml:"debug_file"` | |
| 94 | - | VerboseWebKit bool `mapstructure:"verbose_webkit" yaml:"verbose_webkit" toml:"verbose_webkit"` | |
| 95 | 82 | } | |
| 96 | 83 | ||
| 97 | 84 | // AppearanceConfig holds UI/rendering preferences. | |
| @@ -119,45 +106,6 @@ type ColorPalette struct { | |||
| 119 | 106 | Border string `mapstructure:"border" yaml:"border" toml:"border" json:"border"` | |
| 120 | 107 | } | |
| 121 | 108 | ||
| 122 | - | // VideoAccelerationConfig holds video hardware acceleration preferences. | |
| 123 | - | type VideoAccelerationConfig struct { | |
| 124 | - | EnableVAAPI bool `mapstructure:"enable_vaapi" yaml:"enable_vaapi" toml:"enable_vaapi"` | |
| 125 | - | AutoDetectGPU bool `mapstructure:"auto_detect_gpu" yaml:"auto_detect_gpu" toml:"auto_detect_gpu"` | |
| 126 | - | VAAPIDriverName string `mapstructure:"vaapi_driver_name" yaml:"vaapi_driver_name" toml:"vaapi_driver_name"` | |
| 127 | - | EnableAllDrivers bool `mapstructure:"enable_all_drivers" yaml:"enable_all_drivers" toml:"enable_all_drivers"` | |
| 128 | - | LegacyVAAPI bool `mapstructure:"legacy_vaapi" yaml:"legacy_vaapi" toml:"legacy_vaapi"` | |
| 129 | - | } | |
| 130 | - | ||
| 131 | - | // CodecConfig holds video codec preferences and handling | |
| 132 | - | type CodecConfig struct { | |
| 133 | - | // Codec preference order (e.g., "av1,h264,vp8") | |
| 134 | - | PreferredCodecs string `mapstructure:"preferred_codecs" yaml:"preferred_codecs" toml:"preferred_codecs"` | |
| 135 | - | ||
| 136 | - | // Force specific codec for platforms | |
| 137 | - | ForceAV1 bool `mapstructure:"force_av1" yaml:"force_av1" toml:"force_av1"` | |
| 138 | - | ||
| 139 | - | // Block problematic codecs | |
| 140 | - | BlockVP9 bool `mapstructure:"block_vp9" yaml:"block_vp9" toml:"block_vp9"` | |
| 141 | - | BlockVP8 bool `mapstructure:"block_vp8" yaml:"block_vp8" toml:"block_vp8"` | |
| 142 | - | ||
| 143 | - | // Hardware acceleration per codec | |
| 144 | - | AV1HardwareOnly bool `mapstructure:"av1_hardware_only" yaml:"av1_hardware_only" toml:"av1_hardware_only"` | |
| 145 | - | DisableVP9Hardware bool `mapstructure:"disable_vp9_hardware" yaml:"disable_vp9_hardware" toml:"disable_vp9_hardware"` | |
| 146 | - | ||
| 147 | - | // Buffer configuration for smooth playback | |
| 148 | - | VideoBufferSizeMB int `mapstructure:"video_buffer_size_mb" yaml:"video_buffer_size_mb" toml:"video_buffer_size_mb"` | |
| 149 | - | QueueBufferTimeSec int `mapstructure:"queue_buffer_time_sec" yaml:"queue_buffer_time_sec" toml:"queue_buffer_time_sec"` | |
| 150 | - | ||
| 151 | - | // Custom User-Agent for codec negotiation | |
| 152 | - | CustomUserAgent string `mapstructure:"custom_user_agent" yaml:"custom_user_agent" toml:"custom_user_agent"` | |
| 153 | - | ||
| 154 | - | // Maximum resolution for AV1 codec (720p, 1080p, 1440p, 4k, unlimited) | |
| 155 | - | AV1MaxResolution string `mapstructure:"av1_max_resolution" yaml:"av1_max_resolution" toml:"av1_max_resolution"` | |
| 156 | - | ||
| 157 | - | // Site-specific codec control settings | |
| 158 | - | DisableTwitchCodecControl bool `mapstructure:"disable_twitch_codec_control" yaml:"disable_twitch_codec_control" toml:"disable_twitch_codec_control"` | |
| 159 | - | } | |
| 160 | - | ||
| 161 | 109 | // ContentFilteringConfig holds content filtering and ad blocking preferences | |
| 162 | 110 | type ContentFilteringConfig struct { | |
| 163 | 111 | // Enabled controls whether ad blocking is active (default: true) | |
| @@ -178,43 +126,6 @@ type OmniboxConfig struct { | |||
| 178 | 126 | type DebugConfig struct { | |
| 179 | 127 | // Enable browser developer tools (F12, Inspect Element in context menu) | |
| 180 | 128 | EnableDevTools bool `mapstructure:"enable_devtools" yaml:"enable_devtools" toml:"enable_devtools"` | |
| 181 | - | ||
| 182 | - | // Enable WebKit internal debug logging | |
| 183 | - | EnableWebKitDebug bool `mapstructure:"enable_webkit_debug" yaml:"enable_webkit_debug" toml:"enable_webkit_debug"` | |
| 184 | - | ||
| 185 | - | // WebKit debug categories (comma-separated) | |
| 186 | - | // Common values: "Network:preconnectTo", "ContentFilters", "Loading", "JavaScript" | |
| 187 | - | WebKitDebugCategories string `mapstructure:"webkit_debug_categories" yaml:"webkit_debug_categories" toml:"webkit_debug_categories"` | |
| 188 | - | ||
| 189 | - | // Enable content filtering debug logs | |
| 190 | - | EnableFilteringDebug bool `mapstructure:"enable_filtering_debug" yaml:"enable_filtering_debug" toml:"enable_filtering_debug"` | |
| 191 | - | ||
| 192 | - | // Enable detailed WebView state logging | |
| 193 | - | EnableWebViewDebug bool `mapstructure:"enable_webview_debug" yaml:"enable_webview_debug" toml:"enable_webview_debug"` | |
| 194 | - | ||
| 195 | - | // Log WebKit crashes and errors to file | |
| 196 | - | LogWebKitCrashes bool `mapstructure:"log_webkit_crashes" yaml:"log_webkit_crashes" toml:"log_webkit_crashes"` | |
| 197 | - | ||
| 198 | - | // Enable script injection debug logs | |
| 199 | - | EnableScriptDebug bool `mapstructure:"enable_script_debug" yaml:"enable_script_debug" toml:"enable_script_debug"` | |
| 200 | - | ||
| 201 | - | // Enable general debug mode (equivalent to DUMBER_DEBUG env var) | |
| 202 | - | EnableGeneralDebug bool `mapstructure:"enable_general_debug" yaml:"enable_general_debug" toml:"enable_general_debug"` | |
| 203 | - | ||
| 204 | - | // Enable workspace navigation and focus debug logs | |
| 205 | - | EnableWorkspaceDebug bool `mapstructure:"enable_workspace_debug" yaml:"enable_workspace_debug" toml:"enable_workspace_debug"` | |
| 206 | - | ||
| 207 | - | // Enable focus state machine debug logs | |
| 208 | - | EnableFocusDebug bool `mapstructure:"enable_focus_debug" yaml:"enable_focus_debug" toml:"enable_focus_debug"` | |
| 209 | - | ||
| 210 | - | // Enable CSS reconciler debug logs | |
| 211 | - | EnableCSSDebug bool `mapstructure:"enable_css_debug" yaml:"enable_css_debug" toml:"enable_css_debug"` | |
| 212 | - | ||
| 213 | - | // Enable focus metrics tracking | |
| 214 | - | EnableFocusMetrics bool `mapstructure:"enable_focus_metrics" yaml:"enable_focus_metrics" toml:"enable_focus_metrics"` | |
| 215 | - | ||
| 216 | - | // Enable detailed pane close instrumentation and tree snapshots | |
| 217 | - | EnablePaneCloseDebug bool `mapstructure:"enable_pane_close_debug" yaml:"enable_pane_close_debug" toml:"enable_pane_close_debug"` | |
| 218 | 129 | } | |
| 219 | 130 | ||
| 220 | 131 | // WorkspaceConfig captures layout, pane, and tab behaviour preferences. | |
| @@ -6,13 +6,11 @@ type Config struct { | |||||
| 6 | History HistoryConfig `mapstructure:"history" yaml:"history" toml:"history"` | 6 | History HistoryConfig `mapstructure:"history" yaml:"history" toml:"history"` | ||
| 7 | SearchShortcuts map[string]SearchShortcut `mapstructure:"search_shortcuts" yaml:"search_shortcuts" toml:"search_shortcuts"` | 7 | SearchShortcuts map[string]SearchShortcut `mapstructure:"search_shortcuts" yaml:"search_shortcuts" toml:"search_shortcuts"` | ||
| 8 | // DefaultSearchEngine is the URL template for the default search engine (must contain %s placeholder) | 8 | // DefaultSearchEngine is the URL template for the default search engine (must contain %s placeholder) | ||
| 9 | - | DefaultSearchEngine string `mapstructure:"default_search_engine" yaml:"default_search_engine" toml:"default_search_engine"` | 9 | + | DefaultSearchEngine string `mapstructure:"default_search_engine" yaml:"default_search_engine" toml:"default_search_engine"` |
| 10 | - | Dmenu DmenuConfig `mapstructure:"dmenu" yaml:"dmenu" toml:"dmenu"` | 10 | + | Dmenu DmenuConfig `mapstructure:"dmenu" yaml:"dmenu" toml:"dmenu"` |
| 11 | - | Logging LoggingConfig `mapstructure:"logging" yaml:"logging" toml:"logging"` | 11 | + | Logging LoggingConfig `mapstructure:"logging" yaml:"logging" toml:"logging"` |
| 12 | - | Appearance AppearanceConfig `mapstructure:"appearance" yaml:"appearance" toml:"appearance"` | 12 | + | Appearance AppearanceConfig `mapstructure:"appearance" yaml:"appearance" toml:"appearance"` |
| 13 | - | VideoAcceleration VideoAccelerationConfig `mapstructure:"video_acceleration" yaml:"video_acceleration" toml:"video_acceleration"` | 13 | + | Debug DebugConfig `mapstructure:"debug" yaml:"debug" toml:"debug"` |
| 14 | - | CodecPreferences CodecConfig `mapstructure:"codec_preferences" yaml:"codec_preferences" toml:"codec_preferences"` | |||
| 15 | - | Debug DebugConfig `mapstructure:"debug" yaml:"debug" toml:"debug"` | |||
| 16 | // RenderingMode controls GPU/CPU rendering selection for WebKit | 14 | // RenderingMode controls GPU/CPU rendering selection for WebKit | ||
| 17 | RenderingMode RenderingMode `mapstructure:"rendering_mode" yaml:"rendering_mode" toml:"rendering_mode"` | 15 | RenderingMode RenderingMode `mapstructure:"rendering_mode" yaml:"rendering_mode" toml:"rendering_mode"` | ||
| 18 | // DefaultWebpageZoom sets the default zoom level for pages without saved zoom settings (1.0 = 100%, 1.2 = 120%) | 16 | // DefaultWebpageZoom sets the default zoom level for pages without saved zoom settings (1.0 = 100%, 1.2 = 120%) | ||
| @@ -71,27 +69,16 @@ type DmenuConfig struct { | |||||
| 71 | 69 | ||||
| 72 | // LoggingConfig holds logging configuration. | 70 | // LoggingConfig holds logging configuration. | ||
| 73 | type LoggingConfig struct { | 71 | type LoggingConfig struct { | ||
| 74 | - | Level string `mapstructure:"level" yaml:"level" toml:"level"` | 72 | + | Level string `mapstructure:"level" yaml:"level" toml:"level"` |
| 75 | - | Format string `mapstructure:"format" yaml:"format" toml:"format"` | 73 | + | Format string `mapstructure:"format" yaml:"format" toml:"format"` |
| 76 | - | Filename string `mapstructure:"filename" yaml:"filename" toml:"filename"` | 74 | + | MaxAge int `mapstructure:"max_age" yaml:"max_age" toml:"max_age"` |
| 77 | - | MaxSize int `mapstructure:"max_size" yaml:"max_size" toml:"max_size"` | |||
| 78 | - | MaxBackups int `mapstructure:"max_backups" yaml:"max_backups" toml:"max_backups"` | |||
| 79 | - | MaxAge int `mapstructure:"max_age" yaml:"max_age" toml:"max_age"` | |||
| 80 | - | Compress bool `mapstructure:"compress" yaml:"compress" toml:"compress"` | |||
| 81 | 75 | ||||
| 82 | // File output configuration | 76 | // File output configuration | ||
| 83 | LogDir string `mapstructure:"log_dir" yaml:"log_dir" toml:"log_dir"` | 77 | LogDir string `mapstructure:"log_dir" yaml:"log_dir" toml:"log_dir"` | ||
| 84 | EnableFileLog bool `mapstructure:"enable_file_log" yaml:"enable_file_log" toml:"enable_file_log"` | 78 | EnableFileLog bool `mapstructure:"enable_file_log" yaml:"enable_file_log" toml:"enable_file_log"` | ||
| 85 | 79 | ||||
| 86 | - | // Capture settings | 80 | + | // Capture browser console to logs |
| 87 | - | CaptureStdout bool `mapstructure:"capture_stdout" yaml:"capture_stdout" toml:"capture_stdout" json:"capture_stdout"` | |||
| 88 | - | CaptureStderr bool `mapstructure:"capture_stderr" yaml:"capture_stderr" toml:"capture_stderr" json:"capture_stderr"` | |||
| 89 | - | CaptureCOutput bool `mapstructure:"capture_c_output" yaml:"capture_c_output" toml:"capture_c_output" json:"capture_c_output"` | |||
| 90 | CaptureConsole bool `mapstructure:"capture_console" yaml:"capture_console" toml:"capture_console" json:"capture_console"` | 81 | CaptureConsole bool `mapstructure:"capture_console" yaml:"capture_console" toml:"capture_console" json:"capture_console"` | ||
| 91 | - | ||||
| 92 | - | // Debug output | |||
| 93 | - | DebugFile string `mapstructure:"debug_file" yaml:"debug_file" toml:"debug_file"` | |||
| 94 | - | VerboseWebKit bool `mapstructure:"verbose_webkit" yaml:"verbose_webkit" toml:"verbose_webkit"` | |||
| 95 | } | 82 | } | ||
| 96 | 83 | ||||
| 97 | // AppearanceConfig holds UI/rendering preferences. | 84 | // AppearanceConfig holds UI/rendering preferences. | ||
| @@ -119,45 +106,6 @@ type ColorPalette struct { | |||||
| 119 | Border string `mapstructure:"border" yaml:"border" toml:"border" json:"border"` | 106 | Border string `mapstructure:"border" yaml:"border" toml:"border" json:"border"` | ||
| 120 | } | 107 | } | ||
| 121 | 108 | ||||
| 122 | - | // VideoAccelerationConfig holds video hardware acceleration preferences. | |||
| 123 | - | type VideoAccelerationConfig struct { | |||
| 124 | - | EnableVAAPI bool `mapstructure:"enable_vaapi" yaml:"enable_vaapi" toml:"enable_vaapi"` | |||
| 125 | - | AutoDetectGPU bool `mapstructure:"auto_detect_gpu" yaml:"auto_detect_gpu" toml:"auto_detect_gpu"` | |||
| 126 | - | VAAPIDriverName string `mapstructure:"vaapi_driver_name" yaml:"vaapi_driver_name" toml:"vaapi_driver_name"` | |||
| 127 | - | EnableAllDrivers bool `mapstructure:"enable_all_drivers" yaml:"enable_all_drivers" toml:"enable_all_drivers"` | |||
| 128 | - | LegacyVAAPI bool `mapstructure:"legacy_vaapi" yaml:"legacy_vaapi" toml:"legacy_vaapi"` | |||
| 129 | - | } | |||
| 130 | - | ||||
| 131 | - | // CodecConfig holds video codec preferences and handling | |||
| 132 | - | type CodecConfig struct { | |||
| 133 | - | // Codec preference order (e.g., "av1,h264,vp8") | |||
| 134 | - | PreferredCodecs string `mapstructure:"preferred_codecs" yaml:"preferred_codecs" toml:"preferred_codecs"` | |||
| 135 | - | ||||
| 136 | - | // Force specific codec for platforms | |||
| 137 | - | ForceAV1 bool `mapstructure:"force_av1" yaml:"force_av1" toml:"force_av1"` | |||
| 138 | - | ||||
| 139 | - | // Block problematic codecs | |||
| 140 | - | BlockVP9 bool `mapstructure:"block_vp9" yaml:"block_vp9" toml:"block_vp9"` | |||
| 141 | - | BlockVP8 bool `mapstructure:"block_vp8" yaml:"block_vp8" toml:"block_vp8"` | |||
| 142 | - | ||||
| 143 | - | // Hardware acceleration per codec | |||
| 144 | - | AV1HardwareOnly bool `mapstructure:"av1_hardware_only" yaml:"av1_hardware_only" toml:"av1_hardware_only"` | |||
| 145 | - | DisableVP9Hardware bool `mapstructure:"disable_vp9_hardware" yaml:"disable_vp9_hardware" toml:"disable_vp9_hardware"` | |||
| 146 | - | ||||
| 147 | - | // Buffer configuration for smooth playback | |||
| 148 | - | VideoBufferSizeMB int `mapstructure:"video_buffer_size_mb" yaml:"video_buffer_size_mb" toml:"video_buffer_size_mb"` | |||
| 149 | - | QueueBufferTimeSec int `mapstructure:"queue_buffer_time_sec" yaml:"queue_buffer_time_sec" toml:"queue_buffer_time_sec"` | |||
| 150 | - | ||||
| 151 | - | // Custom User-Agent for codec negotiation | |||
| 152 | - | CustomUserAgent string `mapstructure:"custom_user_agent" yaml:"custom_user_agent" toml:"custom_user_agent"` | |||
| 153 | - | ||||
| 154 | - | // Maximum resolution for AV1 codec (720p, 1080p, 1440p, 4k, unlimited) | |||
| 155 | - | AV1MaxResolution string `mapstructure:"av1_max_resolution" yaml:"av1_max_resolution" toml:"av1_max_resolution"` | |||
| 156 | - | ||||
| 157 | - | // Site-specific codec control settings | |||
| 158 | - | DisableTwitchCodecControl bool `mapstructure:"disable_twitch_codec_control" yaml:"disable_twitch_codec_control" toml:"disable_twitch_codec_control"` | |||
| 159 | - | } | |||
| 160 | - | ||||
| 161 | // ContentFilteringConfig holds content filtering and ad blocking preferences | 109 | // ContentFilteringConfig holds content filtering and ad blocking preferences | ||
| 162 | type ContentFilteringConfig struct { | 110 | type ContentFilteringConfig struct { | ||
| 163 | // Enabled controls whether ad blocking is active (default: true) | 111 | // Enabled controls whether ad blocking is active (default: true) | ||
| @@ -178,43 +126,6 @@ type OmniboxConfig struct { | |||||
| 178 | type DebugConfig struct { | 126 | type DebugConfig struct { | ||
| 179 | // Enable browser developer tools (F12, Inspect Element in context menu) | 127 | // Enable browser developer tools (F12, Inspect Element in context menu) | ||
| 180 | EnableDevTools bool `mapstructure:"enable_devtools" yaml:"enable_devtools" toml:"enable_devtools"` | 128 | EnableDevTools bool `mapstructure:"enable_devtools" yaml:"enable_devtools" toml:"enable_devtools"` | ||
| 181 | - | ||||
| 182 | - | // Enable WebKit internal debug logging | |||
| 183 | - | EnableWebKitDebug bool `mapstructure:"enable_webkit_debug" yaml:"enable_webkit_debug" toml:"enable_webkit_debug"` | |||
| 184 | - | ||||
| 185 | - | // WebKit debug categories (comma-separated) | |||
| 186 | - | // Common values: "Network:preconnectTo", "ContentFilters", "Loading", "JavaScript" | |||
| 187 | - | WebKitDebugCategories string `mapstructure:"webkit_debug_categories" yaml:"webkit_debug_categories" toml:"webkit_debug_categories"` | |||
| 188 | - | ||||
| 189 | - | // Enable content filtering debug logs | |||
| 190 | - | EnableFilteringDebug bool `mapstructure:"enable_filtering_debug" yaml:"enable_filtering_debug" toml:"enable_filtering_debug"` | |||
| 191 | - | ||||
| 192 | - | // Enable detailed WebView state logging | |||
| 193 | - | EnableWebViewDebug bool `mapstructure:"enable_webview_debug" yaml:"enable_webview_debug" toml:"enable_webview_debug"` | |||
| 194 | - | ||||
| 195 | - | // Log WebKit crashes and errors to file | |||
| 196 | - | LogWebKitCrashes bool `mapstructure:"log_webkit_crashes" yaml:"log_webkit_crashes" toml:"log_webkit_crashes"` | |||
| 197 | - | ||||
| 198 | - | // Enable script injection debug logs | |||
| 199 | - | EnableScriptDebug bool `mapstructure:"enable_script_debug" yaml:"enable_script_debug" toml:"enable_script_debug"` | |||
| 200 | - | ||||
| 201 | - | // Enable general debug mode (equivalent to DUMBER_DEBUG env var) | |||
| 202 | - | EnableGeneralDebug bool `mapstructure:"enable_general_debug" yaml:"enable_general_debug" toml:"enable_general_debug"` | |||
| 203 | - | ||||
| 204 | - | // Enable workspace navigation and focus debug logs | |||
| 205 | - | EnableWorkspaceDebug bool `mapstructure:"enable_workspace_debug" yaml:"enable_workspace_debug" toml:"enable_workspace_debug"` | |||
| 206 | - | ||||
| 207 | - | // Enable focus state machine debug logs | |||
| 208 | - | EnableFocusDebug bool `mapstructure:"enable_focus_debug" yaml:"enable_focus_debug" toml:"enable_focus_debug"` | |||
| 209 | - | ||||
| 210 | - | // Enable CSS reconciler debug logs | |||
| 211 | - | EnableCSSDebug bool `mapstructure:"enable_css_debug" yaml:"enable_css_debug" toml:"enable_css_debug"` | |||
| 212 | - | ||||
| 213 | - | // Enable focus metrics tracking | |||
| 214 | - | EnableFocusMetrics bool `mapstructure:"enable_focus_metrics" yaml:"enable_focus_metrics" toml:"enable_focus_metrics"` | |||
| 215 | - | ||||
| 216 | - | // Enable detailed pane close instrumentation and tree snapshots | |||
| 217 | - | EnablePaneCloseDebug bool `mapstructure:"enable_pane_close_debug" yaml:"enable_pane_close_debug" toml:"enable_pane_close_debug"` | |||
| 218 | } | 129 | } | ||
| 219 | 130 | ||||
| 220 | // WorkspaceConfig captures layout, pane, and tab behaviour preferences. | 131 | // WorkspaceConfig captures layout, pane, and tab behaviour preferences. | ||
M internal/infrastructure/config/validation.go +0 -24
| @@ -138,31 +138,7 @@ func validateConfig(config *Config) error { | |||
| 138 | 138 | } | |
| 139 | 139 | } | |
| 140 | 140 | ||
| 141 | - | // Validate codec buffer sizes | |
| 142 | - | if config.CodecPreferences.VideoBufferSizeMB < 0 { | |
| 143 | - | validationErrors = append(validationErrors, "codec_preferences.video_buffer_size_mb must be non-negative") | |
| 144 | - | } | |
| 145 | - | if config.CodecPreferences.QueueBufferTimeSec < 0 { | |
| 146 | - | validationErrors = append(validationErrors, "codec_preferences.queue_buffer_time_sec must be non-negative") | |
| 147 | - | } | |
| 148 | - | ||
| 149 | - | // Validate AV1 max resolution using switch statement | |
| 150 | - | if config.CodecPreferences.AV1MaxResolution != "" { | |
| 151 | - | switch config.CodecPreferences.AV1MaxResolution { | |
| 152 | - | case "720p", "1080p", "1440p", "4k", "unlimited": | |
| 153 | - | // Valid | |
| 154 | - | default: | |
| 155 | - | validationErrors = append(validationErrors, fmt.Sprintf("codec_preferences.av1_max_resolution must be one of: 720p, 1080p, 1440p, 4k, unlimited (got: %s)", config.CodecPreferences.AV1MaxResolution)) | |
| 156 | - | } | |
| 157 | - | } | |
| 158 | - | ||
| 159 | 141 | // Validate logging values | |
| 160 | - | if config.Logging.MaxSize < 0 { | |
| 161 | - | validationErrors = append(validationErrors, "logging.max_size must be non-negative") | |
| 162 | - | } | |
| 163 | - | if config.Logging.MaxBackups < 0 { | |
| 164 | - | validationErrors = append(validationErrors, "logging.max_backups must be non-negative") | |
| 165 | - | } | |
| 166 | 142 | if config.Logging.MaxAge < 0 { | |
| 167 | 143 | validationErrors = append(validationErrors, "logging.max_age must be non-negative") | |
| 168 | 144 | } | |
| @@ -138,31 +138,7 @@ func validateConfig(config *Config) error { | |||||
| 138 | } | 138 | } | ||
| 139 | } | 139 | } | ||
| 140 | 140 | ||||
| 141 | - | // Validate codec buffer sizes | |||
| 142 | - | if config.CodecPreferences.VideoBufferSizeMB < 0 { | |||
| 143 | - | validationErrors = append(validationErrors, "codec_preferences.video_buffer_size_mb must be non-negative") | |||
| 144 | - | } | |||
| 145 | - | if config.CodecPreferences.QueueBufferTimeSec < 0 { | |||
| 146 | - | validationErrors = append(validationErrors, "codec_preferences.queue_buffer_time_sec must be non-negative") | |||
| 147 | - | } | |||
| 148 | - | ||||
| 149 | - | // Validate AV1 max resolution using switch statement | |||
| 150 | - | if config.CodecPreferences.AV1MaxResolution != "" { | |||
| 151 | - | switch config.CodecPreferences.AV1MaxResolution { | |||
| 152 | - | case "720p", "1080p", "1440p", "4k", "unlimited": | |||
| 153 | - | // Valid | |||
| 154 | - | default: | |||
| 155 | - | validationErrors = append(validationErrors, fmt.Sprintf("codec_preferences.av1_max_resolution must be one of: 720p, 1080p, 1440p, 4k, unlimited (got: %s)", config.CodecPreferences.AV1MaxResolution)) | |||
| 156 | - | } | |||
| 157 | - | } | |||
| 158 | - | ||||
| 159 | // Validate logging values | 141 | // Validate logging values | ||
| 160 | - | if config.Logging.MaxSize < 0 { | |||
| 161 | - | validationErrors = append(validationErrors, "logging.max_size must be non-negative") | |||
| 162 | - | } | |||
| 163 | - | if config.Logging.MaxBackups < 0 { | |||
| 164 | - | validationErrors = append(validationErrors, "logging.max_backups must be non-negative") | |||
| 165 | - | } | |||
| 166 | if config.Logging.MaxAge < 0 { | 142 | if config.Logging.MaxAge < 0 { | ||
| 167 | validationErrors = append(validationErrors, "logging.max_age must be non-negative") | 143 | validationErrors = append(validationErrors, "logging.max_age must be non-negative") | ||
| 168 | } | 144 | } | ||
M internal/infrastructure/config/watcher.go +0 -11
| @@ -81,17 +81,6 @@ func (m *Manager) reload() error { | |||
| 81 | 81 | config.RenderingMode = RenderingModeAuto | |
| 82 | 82 | } | |
| 83 | 83 | ||
| 84 | - | // TODO: implement in Step 18 - Auto-detect GPU if enabled and driver name is not set | |
| 85 | - | // if config.VideoAcceleration.AutoDetectGPU && config.VideoAcceleration.VAAPIDriverName == "" { | |
| 86 | - | // gpuInfo := gpu.DetectGPU() | |
| 87 | - | // if gpuInfo.SupportsVAAPI() { | |
| 88 | - | // config.VideoAcceleration.VAAPIDriverName = gpuInfo.GetVAAPIDriverName() | |
| 89 | - | // } | |
| 90 | - | // } | |
| 91 | - | ||
| 92 | - | // TODO: implement in Step 18 - Validate and configure codec preferences based on GPU | |
| 93 | - | // config = m.validateAndConfigureCodecPreferences(config) | |
| 94 | - | ||
| 95 | 84 | // Validate ColorScheme setting using switch statement | |
| 96 | 85 | switch config.Appearance.ColorScheme { | |
| 97 | 86 | case "prefer-dark", "prefer-light", ThemeDefault: | |
| @@ -81,17 +81,6 @@ func (m *Manager) reload() error { | |||||
| 81 | config.RenderingMode = RenderingModeAuto | 81 | config.RenderingMode = RenderingModeAuto | ||
| 82 | } | 82 | } | ||
| 83 | 83 | ||||
| 84 | - | // TODO: implement in Step 18 - Auto-detect GPU if enabled and driver name is not set | |||
| 85 | - | // if config.VideoAcceleration.AutoDetectGPU && config.VideoAcceleration.VAAPIDriverName == "" { | |||
| 86 | - | // gpuInfo := gpu.DetectGPU() | |||
| 87 | - | // if gpuInfo.SupportsVAAPI() { | |||
| 88 | - | // config.VideoAcceleration.VAAPIDriverName = gpuInfo.GetVAAPIDriverName() | |||
| 89 | - | // } | |||
| 90 | - | // } | |||
| 91 | - | ||||
| 92 | - | // TODO: implement in Step 18 - Validate and configure codec preferences based on GPU | |||
| 93 | - | // config = m.validateAndConfigureCodecPreferences(config) | |||
| 94 | - | ||||
| 95 | // Validate ColorScheme setting using switch statement | 84 | // Validate ColorScheme setting using switch statement | ||
| 96 | switch config.Appearance.ColorScheme { | 85 | switch config.Appearance.ColorScheme { | ||
| 97 | case "prefer-dark", "prefer-light", ThemeDefault: | 86 | case "prefer-dark", "prefer-light", ThemeDefault: | ||