browser_manager

package
v0.0.0-...-ddf2229 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Browser *rod.Browser
)

Functions

func ClearAllBlobs

func ClearAllBlobs(page *rod.Page, dynaminData map[string]interface{})

func GetTab

func GetTab() *rod.Page

if the `browser.tabs` is 0 then we are creating a new tab on each request

func Init

func Init(ctx context.Context, tabPool int) error

func InitializeTabManager

func InitializeTabManager(ctx context.Context, tabPool int)

func IsURLAllowed

func IsURLAllowed(urlStr string) (bool, string)

IsURLAllowed reports whether the URL may be fetched during PDF generation. Rules:

  • Only https:// URLs are eligible.
  • The host must exactly equal an allowlisted entry, or be a single-label alphanumeric subdomain of one (no dots or hyphens in the subdomain part).

func ReleaseTab

func ReleaseTab(page *rod.Page)

func SetAllowedDomains

func SetAllowedDomains(domains []string)

SetAllowedDomains replaces the allowlist. Safe for concurrent use with IsURLAllowed so the embedder (typically the service) can push updates at runtime — e.g. from a config hot-reload callback.

Types

type TabPool

type TabPool struct {
	// contains filtered or unexported fields
}

TabPool manages a pool of browser tabs using a channel.

func NewTabPool

func NewTabPool(ctx context.Context, browser *rod.Browser, tabPool int) *TabPool

type ViewportConfig

type ViewportConfig struct {
	Width             int
	Height            int
	DeviceScaleFactor float64
	IsMobile          bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL