Documentation
¶
Index ¶
- Variables
- func GetFormatRank(format string, ranking []string) int
- func RateLimitMiddleware(rl *RateLimiter, next http.Handler) http.Handler
- type ExportEnvelope
- type MetricsCollector
- type OIDCHandler
- type PendingTOTP
- type RateLimiter
- type ScannedFile
- type Server
- type SessionData
- type SessionStore
- func (s *SessionStore) Create(userID int64, username, role string) string
- func (s *SessionStore) CreatePendingTOTP(userID int64) string
- func (s *SessionStore) Delete(token string)
- func (s *SessionStore) Get(token string) (*SessionData, bool)
- func (s *SessionStore) Valid(token string) bool
- func (s *SessionStore) ValidatePendingTOTP(token string) (int64, bool)
Constants ¶
This section is empty.
Variables ¶
var ( Version = "1.0.0" BuildTime = "unknown" GoVersion = runtime.Version() )
Set at build time via -ldflags
Functions ¶
func GetFormatRank ¶ added in v1.0.0
GetFormatRank returns the rank index of a format in the quality profile. Lower rank = better. Returns -1 if not found.
func RateLimitMiddleware ¶
func RateLimitMiddleware(rl *RateLimiter, next http.Handler) http.Handler
RateLimitMiddleware wraps an HTTP handler with rate limiting.
Types ¶
type ExportEnvelope ¶ added in v1.0.0
type ExportEnvelope struct {
Version string `json:"version"`
ExportedAt string `json:"exported_at"`
ItemCount int `json:"item_count"`
Items interface{} `json:"items"`
}
ExportEnvelope wraps exported data with metadata.
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector tracks simple counters for Prometheus exposition.
func NewMetricsCollector ¶
func NewMetricsCollector() *MetricsCollector
NewMetricsCollector creates a new metrics collector.
type OIDCHandler ¶
type OIDCHandler struct {
// contains filtered or unexported fields
}
OIDCHandler manages OIDC authentication flow.
func NewOIDCHandler ¶
func NewOIDCHandler(cfg *config.Config, database *db.DB, sessions *SessionStore) *OIDCHandler
NewOIDCHandler initializes the OIDC provider and returns a handler. Returns nil if OIDC is not configured.
func (*OIDCHandler) HandleCallback ¶
func (h *OIDCHandler) HandleCallback(w http.ResponseWriter, r *http.Request)
HandleCallback handles the OIDC provider callback.
func (*OIDCHandler) HandleLogin ¶
func (h *OIDCHandler) HandleLogin(w http.ResponseWriter, r *http.Request)
HandleLogin redirects to the OIDC provider.
type PendingTOTP ¶
PendingTOTP holds a pending TOTP verification.
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter is an in-memory per-IP rate limiter with per-route rules.
func NewRateLimiter ¶
func NewRateLimiter(windowSec int, rules map[string]int) *RateLimiter
NewRateLimiter creates a rate limiter with the given window and rules.
type ScannedFile ¶ added in v1.0.0
type ScannedFile struct {
Path string `json:"path"`
Name string `json:"name"`
Size int64 `json:"size"`
Format string `json:"format"`
Title string `json:"title"`
Author string `json:"author"`
}
ScannedFile represents a file found during directory scan.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the API dependencies.
func NewServer ¶
func NewServer(cfg *config.Config, database *db.DB, searchMgr *search.Manager, downloadMgr *download.Manager, qb *download.QBittorrentClient, sab *download.SABnzbdClient, organizer *organize.Organizer, targets *organize.LibraryTargets) *Server
NewServer creates the HTTP API server.
func (*Server) StartScheduler ¶ added in v1.0.0
StartScheduler starts the background scheduler loop.
type SessionData ¶
SessionData holds session metadata.
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore manages session-based authentication with user tracking.
func NewSessionStore ¶
func NewSessionStore() *SessionStore
NewSessionStore creates a new session store.
func (*SessionStore) Create ¶
func (s *SessionStore) Create(userID int64, username, role string) string
Create generates a new session token for a user, valid for 24 hours.
func (*SessionStore) CreatePendingTOTP ¶
func (s *SessionStore) CreatePendingTOTP(userID int64) string
CreatePendingTOTP creates a temporary token for TOTP verification (5 min expiry).
func (*SessionStore) Get ¶
func (s *SessionStore) Get(token string) (*SessionData, bool)
Get retrieves session data if the token is valid.
func (*SessionStore) Valid ¶
func (s *SessionStore) Valid(token string) bool
Valid checks if a session token is valid and not expired (backward compat).
func (*SessionStore) ValidatePendingTOTP ¶
func (s *SessionStore) ValidatePendingTOTP(token string) (int64, bool)
ValidatePendingTOTP checks and consumes a pending TOTP token.
Source Files
¶
- admin.go
- auth.go
- authors.go
- backup.go
- blocklist.go
- csv.go
- download.go
- goodreads.go
- health.go
- history.go
- importexport.go
- library.go
- library_external.go
- manualimport.go
- metrics.go
- notifications.go
- oidc.go
- opds.go
- quality.go
- ratelimit.go
- releaseprofiles.go
- requests.go
- router.go
- scheduler_handler.go
- search.go
- settings.go
- tags.go
- totp.go
- upload.go
- webhooks.go