config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCookieFileMissing = errors.New("cookie file missing")

Functions

func ApplyCookiesFromFile

func ApplyCookiesFromFile(cfg *EssentialsConfig, path string) error

func ApplyCookiesFromFileAndPersist

func ApplyCookiesFromFileAndPersist(cfg *EssentialsConfig, cookiePath, essentialsPath string) error

func SaveEssentials

func SaveEssentials(cfg *EssentialsConfig, path string) error

Types

type AuthCookies

type AuthCookies struct {
	GuestID   string `json:"guest_id"`
	AuthToken string `json:"auth_token"`
	Ct0       string `json:"ct0"`
}

type AuthSection

type AuthSection struct {
	Bearer  string      `json:"bearer"`
	Cookies AuthCookies `json:"cookies"`
}

type BrowserCookie

type BrowserCookie struct {
	Domain string `json:"domain"`
	Name   string `json:"name"`
	Value  string `json:"value"`
	Path   string `json:"path"`
	Secure bool   `json:"secure"`
}

type EssentialsConfig

type EssentialsConfig struct {
	X        XSection          `json:"x,omitempty"`
	GraphQL  GraphQLSection    `json:"graphql"`
	Auth     AuthSection       `json:"auth"`
	Headers  map[string]string `json:"headers"`
	Features FeaturesSection   `json:"features"`
	Paths    PathsSection      `json:"paths"`
	Runtime  RuntimeSection    `json:"runtime"`
}

func LoadEssentialsWithFallback

func LoadEssentialsWithFallback(paths []string) (*EssentialsConfig, error)

func (*EssentialsConfig) BuildRequestHeaders

func (c *EssentialsConfig) BuildRequestHeaders(req *http.Request, ref string)

func (*EssentialsConfig) FeatureJSONFor

func (c *EssentialsConfig) FeatureJSONFor(key string) (string, error)

func (*EssentialsConfig) GraphQLURL

func (c *EssentialsConfig) GraphQLURL(key string) (string, error)

func (*EssentialsConfig) HTTPTimeout

func (c *EssentialsConfig) HTTPTimeout() time.Duration

func (*EssentialsConfig) ValidateRequiredCookies

func (c *EssentialsConfig) ValidateRequiredCookies(cookiePath string) error

type FeaturesSection

type FeaturesSection struct {
	User  map[string]any `json:"user"`
	Media map[string]any `json:"media"`
}

type GraphQLOperation

type GraphQLOperation struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
}

type GraphQLSection

type GraphQLSection struct {
	Operations map[string]GraphQLOperation `json:"operations"`
}

type PathsSection

type PathsSection struct {
	Logs     string `json:"logs"`
	Debug    string `json:"debug"`
	DebugRaw string `json:"debug_raw"`
	Exports  string `json:"exports"`
}

type RuntimeSection

type RuntimeSection struct {
	DebugEnabled   bool   `json:"debug_enabled"`
	TimeoutSeconds int    `json:"timeout_seconds"`
	MaxRetries     int    `json:"max_retries"`
	LimiterSecret  string `json:"limiter_secret"`
}

type XSection

type XSection struct {
	Network string `json:"network"`
}

Jump to

Keyboard shortcuts

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