pro

package
v7.6.26 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: GPL-3.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIHandler

func APIHandler(uc common.UserConfig) http.Handler

APIHandler returns an HTTP handler that specifically looks for and properly handles pro server requests.

func FetchUserData

func FetchUserData(uc common.UserConfig) (*client.User, error)

FetchUserData fetches user data from Pro API, and updates local cache.

func GetHTTPClient

func GetHTTPClient() *http.Client

GetHTTPClient creates a new http.Client that uses domain fronting and direct proxies.

func GetUserDataFast

func GetUserDataFast(userID int64) (*client.User, bool)

GetUserDataFast gets the user data for the given userID if found.

func IsProUser

func IsProUser(uc common.UserConfig) (isPro bool, statusKnown bool)

IsProUser indicates whether or not the user is pro, calling the Pro API if necessary to determine the status.

func IsProUserFast

func IsProUserFast(uc common.UserConfig) (isPro bool, statusKnown bool)

IsProUserFast indicates whether or not the user is pro and whether or not the user's status is know, never calling the Pro API to determine the status.

func MigrateDeviceID

func MigrateDeviceID(uc common.UserConfig, oldDeviceID string) error

MigrateDeviceID migrates the user's device ID from the old to the new scheme (only relevant to desktop builds)

func NewUser

func NewUser(uc common.UserConfig) (*client.User, error)

NewUser creates a new user via Pro API, and updates local cache.

func OnProStatusChange

func OnProStatusChange(cb func(isPro bool, yinbiEnabled bool))

OnProStatusChange allows registering an event handler to learn when the user's pro status or "yinbi enabled" status has changed.

func OnUserData

func OnUserData(cb func(current *client.User, new *client.User))

OnUserData allows registering an event handler to learn when the user data has been fetched.

func PrepareProRequest

func PrepareProRequest(r *http.Request, uc common.UserConfig)

PrepareProRequest normalizes requests to the pro server without overwriting device ID, user ID, etc.

func PrepareProRequestWithOptions

func PrepareProRequestWithOptions(r *http.Request, uc common.UserConfig)

PrepareProRequestWithOptions normalizes requests to the pro server with device ID, user ID, etc set.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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