refactor: address final lint issues
- commit
- a363a97920364ab3888d9ab279594fdbe99c39c7
- author
- brice · · 2026-04-11 13:28 UTC
- parent
- e97d131
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +59 -16
M internal/infrastructure/cef/engine_init.go +12 -1
| @@ -71,7 +71,18 @@ func NewEngine( | |||
| 71 | 71 | } | |
| 72 | 72 | os.Args = savedArgs | |
| 73 | 73 | ||
| 74 | - | return wireEngine(ctx, eng, cfg, transcodingCfg, windowlessFrameRate, audioFactory, logger, deps.MediaClassifier, deps.CurrentConfigPayload, deps.DefaultConfigPayload) | |
| 74 | + | return wireEngine( | |
| 75 | + | ctx, | |
| 76 | + | eng, | |
| 77 | + | cfg, | |
| 78 | + | transcodingCfg, | |
| 79 | + | windowlessFrameRate, | |
| 80 | + | audioFactory, | |
| 81 | + | logger, | |
| 82 | + | deps.MediaClassifier, | |
| 83 | + | deps.CurrentConfigPayload, | |
| 84 | + | deps.DefaultConfigPayload, | |
| 85 | + | ) | |
| 75 | 86 | } | |
| 76 | 87 | ||
| 77 | 88 | func resolvedStateRoot(opts port.EngineOptions) string { | |
| @@ -71,7 +71,18 @@ func NewEngine( | |||||
| 71 | } | 71 | } | ||
| 72 | os.Args = savedArgs | 72 | os.Args = savedArgs | ||
| 73 | 73 | ||||
| 74 | - | return wireEngine(ctx, eng, cfg, transcodingCfg, windowlessFrameRate, audioFactory, logger, deps.MediaClassifier, deps.CurrentConfigPayload, deps.DefaultConfigPayload) | 74 | + | return wireEngine( |
| 75 | + | ctx, | |||
| 76 | + | eng, | |||
| 77 | + | cfg, | |||
| 78 | + | transcodingCfg, | |||
| 79 | + | windowlessFrameRate, | |||
| 80 | + | audioFactory, | |||
| 81 | + | logger, | |||
| 82 | + | deps.MediaClassifier, | |||
| 83 | + | deps.CurrentConfigPayload, | |||
| 84 | + | deps.DefaultConfigPayload, | |||
| 85 | + | ) | |||
| 75 | } | 86 | } | ||
| 76 | 87 | ||||
| 77 | func resolvedStateRoot(opts port.EngineOptions) string { | 88 | func resolvedStateRoot(opts port.EngineOptions) string { | ||
M internal/infrastructure/cef/factory.go +1 -1
| @@ -218,6 +218,6 @@ func (f *WebViewFactory) configureInitialBrowserCreation( | |||
| 218 | 218 | // CreateRelated creates a WebView that shares session/cookies with the parent. | |
| 219 | 219 | // TODO(phase2): look up the parent browser by parentID and use the same | |
| 220 | 220 | // request context so cookies and session state are shared. | |
| 221 | - | func (f *WebViewFactory) CreateRelated(ctx context.Context, _ port.WebViewID) (port.WebView, error) { | |
| 221 | + | func (f *WebViewFactory) CreateRelated(_ context.Context, _ port.WebViewID) (port.WebView, error) { | |
| 222 | 222 | return nil, ErrRelatedWebViewUnsupported | |
| 223 | 223 | } | |
| @@ -218,6 +218,6 @@ func (f *WebViewFactory) configureInitialBrowserCreation( | |||||
| 218 | // CreateRelated creates a WebView that shares session/cookies with the parent. | 218 | // CreateRelated creates a WebView that shares session/cookies with the parent. | ||
| 219 | // TODO(phase2): look up the parent browser by parentID and use the same | 219 | // TODO(phase2): look up the parent browser by parentID and use the same | ||
| 220 | // request context so cookies and session state are shared. | 220 | // request context so cookies and session state are shared. | ||
| 221 | - | func (f *WebViewFactory) CreateRelated(ctx context.Context, _ port.WebViewID) (port.WebView, error) { | 221 | + | func (f *WebViewFactory) CreateRelated(_ context.Context, _ port.WebViewID) (port.WebView, error) { |
| 222 | return nil, ErrRelatedWebViewUnsupported | 222 | return nil, ErrRelatedWebViewUnsupported | ||
| 223 | } | 223 | } | ||
M internal/ui/coordinator/content/popup.go +46 -14
| @@ -301,19 +301,8 @@ func (c *Coordinator) handlePopupCreate( | |||
| 301 | 301 | } | |
| 302 | 302 | ||
| 303 | 303 | parentID := parentWV.ID() | |
| 304 | - | if existing, ok := c.lookupReusableNamedPopup(parentPaneID, req.FrameName); ok { | |
| 305 | - | c.updatePendingPopupTarget(existing.WebView.ID(), req.TargetURI) | |
| 306 | - | if err := existing.WebView.LoadURI(ctx, req.TargetURI); err != nil { | |
| 307 | - | log.Warn().Err(err). | |
| 308 | - | Str("target_uri", logging.TruncateURL(req.TargetURI, logURLMaxLen)). | |
| 309 | - | Msg("failed to load target URI in reused popup") | |
| 310 | - | } | |
| 311 | - | log.Info(). | |
| 312 | - | Str("parent_pane", string(parentPaneID)). | |
| 313 | - | Str("frame_name", req.FrameName). | |
| 314 | - | Str("target_uri", logging.TruncateURL(req.TargetURI, logURLMaxLen)). | |
| 315 | - | Msg("reused named popup") | |
| 316 | - | return existing.WebView | |
| 304 | + | if reused, ok := c.reuseNamedPopup(ctx, parentPaneID, req.FrameName, req.TargetURI); ok { | |
| 305 | + | return reused | |
| 317 | 306 | } | |
| 318 | 307 | ||
| 319 | 308 | // Create related WebView for session sharing (created hidden) | |
| @@ -337,10 +326,53 @@ func (c *Coordinator) handlePopupCreate( | |||
| 337 | 326 | // Create popup pane entity | |
| 338 | 327 | paneID, popupPane := c.createPopupPane(popupID, parentPaneID, req.TargetURI) | |
| 339 | 328 | ||
| 340 | - | // Check OAuth configuration | |
| 329 | + | return c.finishPopupCreate(ctx, parentPaneID, parentID, popupID, popupWV, popupPane, paneID, popupType, behavior, placement, req) | |
| 330 | + | } | |
| 331 | + | ||
| 332 | + | func (c *Coordinator) reuseNamedPopup( | |
| 333 | + | ctx context.Context, | |
| 334 | + | parentPaneID entity.PaneID, | |
| 335 | + | frameName string, | |
| 336 | + | targetURI string, | |
| 337 | + | ) (port.WebView, bool) { | |
| 338 | + | log := logging.FromContext(ctx) | |
| 339 | + | ||
| 340 | + | if existing, ok := c.lookupReusableNamedPopup(parentPaneID, frameName); ok { | |
| 341 | + | c.updatePendingPopupTarget(existing.WebView.ID(), targetURI) | |
| 342 | + | if err := existing.WebView.LoadURI(ctx, targetURI); err != nil { | |
| 343 | + | log.Warn().Err(err). | |
| 344 | + | Str("target_uri", logging.TruncateURL(targetURI, logURLMaxLen)). | |
| 345 | + | Msg("failed to load target URI in reused popup") | |
| 346 | + | } | |
| 347 | + | log.Info(). | |
| 348 | + | Str("parent_pane", string(parentPaneID)). | |
| 349 | + | Str("frame_name", frameName). | |
| 350 | + | Str("target_uri", logging.TruncateURL(targetURI, logURLMaxLen)). | |
| 351 | + | Msg("reused named popup") | |
| 352 | + | return existing.WebView, true | |
| 353 | + | } | |
| 354 | + | ||
| 355 | + | return nil, false | |
| 356 | + | } | |
| 357 | + | ||
| 358 | + | func (c *Coordinator) finishPopupCreate( | |
| 359 | + | ctx context.Context, | |
| 360 | + | parentPaneID entity.PaneID, | |
| 361 | + | parentID port.WebViewID, | |
| 362 | + | popupID port.WebViewID, | |
| 363 | + | popupWV port.WebView, | |
| 364 | + | popupPane *entity.Pane, | |
| 365 | + | paneID entity.PaneID, | |
| 366 | + | popupType PopupType, | |
| 367 | + | behavior entity.PopupBehavior, | |
| 368 | + | placement string, | |
| 369 | + | req port.PopupRequest, | |
| 370 | + | ) port.WebView { | |
| 371 | + | log := logging.FromContext(ctx) | |
| 341 | 372 | hasConfig := c.popupConfig != nil | |
| 342 | 373 | oauthEnabled := hasConfig && c.popupConfig.OAuthAutoClose | |
| 343 | 374 | isOAuth := IsOAuthURL(req.TargetURI) | |
| 375 | + | ||
| 344 | 376 | log.Debug(). | |
| 345 | 377 | Bool("has_config", hasConfig). | |
| 346 | 378 | Bool("oauth_enabled", oauthEnabled). | |
| @@ -301,19 +301,8 @@ func (c *Coordinator) handlePopupCreate( | |||||
| 301 | } | 301 | } | ||
| 302 | 302 | ||||
| 303 | parentID := parentWV.ID() | 303 | parentID := parentWV.ID() | ||
| 304 | - | if existing, ok := c.lookupReusableNamedPopup(parentPaneID, req.FrameName); ok { | 304 | + | if reused, ok := c.reuseNamedPopup(ctx, parentPaneID, req.FrameName, req.TargetURI); ok { |
| 305 | - | c.updatePendingPopupTarget(existing.WebView.ID(), req.TargetURI) | 305 | + | return reused |
| 306 | - | if err := existing.WebView.LoadURI(ctx, req.TargetURI); err != nil { | |||
| 307 | - | log.Warn().Err(err). | |||
| 308 | - | Str("target_uri", logging.TruncateURL(req.TargetURI, logURLMaxLen)). | |||
| 309 | - | Msg("failed to load target URI in reused popup") | |||
| 310 | - | } | |||
| 311 | - | log.Info(). | |||
| 312 | - | Str("parent_pane", string(parentPaneID)). | |||
| 313 | - | Str("frame_name", req.FrameName). | |||
| 314 | - | Str("target_uri", logging.TruncateURL(req.TargetURI, logURLMaxLen)). | |||
| 315 | - | Msg("reused named popup") | |||
| 316 | - | return existing.WebView | |||
| 317 | } | 306 | } | ||
| 318 | 307 | ||||
| 319 | // Create related WebView for session sharing (created hidden) | 308 | // Create related WebView for session sharing (created hidden) | ||
| @@ -337,10 +326,53 @@ func (c *Coordinator) handlePopupCreate( | |||||
| 337 | // Create popup pane entity | 326 | // Create popup pane entity | ||
| 338 | paneID, popupPane := c.createPopupPane(popupID, parentPaneID, req.TargetURI) | 327 | paneID, popupPane := c.createPopupPane(popupID, parentPaneID, req.TargetURI) | ||
| 339 | 328 | ||||
| 340 | - | // Check OAuth configuration | 329 | + | return c.finishPopupCreate(ctx, parentPaneID, parentID, popupID, popupWV, popupPane, paneID, popupType, behavior, placement, req) |
| 330 | + | } | |||
| 331 | + | ||||
| 332 | + | func (c *Coordinator) reuseNamedPopup( | |||
| 333 | + | ctx context.Context, | |||
| 334 | + | parentPaneID entity.PaneID, | |||
| 335 | + | frameName string, | |||
| 336 | + | targetURI string, | |||
| 337 | + | ) (port.WebView, bool) { | |||
| 338 | + | log := logging.FromContext(ctx) | |||
| 339 | + | ||||
| 340 | + | if existing, ok := c.lookupReusableNamedPopup(parentPaneID, frameName); ok { | |||
| 341 | + | c.updatePendingPopupTarget(existing.WebView.ID(), targetURI) | |||
| 342 | + | if err := existing.WebView.LoadURI(ctx, targetURI); err != nil { | |||
| 343 | + | log.Warn().Err(err). | |||
| 344 | + | Str("target_uri", logging.TruncateURL(targetURI, logURLMaxLen)). | |||
| 345 | + | Msg("failed to load target URI in reused popup") | |||
| 346 | + | } | |||
| 347 | + | log.Info(). | |||
| 348 | + | Str("parent_pane", string(parentPaneID)). | |||
| 349 | + | Str("frame_name", frameName). | |||
| 350 | + | Str("target_uri", logging.TruncateURL(targetURI, logURLMaxLen)). | |||
| 351 | + | Msg("reused named popup") | |||
| 352 | + | return existing.WebView, true | |||
| 353 | + | } | |||
| 354 | + | ||||
| 355 | + | return nil, false | |||
| 356 | + | } | |||
| 357 | + | ||||
| 358 | + | func (c *Coordinator) finishPopupCreate( | |||
| 359 | + | ctx context.Context, | |||
| 360 | + | parentPaneID entity.PaneID, | |||
| 361 | + | parentID port.WebViewID, | |||
| 362 | + | popupID port.WebViewID, | |||
| 363 | + | popupWV port.WebView, | |||
| 364 | + | popupPane *entity.Pane, | |||
| 365 | + | paneID entity.PaneID, | |||
| 366 | + | popupType PopupType, | |||
| 367 | + | behavior entity.PopupBehavior, | |||
| 368 | + | placement string, | |||
| 369 | + | req port.PopupRequest, | |||
| 370 | + | ) port.WebView { | |||
| 371 | + | log := logging.FromContext(ctx) | |||
| 341 | hasConfig := c.popupConfig != nil | 372 | hasConfig := c.popupConfig != nil | ||
| 342 | oauthEnabled := hasConfig && c.popupConfig.OAuthAutoClose | 373 | oauthEnabled := hasConfig && c.popupConfig.OAuthAutoClose | ||
| 343 | isOAuth := IsOAuthURL(req.TargetURI) | 374 | isOAuth := IsOAuthURL(req.TargetURI) | ||
| 375 | + | ||||
| 344 | log.Debug(). | 376 | log.Debug(). | ||
| 345 | Bool("has_config", hasConfig). | 377 | Bool("has_config", hasConfig). | ||
| 346 | Bool("oauth_enabled", oauthEnabled). | 378 | Bool("oauth_enabled", oauthEnabled). | ||