chore(config): add content filtering configuration
- commit
- 5f7dbbb3b12943c70771b4cb9a122e5b27fda045
- author
- brice · · 2025-12-18 17:24 UTC
- committer
- brice · · 2025-12-18 19:34 UTC
- parent
- 2708968
- signature
- unsigned
3 files · +7 -15
M internal/infrastructure/config/defaults.go +2 -11
| @@ -174,17 +174,8 @@ func DefaultConfig() *Config { | |||
| 174 | 174 | }, | |
| 175 | 175 | }, | |
| 176 | 176 | ContentFiltering: ContentFilteringConfig{ | |
| 177 | - | Enabled: true, // Ad blocking enabled by default | |
| 178 | - | // Note: Whitelist is now managed via database (content_whitelist table) | |
| 179 | - | FilterLists: []string{ | |
| 180 | - | // Core blocking | |
| 181 | - | "https://easylist.to/easylist/easylist.txt", // Ads | |
| 182 | - | "https://easylist.to/easylist/easyprivacy.txt", // Tracking | |
| 183 | - | // uBlock extras | |
| 184 | - | "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt", // uBO optimizations | |
| 185 | - | "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt", // Cookie banners, popups | |
| 186 | - | "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/quick-fixes.txt", // Site fixes | |
| 187 | - | }, | |
| 177 | + | Enabled: true, // Ad blocking enabled by default | |
| 178 | + | AutoUpdate: true, // Auto-update filters from GitHub releases | |
| 188 | 179 | }, | |
| 189 | 180 | Omnibox: OmniboxConfig{ | |
| 190 | 181 | InitialBehavior: defaultOmniboxInitialBehavior, | |
| @@ -174,17 +174,8 @@ func DefaultConfig() *Config { | |||||
| 174 | }, | 174 | }, | ||
| 175 | }, | 175 | }, | ||
| 176 | ContentFiltering: ContentFilteringConfig{ | 176 | ContentFiltering: ContentFilteringConfig{ | ||
| 177 | - | Enabled: true, // Ad blocking enabled by default | 177 | + | Enabled: true, // Ad blocking enabled by default |
| 178 | - | // Note: Whitelist is now managed via database (content_whitelist table) | 178 | + | AutoUpdate: true, // Auto-update filters from GitHub releases |
| 179 | - | FilterLists: []string{ | |||
| 180 | - | // Core blocking | |||
| 181 | - | "https://easylist.to/easylist/easylist.txt", // Ads | |||
| 182 | - | "https://easylist.to/easylist/easyprivacy.txt", // Tracking | |||
| 183 | - | // uBlock extras | |||
| 184 | - | "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt", // uBO optimizations | |||
| 185 | - | "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt", // Cookie banners, popups | |||
| 186 | - | "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/quick-fixes.txt", // Site fixes | |||
| 187 | - | }, | |||
| 188 | }, | 179 | }, | ||
| 189 | Omnibox: OmniboxConfig{ | 180 | Omnibox: OmniboxConfig{ | ||
| 190 | InitialBehavior: defaultOmniboxInitialBehavior, | 181 | InitialBehavior: defaultOmniboxInitialBehavior, | ||
M internal/infrastructure/config/loader.go +1 -1
| @@ -284,7 +284,7 @@ func (m *Manager) setDefaults() { | |||
| 284 | 284 | ||
| 285 | 285 | // Content filtering | |
| 286 | 286 | m.viper.SetDefault("content_filtering.enabled", defaults.ContentFiltering.Enabled) | |
| 287 | - | m.viper.SetDefault("content_filtering.filter_lists", defaults.ContentFiltering.FilterLists) | |
| 287 | + | m.viper.SetDefault("content_filtering.auto_update", defaults.ContentFiltering.AutoUpdate) | |
| 288 | 288 | ||
| 289 | 289 | // Omnibox defaults | |
| 290 | 290 | m.viper.SetDefault("omnibox.initial_behavior", defaults.Omnibox.InitialBehavior) | |
| @@ -284,7 +284,7 @@ func (m *Manager) setDefaults() { | |||||
| 284 | 284 | ||||
| 285 | // Content filtering | 285 | // Content filtering | ||
| 286 | m.viper.SetDefault("content_filtering.enabled", defaults.ContentFiltering.Enabled) | 286 | m.viper.SetDefault("content_filtering.enabled", defaults.ContentFiltering.Enabled) | ||
| 287 | - | m.viper.SetDefault("content_filtering.filter_lists", defaults.ContentFiltering.FilterLists) | 287 | + | m.viper.SetDefault("content_filtering.auto_update", defaults.ContentFiltering.AutoUpdate) |
| 288 | 288 | ||||
| 289 | // Omnibox defaults | 289 | // Omnibox defaults | ||
| 290 | m.viper.SetDefault("omnibox.initial_behavior", defaults.Omnibox.InitialBehavior) | 290 | m.viper.SetDefault("omnibox.initial_behavior", defaults.Omnibox.InitialBehavior) | ||
M internal/infrastructure/config/schema.go +4 -3
| @@ -145,9 +145,10 @@ type ColorPalette struct { | |||
| 145 | 145 | type ContentFilteringConfig struct { | |
| 146 | 146 | // Enabled controls whether ad blocking is active (default: true) | |
| 147 | 147 | Enabled bool `mapstructure:"enabled" yaml:"enabled" toml:"enabled"` | |
| 148 | - | // FilterLists URLs of filter lists to use (EasyList, uBlock, etc.) | |
| 149 | - | FilterLists []string `mapstructure:"filter_lists" yaml:"filter_lists" toml:"filter_lists"` | |
| 150 | - | // Note: Whitelist is now managed via database (content_whitelist table) | |
| 148 | + | // AutoUpdate controls whether filters are automatically updated (default: true) | |
| 149 | + | AutoUpdate bool `mapstructure:"auto_update" yaml:"auto_update" toml:"auto_update"` | |
| 150 | + | // Note: Filters are downloaded from bnema/ublock-webkit-filters GitHub releases | |
| 151 | + | // Note: Whitelist is managed via database (content_whitelist table) | |
| 151 | 152 | } | |
| 152 | 153 | ||
| 153 | 154 | // OmniboxConfig holds omnibox behavior preferences | |
| @@ -145,9 +145,10 @@ type ColorPalette struct { | |||||
| 145 | type ContentFilteringConfig struct { | 145 | type ContentFilteringConfig struct { | ||
| 146 | // Enabled controls whether ad blocking is active (default: true) | 146 | // Enabled controls whether ad blocking is active (default: true) | ||
| 147 | Enabled bool `mapstructure:"enabled" yaml:"enabled" toml:"enabled"` | 147 | Enabled bool `mapstructure:"enabled" yaml:"enabled" toml:"enabled"` | ||
| 148 | - | // FilterLists URLs of filter lists to use (EasyList, uBlock, etc.) | 148 | + | // AutoUpdate controls whether filters are automatically updated (default: true) |
| 149 | - | FilterLists []string `mapstructure:"filter_lists" yaml:"filter_lists" toml:"filter_lists"` | 149 | + | AutoUpdate bool `mapstructure:"auto_update" yaml:"auto_update" toml:"auto_update"` |
| 150 | - | // Note: Whitelist is now managed via database (content_whitelist table) | 150 | + | // Note: Filters are downloaded from bnema/ublock-webkit-filters GitHub releases |
| 151 | + | // Note: Whitelist is managed via database (content_whitelist table) | |||
| 151 | } | 152 | } | ||
| 152 | 153 | ||||
| 153 | // OmniboxConfig holds omnibox behavior preferences | 154 | // OmniboxConfig holds omnibox behavior preferences | ||