handlers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: GPL-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServiceNotConfigured = errors.New("service not configured")

Functions

func DeleteSWRCacheKeys added in v0.3.0

func DeleteSWRCacheKeys(ctx context.Context, store cache.Store, key string) error

func EncodeHealthAsSSE added in v0.3.0

func EncodeHealthAsSSE(health models.ServiceHealth) []byte

func FetchWithSWRCache added in v0.3.0

func FetchWithSWRCache[T any](ctx context.Context, opts SWRCacheOptions[T]) (T, error)

FetchWithSWRCache implements a stale-while-revalidate pattern: - return cached value if present - if circuit is open, return stale value if present - otherwise fetch (with backoff retries), cache, and return - on fetch failure, return stale value if present

func GetAuthConfig

func GetAuthConfig(c *gin.Context)

GetAuthConfig returns the available authentication methods

func NewServiceNotConfigured added in v0.3.0

func NewServiceNotConfigured(service string) error

Types

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(config *types.AuthConfig, store cache.Store) *AuthHandler

func (*AuthHandler) Callback

func (h *AuthHandler) Callback(c *gin.Context)

func (*AuthHandler) Login

func (h *AuthHandler) Login(c *gin.Context)

func (*AuthHandler) Logout

func (h *AuthHandler) Logout(c *gin.Context)

func (*AuthHandler) UserInfo

func (h *AuthHandler) UserInfo(c *gin.Context)

func (*AuthHandler) VerifyToken

func (h *AuthHandler) VerifyToken(c *gin.Context)

type AutobrrHandler

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

func NewAutobrrHandler

func NewAutobrrHandler(db *database.DB, store cache.Store, bc *Broadcaster) *AutobrrHandler

func (*AutobrrHandler) GetAutobrrIRCStatus

func (h *AutobrrHandler) GetAutobrrIRCStatus(c *gin.Context)

func (*AutobrrHandler) GetAutobrrReleaseStats

func (h *AutobrrHandler) GetAutobrrReleaseStats(c *gin.Context)

func (*AutobrrHandler) GetAutobrrReleases added in v0.3.0

func (h *AutobrrHandler) GetAutobrrReleases(c *gin.Context)

type BazarrHandler added in v0.3.0

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

func NewBazarrHandler added in v0.3.0

func NewBazarrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *BazarrHandler

func (*BazarrHandler) GetSummary added in v0.3.0

func (h *BazarrHandler) GetSummary(c *gin.Context)

type Broadcaster added in v0.3.0

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

Broadcaster publishes service updates to SSE clients.

func NewBroadcaster added in v0.3.0

func NewBroadcaster(hub *sse.Hub) *Broadcaster

func (*Broadcaster) Publish added in v0.3.0

func (b *Broadcaster) Publish(health models.ServiceHealth)

func (*Broadcaster) PublishLatest added in v0.3.0

func (b *Broadcaster) PublishLatest(serviceID string) bool

PublishLatest re-publishes the latest known service payload to active subscribers. Returns false when no cached payload exists for the service.

func (*Broadcaster) Snapshot added in v0.3.0

func (b *Broadcaster) Snapshot() [][]byte

Snapshot returns last known payloads per service for initial SSE replay.

type BuiltinAuthHandler

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

func NewBuiltinAuthHandler

func NewBuiltinAuthHandler(db *database.DB, cache cache.Store) *BuiltinAuthHandler

func (*BuiltinAuthHandler) CheckRegistrationStatus

func (h *BuiltinAuthHandler) CheckRegistrationStatus(c *gin.Context)

CheckRegistrationStatus checks if registration is allowed (no users exist)

func (*BuiltinAuthHandler) GetUserInfo

func (h *BuiltinAuthHandler) GetUserInfo(c *gin.Context)

GetUserInfo returns the current user's information

func (*BuiltinAuthHandler) Login

func (h *BuiltinAuthHandler) Login(c *gin.Context)

Login handles user login

func (*BuiltinAuthHandler) Logout

func (h *BuiltinAuthHandler) Logout(c *gin.Context)

Logout handles user logout

func (*BuiltinAuthHandler) Register

func (h *BuiltinAuthHandler) Register(c *gin.Context)

Register handles user registration

func (*BuiltinAuthHandler) Verify

func (h *BuiltinAuthHandler) Verify(c *gin.Context)

Verify verifies the session token

type DatabaseService

type DatabaseService interface {
	FindServiceBy(ctx context.Context, params types.FindServiceParams) (*models.ServiceConfiguration, error)
}

DatabaseService defines the database operations needed by HealthHandler

type EventsHandler

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

func NewEventsHandler

func NewEventsHandler(hub *sse.Hub, bc *Broadcaster) *EventsHandler

func (*EventsHandler) Stream added in v0.3.0

func (h *EventsHandler) Stream(c *gin.Context)

Stream streams all published service updates. Contract: default SSE message events, each is JSON `models.ServiceHealth`.

type HealthHandler

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

func NewHealthHandler

func NewHealthHandler(db DatabaseService, creator ...models.ServiceCreator) *HealthHandler

func (*HealthHandler) CheckHealth

func (h *HealthHandler) CheckHealth(c *gin.Context)

type JellyfinHandler added in v0.3.0

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

func NewJellyfinHandler added in v0.3.0

func NewJellyfinHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *JellyfinHandler

func (*JellyfinHandler) GetSummary added in v0.3.0

func (h *JellyfinHandler) GetSummary(c *gin.Context)

type LidarrHandler added in v0.3.0

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

func NewLidarrHandler added in v0.3.0

func NewLidarrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *LidarrHandler

func (*LidarrHandler) DeleteQueueItem added in v0.3.0

func (h *LidarrHandler) DeleteQueueItem(c *gin.Context)

func (*LidarrHandler) GetQueue added in v0.3.0

func (h *LidarrHandler) GetQueue(c *gin.Context)

type MaintainerrHandler

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

func NewMaintainerrHandler

func NewMaintainerrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *MaintainerrHandler

func (*MaintainerrHandler) GetMaintainerrCollections

func (h *MaintainerrHandler) GetMaintainerrCollections(c *gin.Context)

type NzbgetHandler added in v0.3.0

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

func NewNzbgetHandler added in v0.3.0

func NewNzbgetHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *NzbgetHandler

func (*NzbgetHandler) GetSummary added in v0.3.0

func (h *NzbgetHandler) GetSummary(c *gin.Context)

type OverseerrHandler

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

func NewOverseerrHandler

func NewOverseerrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *OverseerrHandler

func (*OverseerrHandler) GetRequests

func (h *OverseerrHandler) GetRequests(c *gin.Context)

func (*OverseerrHandler) UpdateRequestStatus

func (h *OverseerrHandler) UpdateRequestStatus(c *gin.Context)

type PlexAuthHandler added in v0.3.0

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

func NewPlexAuthHandler added in v0.3.0

func NewPlexAuthHandler() *PlexAuthHandler

func (*PlexAuthHandler) CreatePIN added in v0.3.0

func (h *PlexAuthHandler) CreatePIN(c *gin.Context)

func (*PlexAuthHandler) GetPIN added in v0.3.0

func (h *PlexAuthHandler) GetPIN(c *gin.Context)

type PlexHandler

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

func NewPlexHandler

func NewPlexHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *PlexHandler

func (*PlexHandler) GetPlexSessions

func (h *PlexHandler) GetPlexSessions(c *gin.Context)

type Poller added in v0.3.0

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

func NewPoller added in v0.3.0

func NewPoller(db *database.DB, bc *Broadcaster) *Poller

func (*Poller) Refresh added in v0.3.0

func (p *Poller) Refresh(instanceID string)

func (*Poller) Start added in v0.3.0

func (p *Poller) Start(ctx context.Context)

type ProwlarrHandler

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

func NewProwlarrHandler

func NewProwlarrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *ProwlarrHandler

func (*ProwlarrHandler) GetIndexerStats added in v0.3.0

func (h *ProwlarrHandler) GetIndexerStats(c *gin.Context)

func (*ProwlarrHandler) GetIndexers

func (h *ProwlarrHandler) GetIndexers(c *gin.Context)

func (*ProwlarrHandler) GetStats

func (h *ProwlarrHandler) GetStats(c *gin.Context)

type QueueRecordWrapper added in v0.3.0

type QueueRecordWrapper struct {
	ID     int
	Title  string
	Status string
	Size   int64
}

QueueRecordWrapper is a common wrapper for queue records

type RadarrHandler

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

func NewRadarrHandler

func NewRadarrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *RadarrHandler

func (*RadarrHandler) DeleteQueueItem

func (h *RadarrHandler) DeleteQueueItem(c *gin.Context)

DeleteQueueItem handles the deletion of a queue item with specified options

func (*RadarrHandler) GetQueue

func (h *RadarrHandler) GetQueue(c *gin.Context)

type ReadarrHandler added in v0.3.0

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

func NewReadarrHandler added in v0.3.0

func NewReadarrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *ReadarrHandler

func (*ReadarrHandler) DeleteQueueItem added in v0.3.0

func (h *ReadarrHandler) DeleteQueueItem(c *gin.Context)

func (*ReadarrHandler) GetQueue added in v0.3.0

func (h *ReadarrHandler) GetQueue(c *gin.Context)

type SWRCacheOptions added in v0.3.0

type SWRCacheOptions[T any] struct {
	Store          cache.Store
	Key            string
	FreshTTL       time.Duration
	StaleTTL       time.Duration
	CircuitBreaker *resilience.CircuitBreaker
	Fetch          func() (T, error)

	// Optional stampede protection. Only applies on cache miss.
	Singleflight    *singleflight.Group
	SingleflightKey string
}

type SabnzbdHandler added in v0.3.0

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

func NewSabnzbdHandler added in v0.3.0

func NewSabnzbdHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *SabnzbdHandler

func (*SabnzbdHandler) GetSummary added in v0.3.0

func (h *SabnzbdHandler) GetSummary(c *gin.Context)

type ServiceNotConfiguredError added in v0.3.0

type ServiceNotConfiguredError struct {
	Service string
}

func (*ServiceNotConfiguredError) Error added in v0.3.0

func (e *ServiceNotConfiguredError) Error() string

func (*ServiceNotConfiguredError) Unwrap added in v0.3.0

func (e *ServiceNotConfiguredError) Unwrap() error

type SettingsHandler

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

func NewSettingsHandler

func NewSettingsHandler(db *database.DB, cache cache.Store, poller *Poller) *SettingsHandler

func (*SettingsHandler) DeleteSettings

func (h *SettingsHandler) DeleteSettings(c *gin.Context)

func (*SettingsHandler) GetSettings

func (h *SettingsHandler) GetSettings(c *gin.Context)

func (*SettingsHandler) SaveSettings

func (h *SettingsHandler) SaveSettings(c *gin.Context)

type SonarrHandler

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

func NewSonarrHandler

func NewSonarrHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *SonarrHandler

func (*SonarrHandler) DeleteQueueItem

func (h *SonarrHandler) DeleteQueueItem(c *gin.Context)

func (*SonarrHandler) GetQueue

func (h *SonarrHandler) GetQueue(c *gin.Context)

func (*SonarrHandler) GetStats

func (h *SonarrHandler) GetStats(c *gin.Context)

type TailscaleHandler

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

func NewTailscaleHandler

func NewTailscaleHandler(db *database.DB, cache cache.Store) *TailscaleHandler

func (*TailscaleHandler) GetTailscaleDevices

func (h *TailscaleHandler) GetTailscaleDevices(c *gin.Context)

type TraefikHandler added in v0.3.0

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

func NewTraefikHandler added in v0.3.0

func NewTraefikHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *TraefikHandler

func (*TraefikHandler) GetSummary added in v0.3.0

func (h *TraefikHandler) GetSummary(c *gin.Context)

type UIPreferencesHandler added in v0.3.0

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

func NewUIPreferencesHandler added in v0.3.0

func NewUIPreferencesHandler(db *database.DB) *UIPreferencesHandler

func (*UIPreferencesHandler) GetCollapsePreferences added in v0.3.0

func (h *UIPreferencesHandler) GetCollapsePreferences(c *gin.Context)

func (*UIPreferencesHandler) UpsertCollapsePreference added in v0.3.0

func (h *UIPreferencesHandler) UpsertCollapsePreference(c *gin.Context)

type UptimeKumaHandler added in v0.3.0

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

func NewUptimeKumaHandler added in v0.3.0

func NewUptimeKumaHandler(db *database.DB, cache cache.Store, bc *Broadcaster) *UptimeKumaHandler

func (*UptimeKumaHandler) GetSummary added in v0.3.0

func (h *UptimeKumaHandler) GetSummary(c *gin.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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