Documentation
¶
Index ¶
- Variables
- func AcquireLock() (bool, error)
- func Execute() error
- func ExecuteAPIAction(rawID, endpoint, method, successMsg string) error
- func GetRemoteDownloads(baseURL string, token string) ([]types.DownloadStatus, error)
- func ParseURLArg(arg string) (string, []string)
- func ReleaseLock() error
- func StartHeadlessConsumer()
- type DownloadRequest
- type InstanceLock
Constants ¶
This section is empty.
Variables ¶
var ( ErrDownloadNotFound = errors.New("download not found") ErrNoDestinationPath = errors.New("download has no destination path") )
var ( Version = "dev" BuildTime = "unknown" )
Version information - set via ldflags during build
var ( GlobalPool *download.WorkerPool GlobalProgressCh chan any GlobalService core.DownloadService GlobalLifecycleCleanup func() GlobalLifecycle *processing.LifecycleManager )
Globals for Unified Backend
Functions ¶
func AcquireLock ¶
AcquireLock attempts to acquire the single instance lock. Returns true if the lock was acquired (this is the master instance). Returns false if the lock is already held (another instance is running). Returns an error if the locking process failed unexpectedly.
func Execute ¶
func Execute() error
Execute adds all child commands to the root command and sets flags appropriately.
func ExecuteAPIAction ¶
ExecuteAPIAction connects to the server, resolves the ID, and sends a request.
func GetRemoteDownloads ¶
func GetRemoteDownloads(baseURL string, token string) ([]types.DownloadStatus, error)
GetRemoteDownloads fetches all downloads from the running server
func ParseURLArg ¶
ParseURLArg parses a command line argument that might contain comma-separated mirrors Returns the primary URL and a list of all mirrors (including the primary)
func ReleaseLock ¶
func ReleaseLock() error
ReleaseLock releases the lock if it is held by this instance.
func StartHeadlessConsumer ¶
func StartHeadlessConsumer()
StartHeadlessConsumer starts a goroutine to consume progress messages and log to stdout
Types ¶
type DownloadRequest ¶
type DownloadRequest struct {
URL string `json:"url"`
Filename string `json:"filename,omitempty"`
Path string `json:"path,omitempty"`
RelativeToDefaultDir bool `json:"relative_to_default_dir,omitempty"`
Mirrors []string `json:"mirrors,omitempty"`
SkipApproval bool `json:"skip_approval,omitempty"` // Extension validated request, skip TUI prompt
Headers map[string]string `json:"headers,omitempty"` // Custom HTTP headers from browser (cookies, auth, etc.)
IsExplicitCategory bool `json:"is_explicit_category,omitempty"`
}
DownloadRequest represents a download request from the browser extension
type InstanceLock ¶
type InstanceLock struct {
// contains filtered or unexported fields
}
InstanceLock wraps the file locking mechanism