backend

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App struct for the Wails application

func NewApp

func NewApp() *App

NewApp creates a new App application struct

func (*App) AddFilesToQueue

func (a *App) AddFilesToQueue() error

AddFilesToQueue adds multiple files to the queue for processing

func (*App) ApplyPendingConfig added in v0.0.13

func (a *App) ApplyPendingConfig() error

ApplyPendingConfig manually applies pending configuration changes

func (*App) CancelJob

func (a *App) CancelJob(id string) error

CancelJob cancels a running job via processor

func (*App) CancelUpload

func (a *App) CancelUpload() error

CancelUpload is no longer used - individual jobs are cancelled via CancelJob This function is kept for backward compatibility but does nothing

func (*App) ClearQueue

func (a *App) ClearQueue() error

ClearQueue removes all completed and failed items from the queue via queue

func (*App) DebugQueueItem

func (a *App) DebugQueueItem(id string) (map[string]interface{}, error)

DebugQueueItem returns debug information about a queue item

func (*App) DiscardPendingConfig added in v0.0.13

func (a *App) DiscardPendingConfig() error

DiscardPendingConfig discards pending configuration changes

func (*App) DownloadNZB

func (a *App) DownloadNZB(id string) error

DownloadNZB downloads the NZB file for a completed item

func (*App) GetAppStatus

func (a *App) GetAppStatus() AppStatus

GetAppStatus returns the current application status

func (*App) GetAppliedConfig added in v0.0.13

func (a *App) GetAppliedConfig() (*config.ConfigData, error)

GetAppliedConfig returns the currently applied configuration (ignoring pending)

func (*App) GetAutoPauseReason added in v0.0.20

func (a *App) GetAutoPauseReason() string

GetAutoPauseReason returns the reason for automatic pause, if any

func (*App) GetConfig

func (a *App) GetConfig() (*config.ConfigData, error)

GetConfig returns the current configuration (pending config if available, otherwise applied config)

func (*App) GetConfigPath

func (a *App) GetConfigPath() string

GetConfigPath returns the path to the configuration file

func (*App) GetLoggingStatus added in v0.0.10

func (a *App) GetLoggingStatus() map[string]interface{}

GetLoggingStatus returns information about logging configuration

func (*App) GetLogs

func (a *App) GetLogs() (string, error)

GetLogs returns the content of the log file.

func (*App) GetLogsPaginated

func (a *App) GetLogsPaginated(limit, offset int) (string, error)

GetLogsPaginated returns paginated log content limit: number of lines to return (0 = use original 1MB limit) offset: number of lines to skip from the end (0 = start from most recent)

func (*App) GetMigrationStatus added in v0.0.22

func (a *App) GetMigrationStatus() (map[string]interface{}, error)

GetMigrationStatus returns the current migration status

func (*App) GetNZB added in v0.0.22

func (a *App) GetNZB(id string) (content string, fileName string, err error)

GetNZBContent returns the content of an NZB file for a completed item

func (*App) GetNntpPoolMetrics added in v0.0.16

func (a *App) GetNntpPoolMetrics() (NntpPoolMetrics, error)

GetNntpPoolMetrics returns NNTP connection pool metrics from the singleton pool manager

func (*App) GetOutputDirectory

func (a *App) GetOutputDirectory() string

GetOutputDirectory returns the current output directory

func (*App) GetPendingConfigStatus added in v0.0.13

func (a *App) GetPendingConfigStatus() map[string]interface{}

GetPendingConfigStatus returns the status of pending config changes

func (*App) GetProcessorStatus

func (a *App) GetProcessorStatus() ProcessorStatus

GetProcessorStatus returns processor status information

func (*App) GetQueueItems

func (a *App) GetQueueItems(params PaginationParams) (*PaginatedQueueResult, error)

GetQueueItems returns the current queue items from the queue

func (*App) GetQueueStats

func (a *App) GetQueueStats() (QueueStats, error)

GetQueueStats returns statistics about the queue via queue

func (*App) GetRunningJobs

func (a *App) GetRunningJobs() ([]processor.RunningJobItem, error)

GetRunningJobs returns currently running jobs from the processor

func (*App) GetRunningJobsDetails added in v0.0.13

func (a *App) GetRunningJobsDetails() ([]processor.RunningJobDetails, error)

GetRunningJobsDetails returns detailed information about currently running jobs

func (*App) GetWatchDirectory

func (a *App) GetWatchDirectory() string

GetWatchDirectory returns the current watch directory

func (*App) GetWatcherStatus added in v0.0.24

func (a *App) GetWatcherStatus() watcher.WatcherStatusInfo

GetWatcherStatus returns the current status of the watcher

func (*App) HandleDroppedFiles

func (a *App) HandleDroppedFiles(filePaths []string) error

HandleDroppedFiles processes files that are dropped onto the application window

func (*App) HasPendingConfigChanges added in v0.0.13

func (a *App) HasPendingConfigChanges() bool

HasPendingConfigChanges returns whether there are pending config changes

func (*App) IsLegacyDatabase added in v0.0.22

func (a *App) IsLegacyDatabase() (bool, error)

IsLegacyDatabase checks if the database is a legacy (non-goose) database

func (*App) IsProcessingAutoPaused added in v0.0.20

func (a *App) IsProcessingAutoPaused() bool

IsProcessingAutoPaused returns whether the processor was automatically paused due to provider unavailability

func (*App) IsProcessingPaused added in v0.0.14

func (a *App) IsProcessingPaused() bool

IsProcessingPaused returns whether the processor is currently paused

func (*App) IsUploading

func (a *App) IsUploading() bool

IsUploading returns whether any uploads are in progress (via processor)

func (*App) MigrateTo added in v0.0.22

func (a *App) MigrateTo(version int64) error

MigrateTo migrates to a specific version

func (*App) NavigateToDashboard

func (a *App) NavigateToDashboard()

NavigateToDashboard emits an event to navigate to the dashboard page

func (*App) NavigateToSettings

func (a *App) NavigateToSettings()

NavigateToSettings emits an event to navigate to the settings page

func (*App) PauseProcessing added in v0.0.14

func (a *App) PauseProcessing() error

PauseProcessing pauses the processor to prevent new jobs from starting

func (*App) RecreateDatabase added in v0.0.22

func (a *App) RecreateDatabase() error

RecreateDatabase drops all tables and recreates them using migrations

func (*App) RemoveFromQueue

func (a *App) RemoveFromQueue(id string) error

RemoveFromQueue removes an item from the queue via queue

func (*App) ResetDatabase added in v0.0.22

func (a *App) ResetDatabase() error

ResetDatabase drops all tables and re-runs all migrations

func (*App) ResumeProcessing added in v0.0.14

func (a *App) ResumeProcessing() error

ResumeProcessing resumes the processor to allow new jobs to start

func (*App) RetryJob

func (a *App) RetryJob(id string) error

RetryJob retries a failed job

func (*App) RollbackMigration added in v0.0.22

func (a *App) RollbackMigration() error

RollbackMigration rolls back the last applied migration

func (*App) RunMigrations added in v0.0.22

func (a *App) RunMigrations() error

RunMigrations runs all pending migrations

func (*App) SaveConfig

func (a *App) SaveConfig(configData *config.ConfigData) error

SaveConfig saves the configuration

func (*App) SelectConfigFile

func (a *App) SelectConfigFile() (string, error)

SelectConfigFile allows user to select a config file

func (*App) SelectOutputDirectory

func (a *App) SelectOutputDirectory() (string, error)

SelectOutputDirectory allows user to select an output directory

func (*App) SelectTempDirectory

func (a *App) SelectTempDirectory() (string, error)

SelectTempDirectory allows user to select a temporary directory for PAR2 files

func (*App) SelectWatchDirectory

func (a *App) SelectWatchDirectory() (string, error)

SelectWatchDirectory allows user to select a watch directory

func (*App) SetQueueItemPriority

func (a *App) SetQueueItemPriority(id string, priority int) error

SetQueueItemPriority updates the priority of a pending queue item by id and reorders the queue

func (*App) SetWebEventEmitter

func (a *App) SetWebEventEmitter(emitter func(eventType string, data interface{}))

SetWebEventEmitter sets the event emitter function for web mode

func (*App) SetWebMode

func (a *App) SetWebMode(isWeb bool)

SetWebMode sets the application to web mode

func (*App) SetupWizardComplete added in v0.0.7

func (a *App) SetupWizardComplete(wizardData SetupWizardData) error

SetupWizardComplete saves the configuration from the setup wizard

func (*App) Shutdown added in v0.0.16

func (a *App) Shutdown()

Shutdown gracefully shuts down the application and closes all resources

func (*App) Startup

func (a *App) Startup(ctx context.Context)

Startup is called when the app starts. The context is saved so we can call the runtime methods

func (*App) TestProviderConnectivity added in v0.0.20

func (a *App) TestProviderConnectivity(serverData ServerData) ValidationResult

TestProviderConnectivity tests an individual provider's connectivity using the new nntppool method

func (*App) UploadFiles

func (a *App) UploadFiles() error

UploadFiles uploads the selected files using the queue system

func (*App) ValidateNNTPServer added in v0.0.7

func (a *App) ValidateNNTPServer(serverData ServerData) ValidationResult

ValidateNNTPServer validates an NNTP server configuration using TestProviderConnectivity

type AppPaths

type AppPaths struct {
	Config   string
	Database string
	Par2     string
	Data     string
	Log      string
}

AppPaths holds the various paths needed by the application

func GetAppPaths

func GetAppPaths() (*AppPaths, error)

GetAppPaths returns the appropriate paths for the current operating system

type AppStatus added in v0.0.8

type AppStatus struct {
	HasConfig           bool   `json:"hasConfig"`
	ConfigPath          string `json:"configPath"`
	Uploading           bool   `json:"uploading"`
	CriticalConfigError bool   `json:"criticalConfigError"`
	Error               string `json:"error"`
	IsFirstStart        bool   `json:"isFirstStart"`
	HasServers          bool   `json:"hasServers"`
	ServerCount         int    `json:"serverCount"`
	ValidServerCount    int    `json:"validServerCount"`
	ConfigValid         bool   `json:"configValid"`
	NeedsConfiguration  bool   `json:"needsConfiguration"`
}

AppStatus represents the current application status

type CompressedMetrics added in v0.0.20

type CompressedMetrics struct {
	Timestamp           string  `json:"timestamp"`
	Period              string  `json:"period"` // "daily" or "weekly"
	TotalBytesUploaded  int64   `json:"totalBytesUploaded"`
	TotalArticlesPosted int64   `json:"totalArticlesPosted"`
	AverageUploadSpeed  float64 `json:"averageUploadSpeed"`
	AverageSuccessRate  float64 `json:"averageSuccessRate"`
	TotalErrors         int64   `json:"totalErrors"`
	AverageConnections  float64 `json:"averageConnections"`
}

CompressedMetrics represents compressed historical metrics for daily/weekly periods (legacy)

type MetricSummary added in v0.0.20

type MetricSummary struct {
	StartTime                 string  `json:"startTime"`
	EndTime                   string  `json:"endTime"`
	TotalConnectionsCreated   int64   `json:"totalConnectionsCreated"`
	TotalConnectionsDestroyed int64   `json:"totalConnectionsDestroyed"`
	TotalAcquires             int64   `json:"totalAcquires"`
	TotalReleases             int64   `json:"totalReleases"`
	TotalErrors               int64   `json:"totalErrors"`
	TotalRetries              int64   `json:"totalRetries"`
	TotalAcquireWaitTime      int64   `json:"totalAcquireWaitTime"`
	TotalBytesDownloaded      int64   `json:"totalBytesDownloaded"`
	TotalBytesUploaded        int64   `json:"totalBytesUploaded"`
	TotalArticlesRetrieved    int64   `json:"totalArticlesRetrieved"`
	TotalArticlesPosted       int64   `json:"totalArticlesPosted"`
	TotalCommandCount         int64   `json:"totalCommandCount"`
	TotalCommandErrors        int64   `json:"totalCommandErrors"`
	AverageConnectionsPerHour float64 `json:"averageConnectionsPerHour"`
	AverageErrorRate          float64 `json:"averageErrorRate"`
	AverageSuccessRate        float64 `json:"averageSuccessRate"`
	AverageAcquireWaitTime    int64   `json:"averageAcquireWaitTime"`
	WindowCount               int     `json:"windowCount"`
}

MetricSummary represents aggregated metrics for a time period

type NntpPoolMetrics added in v0.0.16

type NntpPoolMetrics struct {
	Timestamp              string                `json:"timestamp"`
	Uptime                 float64               `json:"uptime"`
	ActiveConnections      int                   `json:"activeConnections"`
	UploadSpeed            float64               `json:"uploadSpeed"`
	CommandSuccessRate     float64               `json:"commandSuccessRate"`
	ErrorRate              float64               `json:"errorRate"`
	TotalAcquires          int64                 `json:"totalAcquires"`
	TotalBytesUploaded     int64                 `json:"totalBytesUploaded"`
	TotalArticlesRetrieved int64                 `json:"totalArticlesRetrieved"`
	TotalArticlesPosted    int64                 `json:"totalArticlesPosted"`
	AverageAcquireWaitTime float64               `json:"averageAcquireWaitTime"`
	TotalErrors            int64                 `json:"totalErrors"`
	Providers              []NntpProviderMetrics `json:"providers"`
	// Daily and Weekly compressed metrics from nntppool v1.3.1+
	DailyMetrics  *MetricSummary `json:"dailyMetrics,omitempty"`
	WeeklyMetrics *MetricSummary `json:"weeklyMetrics,omitempty"`
}

NntpPoolMetrics represents NNTP connection pool metrics

type NntpProviderMetrics added in v0.0.16

type NntpProviderMetrics struct {
	Host                 string  `json:"host"`
	Username             string  `json:"username"`
	State                string  `json:"state"`
	TotalConnections     int     `json:"totalConnections"`
	MaxConnections       int     `json:"maxConnections"`
	AcquiredConnections  int     `json:"acquiredConnections"`
	IdleConnections      int     `json:"idleConnections"`
	TotalBytesUploaded   int64   `json:"totalBytesUploaded"`
	TotalArticlesPosted  int64   `json:"totalArticlesPosted"`
	SuccessRate          float64 `json:"successRate"`
	AverageConnectionAge float64 `json:"averageConnectionAge"`
}

NntpProviderMetrics represents metrics for individual NNTP providers

type PaginatedQueueResult added in v0.0.26

type PaginatedQueueResult struct {
	Items        []QueueItem `json:"items"`
	TotalItems   int         `json:"totalItems"`
	TotalPages   int         `json:"totalPages"`
	CurrentPage  int         `json:"currentPage"`
	ItemsPerPage int         `json:"itemsPerPage"`
	HasNext      bool        `json:"hasNext"`
	HasPrev      bool        `json:"hasPrev"`
}

PaginatedQueueResult contains paginated queue items and metadata

type PaginationParams added in v0.0.26

type PaginationParams struct {
	Page   int    `json:"page"`   // 1-based page number
	Limit  int    `json:"limit"`  // Items per page
	SortBy string `json:"sortBy"` // Sort field: "created", "priority", "status", "filename"
	Order  string `json:"order"`  // Sort order: "asc", "desc"
}

PaginationParams defines parameters for paginated queries

type ProcessorStatus added in v0.0.8

type ProcessorStatus struct {
	HasProcessor  bool     `json:"hasProcessor"`
	RunningJobs   int      `json:"runningJobs"`
	RunningJobIDs []string `json:"runningJobIDs"`
}

ProcessorStatus represents the current processor status

type QueueItem

type QueueItem struct {
	ID           string     `json:"id"`
	Path         string     `json:"path"`
	FileName     string     `json:"fileName"`
	Size         int64      `json:"size"`
	Status       string     `json:"status"`
	RetryCount   int        `json:"retryCount"`
	Priority     int        `json:"priority"`
	ErrorMessage *string    `json:"errorMessage"`
	CreatedAt    time.Time  `json:"createdAt"`
	UpdatedAt    time.Time  `json:"updatedAt"`
	CompletedAt  *time.Time `json:"completedAt"`
	NzbPath      *string    `json:"nzbPath"`
}

QueueItem represents a queue item for the frontend - matches queue.QueueItem

type QueueStats added in v0.0.8

type QueueStats struct {
	Total    int `json:"total"`
	Pending  int `json:"pending"`
	Running  int `json:"running"`
	Complete int `json:"complete"`
	Error    int `json:"error"`
}

QueueStats represents queue statistics

type ServerData added in v0.0.7

type ServerData struct {
	Host           string `json:"host"`
	Port           int    `json:"port"`
	Username       string `json:"username"`
	Password       string `json:"password"`
	SSL            bool   `json:"ssl"`
	MaxConnections int    `json:"maxConnections"`
}

ServerData represents the server configuration data from the frontend

type SetupWizardData added in v0.0.7

type SetupWizardData struct {
	Servers         []ServerData `json:"servers"`
	OutputDirectory string       `json:"outputDirectory"`
	WatchDirectory  string       `json:"watchDirectory"`
}

SetupWizardData represents the complete setup wizard data from the frontend

type ValidationResult added in v0.0.7

type ValidationResult struct {
	Valid bool   `json:"valid"`
	Error string `json:"error"`
}

ValidationResult represents the result of server validation

Jump to

Keyboard shortcuts

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