chrome

package
v0.0.0-...-3aef210 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MPL-2.0 Imports: 25 Imported by: 0

README

Digiposte login module

This module is used to login to digiposte.fr.

This module exists because digiposte.fr does not provide oauth2 credentials to third party applications. This module will get the credentials from the digiposte.fr website and store them in the rclone config file.

Documentation

Index

Constants

View Source
const (
	ConfigURL       = "url"
	ConfigCookieJar = "cookie"
)
View Source
const (
	// DefaultRefreshFrequency is the default refresh frequency for the login process.
	DefaultRefreshFrequency = 1500 * time.Millisecond
)

Variables

This section is empty.

Functions

func GetScreenShot

func GetScreenShot(err error) ([]byte, bool)

func New

func New(opts ...login.Option) (login.Method, error)

New creates a new chrome login method. It requires chromedp to be installed.

func WithBinary

func WithBinary(path string) login.Option

WithBinary sets the path to the chrome binary to be used for the login process.

func WithCancelOnClose

func WithCancelOnClose(ctx context.Context, done <-chan struct{}) (context.Context, context.CancelFunc)

func WithChromeVersion

func WithChromeVersion(ctx context.Context, revision int, client *http.Client) login.Option

WithChromeVersion sets the version of chrome to be used for the login process.

func WithCookies

func WithCookies(cookies []*http.Cookie) login.Option

WithCookies sets the cookies to be used for the login process.

func WithLoggers

func WithLoggers(infoLgr, errorLgr *log.Logger) login.Option

WithLoggers sets the loggers to be used for the login process.

func WithRefreshFrequency

func WithRefreshFrequency(frequency time.Duration) login.Option

WithRefreshFrequency sets the frequency at which the login process will be refreshed.

func WithScreenShortOnError

func WithScreenShortOnError() login.Option

WithScreenShortOnError sets the option to take a screenshot when an error occurs.

func WithTimeout

func WithTimeout(timeout time.Duration) login.Option

WithTimeout sets the timeout for the login process.

func WithURL

func WithURL(url string) login.Option

WithURL sets the URL to which the login process will be directed.

Types

type HTTPError

type HTTPError struct {
	Status     int64
	StatusText string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type InvalidTokenError

type InvalidTokenError struct {
	Token *oauth2.Token
}

func (*InvalidTokenError) Error

func (e *InvalidTokenError) Error() string

type InvalidTypeOptionError

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

func (*InvalidTypeOptionError) Error

func (e *InvalidTypeOptionError) Error() string

type MissingOptionError

type MissingOptionError struct {
	Option string
}

func (*MissingOptionError) Error

func (e *MissingOptionError) Error() string

func (*MissingOptionError) Is

func (e *MissingOptionError) Is(target error) bool

type Screen

type Screen interface {
	fmt.Stringer
	CurrentPageMatches(ctx context.Context) bool
	ShouldWaitForResponse() bool
	chromedp.Action
}

type Screens

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

func (*Screens) Resolve

func (s *Screens) Resolve(ctx context.Context)

func (*Screens) Succeeded

func (s *Screens) Succeeded() bool

type Validatable

type Validatable interface {
	Validate() error
}

type WithLocationError

type WithLocationError struct {
	Err      error
	Location string
}

func (*WithLocationError) Error

func (e *WithLocationError) Error() string

type WithScreenshotError

type WithScreenshotError struct {
	Err        error
	Screenshot []byte
}

func (*WithScreenshotError) Error

func (e *WithScreenshotError) Error() string

func (*WithScreenshotError) Unwrap

func (e *WithScreenshotError) Unwrap() error

Jump to

Keyboard shortcuts

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