Documentation
¶
Overview ¶
Package client provides the low level assembly of the Notifiarr client application. This package orchestrates reading in of configuration, parsing cli flags, actioning those cli flags, setting up logging, and finally the starting of internal service routines for the webserver, plex sessions, snapshots, service checks and others. This package sets everything up for the client application.
Index ¶
- Variables
- func Fortune() string
- func Start() error
- type BrowseDir
- type Client
- func (c *Client) Exit(ctx context.Context, reload func()) error
- func (c *Client) PlexHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) PrintStartupInfo(ctx context.Context, clientInfo *clientinfo.ClientInfo)
- func (c *Client) RunWebServer()
- func (c *Client) SetupWebServer()
- func (c *Client) StopWebServer(ctx context.Context) error
- type Integrations
- type Profile
- type ProfilePost
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupport = errors.New("this feature is not supported on this platform") ErrNilAPIKey = errors.New("API key may not be empty: set a key in config file, OR with environment variable") )
Errors returned by this package.
var ErrConfigVersionMismatch = errors.New("config version mismatch")
var (
ErrInvalidHeader = errors.New("invalid header provided; must contain a colon")
)
Errors.
Functions ¶
Types ¶
type BrowseDir ¶ added in v0.9.0
type BrowseDir struct {
Sep string `json:"sep"` // Filepath separator.
Path string `json:"path"` // Current directory path.
Mom string `json:"mom"` // Parent directory path.
Dirs []string `json:"dirs"` // Directories in the current directory.
Files []string `json:"files"` // Files in the current directory.
Error string `json:"error"` // Error message.
}
type Client ¶
type Client struct {
Flags *configfile.Flags
Config *configfile.Config
Services *services.Services
// this locks anything that may be updated while running.
// at least "UIPassword" and "reloading" as of its creation.
sync.RWMutex
// contains filtered or unexported fields
}
Client stores all the running data.
func (*Client) PlexHandler ¶ added in v0.3.2
func (c *Client) PlexHandler(w http.ResponseWriter, r *http.Request)
PlexHandler handles an incoming webhook from Plex.
@Summary Accept Plex Media Server Webhook
@Description Accepts a Plex webhook; when conditions are satisfied sends a notification to the website,
@Description and may include snapshot data and/or fetched session data. Does not require X-API-Key header.
@Tags Plex
@Accept json
@Produce text/plain
@Param token query string true "Plex Token or Client API Key"
@Param POST body plex.IncomingWebhook true "webhook payload"
@Success 202 {string} string "accepted"
@Success 208 {string} string "ignored"
@Failure 400 {string} string "bad input"
@Failure 404 {string} string "bad token or api key"
@Router /plex [post]
func (*Client) PrintStartupInfo ¶
func (c *Client) PrintStartupInfo(ctx context.Context, clientInfo *clientinfo.ClientInfo)
PrintStartupInfo prints info about our startup config. This runs once on startup, and again during reloads.
func (*Client) RunWebServer ¶ added in v0.9.0
func (c *Client) RunWebServer()
RunWebServer starts the http or https listener.
func (*Client) SetupWebServer ¶ added in v0.9.0
func (c *Client) SetupWebServer()
SetupWebServer starts the web server.
type Integrations ¶ added in v0.9.0
type Integrations struct {
Snapshot *snapshot.Snapshot `json:"snapshot"`
SnapshotAge time.Time `json:"snapshotAge"`
Plex *plex.PMSInfo `json:"plex"`
PlexAge time.Time `json:"plexAge"`
Sessions *plex.Sessions `json:"sessions"`
SessionsAge time.Time `json:"sessionsAge"`
Dashboard *dashboard.States `json:"dashboard"`
DashboardAge time.Time `json:"dashboardAge"`
TautulliUsers *tautulli.Users `json:"tautulliUsers"`
TautulliUsersAge time.Time `json:"tautulliUsersAge"`
Tautulli *tautulli.Info `json:"tautulli"`
TautulliAge time.Time `json:"tautulliAge"`
Lidarr struct {
Status []*lidarr.SystemStatus `json:"status"`
StatusAge []time.Time `json:"statusAge"`
Queue []*lidarr.Queue `json:"queue"`
QueueAge []time.Time `json:"queueAge"`
} `json:"lidarr"`
Radarr struct {
Status []*radarr.SystemStatus `json:"status"`
StatusAge []time.Time `json:"statusAge"`
Queue []*radarr.Queue `json:"queue"`
QueueAge []time.Time `json:"queueAge"`
} `json:"radarr"`
Readarr struct {
Status []*readarr.SystemStatus `json:"status"`
StatusAge []time.Time `json:"statusAge"`
Queue []*readarr.Queue `json:"queue"`
QueueAge []time.Time `json:"queueAge"`
} `json:"readarr"`
Sonarr struct {
Status []*sonarr.SystemStatus `json:"status"`
StatusAge []time.Time `json:"statusAge"`
Queue []*sonarr.Queue `json:"queue"`
QueueAge []time.Time `json:"queueAge"`
} `json:"sonarr"`
Prowlarr struct {
Status []*prowlarr.SystemStatus `json:"status"`
StatusAge []time.Time `json:"statusAge"`
} `json:"prowlarr"`
}
Integrations is the data returned by the UI integrations endpoint.
type Profile ¶ added in v0.9.0
type Profile struct {
Username string `json:"username"`
Config configfile.Config `json:"config"`
ClientInfo *clientinfo.ClientInfo `json:"clientInfo"`
IsWindows bool `json:"isWindows"`
IsLinux bool `json:"isLinux"`
IsDarwin bool `json:"isDarwin"`
IsDocker bool `json:"isDocker"`
IsUnstable bool `json:"isUnstable"`
IsFreeBSD bool `json:"isFreeBsd"`
IsSynology bool `json:"isSynology"`
Headers http.Header `json:"headers"`
Fortune string `json:"fortune"`
UpstreamIP string `json:"upstreamIp"`
UpstreamAllowed bool `json:"upstreamAllowed"`
UpstreamHeader string `json:"upstreamHeader"`
UpstreamType configfile.AuthType `json:"upstreamType"`
Languages frontend.Languages `json:"languages"`
Triggers []common.TriggerInfo `json:"triggers"`
Timers []common.TriggerInfo `json:"timers"`
Schedules []common.TriggerInfo `json:"schedules"`
SiteCrons []*crontimer.Timer `json:"siteCrons"`
PlexInfo *plex.PMSInfo `json:"plexInfo"`
PlexAge time.Time `json:"plexAge"`
// LoggedIn is only used by the front end. Backend does not set or use it.
LoggedIn bool `json:"loggedIn"`
Updated time.Time `json:"updated"`
Flags *configfile.Flags `json:"flags"`
Dynamic bool `json:"dynamic"`
Webauth bool `json:"webauth"`
Msg string `json:"msg,omitempty"`
LogFiles *logs.LogFileInfos `json:"logFileInfo"`
ConfigFiles *logs.LogFileInfos `json:"configFileInfo"`
Expvar mnd.AllData `json:"expvar"`
HostInfo *host.InfoStat `json:"hostInfo"`
Disks map[string]*snapshot.Partition `json:"disks"`
ProxyAllow bool `json:"proxyAllow"`
PoolStats map[string]*mulery.PoolSize `json:"poolStats"`
Started time.Time `json:"started"`
CmdList []*cmdconfig.Config `json:"cmdList"`
CheckResults []*services.CheckResult `json:"checkResults"`
CheckRunning bool `json:"checkRunning"`
CheckDisabled bool `json:"checkDisabled"`
Program string `json:"program"`
Version string `json:"version"`
Revision string `json:"revision"`
Branch string `json:"branch"`
BuildUser string `json:"buildUser"`
BuildDate string `json:"buildDate"`
GoVersion string `json:"goVersion"`
OS string `json:"os"`
Arch string `json:"arch"`
Binary string `json:"binary"`
Environment map[string]string `json:"environment"`
Docker bool `json:"docker"`
UID int `json:"uid"`
GID int `json:"gid"`
IP string `json:"ip"`
Gateway string `json:"gateway"`
IfName string `json:"ifName"`
Netmask string `json:"netmask"`
MD5 string `json:"md5"`
ActiveTunnel string `json:"activeTunnel"`
TunnelPoolStats map[string]*mulery.PoolSize `json:"tunnelPoolStats"`
}
Profile is the data returned by the profile GET endpoint. Basically everything.
type ProfilePost ¶ added in v0.9.0
type ProfilePost struct {
Username string `json:"username"`
Password string `json:"password"`
AuthType configfile.AuthType `json:"authType"`
Header string `json:"header"`
NewPass string `json:"newPass"`
Upstreams string `json:"upstreams"`
}
ProfilePost is the data sent to the profile POST endpoint when updating the trust profile.