web

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package web provides HTTP server and API handlers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDeprecatedEndpoint added in v0.2.0

func AddDeprecatedEndpoint(path, replacement, version, message string)

AddDeprecatedEndpoint registers a deprecated endpoint This can be called during initialization to mark endpoints as deprecated

func GetAllSiteCategories added in v0.2.0

func GetAllSiteCategories() map[string]SiteCategoriesConfig

GetAllSiteCategories 获取所有站点的分类配置

func GetDeprecatedEndpoints added in v0.2.0

func GetDeprecatedEndpoints() map[string]DeprecatedEndpoint

GetDeprecatedEndpoints returns all deprecated endpoints

func GetSearchOrchestrator added in v0.2.0

func GetSearchOrchestrator() *v2.CachedSearchOrchestrator

GetSearchOrchestrator returns the global search orchestrator

func GetSiteRegistry added in v0.2.0

func GetSiteRegistry() *v2.SiteRegistry

GetSiteRegistry returns the global site registry

func GetUserInfoService added in v0.2.0

func GetUserInfoService() *v2.UserInfoService

GetUserInfoService returns the global user info service

func InitSearchOrchestrator added in v0.2.0

func InitSearchOrchestrator(orchestrator *v2.CachedSearchOrchestrator)

InitSearchOrchestrator initializes the global search orchestrator

func InitSiteRegistry added in v0.2.0

func InitSiteRegistry(registry *v2.SiteRegistry)

InitSiteRegistry initializes the global site registry

func InitUserInfoService added in v0.2.0

func InitUserInfoService(service *v2.UserInfoService)

InitUserInfoService initializes the global user info service

func IsDeprecated added in v0.2.0

func IsDeprecated(path string) bool

IsDeprecated checks if an endpoint is deprecated

func ListSupportedSites added in v0.2.0

func ListSupportedSites() []string

ListSupportedSites 列出支持分类筛选的站点

func RefreshSiteRegistrations added in v0.2.0

func RefreshSiteRegistrations(store interface {
	ListSites() (map[models.SiteGroup]models.SiteConfig, error)
},
) error

RefreshSiteRegistrations refreshes site registrations based on current enabled sites This should be called when site configurations change

Types

type AggregatedStatsResponse added in v0.2.0

type AggregatedStatsResponse struct {
	TotalUploaded   int64              `json:"totalUploaded"`
	TotalDownloaded int64              `json:"totalDownloaded"`
	AverageRatio    float64            `json:"averageRatio"`
	TotalSeeding    int                `json:"totalSeeding"`
	TotalLeeching   int                `json:"totalLeeching"`
	TotalBonus      float64            `json:"totalBonus"`
	SiteCount       int                `json:"siteCount"`
	LastUpdate      int64              `json:"lastUpdate"`
	PerSiteStats    []UserInfoResponse `json:"perSiteStats"`
	// Extended aggregated fields
	TotalBonusPerHour   float64 `json:"totalBonusPerHour,omitempty"`
	TotalSeedingBonus   float64 `json:"totalSeedingBonus,omitempty"`
	TotalUnreadMessages int     `json:"totalUnreadMessages,omitempty"`
	TotalSeederSize     int64   `json:"totalSeederSize,omitempty"`
	TotalLeecherSize    int64   `json:"totalLeecherSize,omitempty"`
}

AggregatedStatsResponse represents aggregated stats API response

type AllSiteLevelsResponse added in v0.2.0

type AllSiteLevelsResponse struct {
	Sites map[string]SiteLevelsResponse `json:"sites"`
}

AllSiteLevelsResponse represents the response for all sites' level requirements

type ArchiveTorrentResponse added in v0.3.0

type ArchiveTorrentResponse struct {
	ID                uint       `json:"id"`
	OriginalID        uint       `json:"original_id"`
	SiteName          string     `json:"site_name"`
	Title             string     `json:"title"`
	TorrentHash       *string    `json:"torrent_hash,omitempty"`
	IsFree            bool       `json:"is_free"`
	FreeEndTime       *time.Time `json:"free_end_time,omitempty"`
	IsCompleted       bool       `json:"is_completed"`
	Progress          float64    `json:"progress"`
	IsPausedBySystem  bool       `json:"is_paused_by_system"`
	PauseReason       string     `json:"pause_reason,omitempty"`
	DownloaderName    string     `json:"downloader_name,omitempty"`
	OriginalCreatedAt time.Time  `json:"original_created_at"`
	ArchivedAt        time.Time  `json:"archived_at"`
}

ArchiveTorrentResponse 归档种子响应结构

type BatchDownloadItem added in v0.2.0

type BatchDownloadItem struct {
	SiteID    string `json:"siteId"`
	TorrentID string `json:"torrentId"`
	Title     string `json:"title"`
}

BatchDownloadItem represents a single torrent in batch download request

type BatchDownloadRequest added in v0.2.0

type BatchDownloadRequest struct {
	Torrents []BatchDownloadItem `json:"torrents"`
}

BatchDownloadRequest represents a request for batch torrent download

type BatchTorrentPushRequest added in v0.2.0

type BatchTorrentPushRequest struct {
	Torrents      []TorrentPushItem `json:"torrents"`
	DownloaderIDs []uint            `json:"downloaderIds"`
	SavePath      string            `json:"savePath,omitempty"`
	Category      string            `json:"category,omitempty"`
	Tags          string            `json:"tags,omitempty"`
	AutoStart     *bool             `json:"autoStart,omitempty"`
}

BatchTorrentPushRequest 批量种子推送请求

type BatchTorrentPushResponse added in v0.2.0

type BatchTorrentPushResponse struct {
	Success      bool                         `json:"success"`
	TotalCount   int                          `json:"totalCount"`
	SuccessCount int                          `json:"successCount"`
	SkippedCount int                          `json:"skippedCount"` // 跳过的数量(种子已存在)
	FailedCount  int                          `json:"failedCount"`
	Results      []BatchTorrentPushResultItem `json:"results"`
}

BatchTorrentPushResponse 批量推送响应

type BatchTorrentPushResultItem added in v0.2.0

type BatchTorrentPushResultItem struct {
	TorrentTitle string                  `json:"torrentTitle"`
	SourceSite   string                  `json:"sourceSite"`
	Success      bool                    `json:"success"`
	Skipped      bool                    `json:"skipped,omitempty"` // 所有下载器都跳过时为true
	Message      string                  `json:"message,omitempty"`
	Results      []TorrentPushResultItem `json:"results,omitempty"`
}

BatchTorrentPushResultItem 批量推送单项结果

type DeletePausedRequest added in v0.3.0

type DeletePausedRequest struct {
	IDs        []uint `json:"ids"`         // 指定删除的种子 ID 列表(为空则删除全部)
	RemoveData bool   `json:"remove_data"` // 是否同时删除数据文件
}

DeletePausedRequest 删除暂停种子请求

type DeletePausedResponse added in v0.3.0

type DeletePausedResponse struct {
	Success      int      `json:"success"`       // 成功删除数量
	Failed       int      `json:"failed"`        // 失败数量
	FailedIDs    []uint   `json:"failed_ids"`    // 失败的种子 ID
	FailedErrors []string `json:"failed_errors"` // 失败原因
}

DeletePausedResponse 删除暂停种子响应

type DeprecatedEndpoint added in v0.2.0

type DeprecatedEndpoint struct {
	Path        string // The deprecated endpoint path
	Replacement string // The new endpoint to use
	Version     string // Version when it will be removed
	Message     string // Custom deprecation message
}

DeprecatedEndpoint represents a deprecated API endpoint

type DownloaderDirectoryRequest added in v0.2.0

type DownloaderDirectoryRequest struct {
	Path      string `json:"path"`
	Alias     string `json:"alias"`
	IsDefault bool   `json:"is_default"`
}

DownloaderDirectoryRequest 下载器目录请求结构

type DownloaderDirectoryResponse added in v0.2.0

type DownloaderDirectoryResponse struct {
	ID           uint   `json:"id"`
	DownloaderID uint   `json:"downloader_id"`
	Path         string `json:"path"`
	Alias        string `json:"alias"`
	IsDefault    bool   `json:"is_default"`
}

DownloaderDirectoryResponse 下载器目录响应结构

type DownloaderRequest added in v0.2.0

type DownloaderRequest struct {
	Name        string `json:"name"`
	Type        string `json:"type"` // qbittorrent, transmission
	URL         string `json:"url"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	IsDefault   bool   `json:"is_default"`
	Enabled     bool   `json:"enabled"`
	AutoStart   bool   `json:"auto_start"` // 推送种子后自动开始下载
	ExtraConfig string `json:"extra_config,omitempty"`
}

DownloaderRequest 下载器请求结构

type DownloaderResponse added in v0.2.0

type DownloaderResponse struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	URL         string `json:"url"`
	Username    string `json:"username"`
	IsDefault   bool   `json:"is_default"`
	Enabled     bool   `json:"enabled"`
	AutoStart   bool   `json:"auto_start"` // 推送种子后自动开始下载
	ExtraConfig string `json:"extra_config,omitempty"`
}

DownloaderResponse 下载器响应结构

type DynamicSiteRequest added in v0.2.0

type DynamicSiteRequest struct {
	Name         string `json:"name"`
	DisplayName  string `json:"display_name"`
	BaseURL      string `json:"base_url"`
	AuthMethod   string `json:"auth_method"`
	Cookie       string `json:"cookie,omitempty"`
	APIKey       string `json:"api_key,omitempty"`
	APIURL       string `json:"api_url,omitempty"`
	DownloaderID *uint  `json:"downloader_id,omitempty"`
	ParserConfig string `json:"parser_config,omitempty"`
}

DynamicSiteRequest 动态站点请求

type DynamicSiteResponse added in v0.2.0

type DynamicSiteResponse struct {
	ID           uint   `json:"id"`
	Name         string `json:"name"`
	DisplayName  string `json:"display_name"`
	BaseURL      string `json:"base_url"`
	Enabled      bool   `json:"enabled"`
	AuthMethod   string `json:"auth_method"`
	DownloaderID *uint  `json:"downloader_id,omitempty"`
	IsBuiltin    bool   `json:"is_builtin"`
}

DynamicSiteResponse 动态站点响应

type FaviconService added in v0.2.0

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

FaviconService 管理站点图标缓存(数据库存储)

func (*FaviconService) GetFavicon added in v0.2.0

func (fs *FaviconService) GetFavicon(siteID string) (*models.FaviconCache, error)

GetFavicon 从数据库获取图标

type FilterRuleRequest added in v0.2.0

type FilterRuleRequest struct {
	Name        string `json:"name"`
	Pattern     string `json:"pattern"`
	PatternType string `json:"pattern_type"` // keyword, wildcard, regex
	MatchField  string `json:"match_field"`  // title, tag, both
	RequireFree bool   `json:"require_free"`
	Enabled     bool   `json:"enabled"`
	SiteID      *uint  `json:"site_id"`
	RSSID       *uint  `json:"rss_id"`
	Priority    int    `json:"priority"`
}

FilterRuleRequest 过滤规则请求结构

type FilterRuleResponse added in v0.2.0

type FilterRuleResponse struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	Pattern     string `json:"pattern"`
	PatternType string `json:"pattern_type"`
	MatchField  string `json:"match_field"`
	RequireFree bool   `json:"require_free"`
	Enabled     bool   `json:"enabled"`
	SiteID      *uint  `json:"site_id"`
	RSSID       *uint  `json:"rss_id"`
	Priority    int    `json:"priority"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

FilterRuleResponse 过滤规则响应结构

type FilterRuleTestMatch added in v0.2.0

type FilterRuleTestMatch struct {
	Title  string `json:"title"`
	Tag    string `json:"tag"`
	IsFree bool   `json:"is_free"` // 是否免费
}

FilterRuleTestMatch 单个匹配结果

type FilterRuleTestRequest added in v0.2.0

type FilterRuleTestRequest struct {
	Pattern     string `json:"pattern"`
	PatternType string `json:"pattern_type"`
	MatchField  string `json:"match_field"`  // title, tag, both
	RequireFree bool   `json:"require_free"` // 是否仅匹配免费种子
	SiteID      *uint  `json:"site_id"`
	RSSID       *uint  `json:"rss_id"`
	Limit       int    `json:"limit"` // 最多返回多少条匹配结果
}

FilterRuleTestRequest 过滤规则测试请求

type FilterRuleTestResponse added in v0.2.0

type FilterRuleTestResponse struct {
	MatchCount int                   `json:"match_count"`
	TotalCount int                   `json:"total_count"` // 总种子数
	Matches    []FilterRuleTestMatch `json:"matches"`     // 匹配的种子详情
}

FilterRuleTestResponse 过滤规则测试响应

type FreeTorrentBatchRequest added in v0.2.0

type FreeTorrentBatchRequest struct {
	ArchiveType string `json:"archiveType"` // "tar.gz" or "zip"
}

FreeTorrentBatchRequest represents a batch download request

type FreeTorrentBatchResponse added in v0.2.0

type FreeTorrentBatchResponse struct {
	ArchivePath  string                `json:"archivePath"`
	ArchiveType  string                `json:"archiveType"`
	TorrentCount int                   `json:"torrentCount"`
	TotalSize    int64                 `json:"totalSize"`
	Manifest     []TorrentManifestItem `json:"manifest"`
}

FreeTorrentBatchResponse represents a batch download response

type HealthCheckResponse added in v0.2.0

type HealthCheckResponse struct {
	Name      string `json:"name"`
	IsHealthy bool   `json:"is_healthy"`
	Message   string `json:"message,omitempty"`
}

HealthCheckResponse 健康检查响应

type LogLevelRequest added in v0.2.0

type LogLevelRequest struct {
	Level string `json:"level"` // debug, info, warn, error
}

LogLevelRequest 日志级别请求

type LogLevelResponse added in v0.2.0

type LogLevelResponse struct {
	Level   string   `json:"level"`
	Levels  []string `json:"levels"` // 可用的日志级别列表
	Message string   `json:"message,omitempty"`
}

LogLevelResponse 日志级别响应

type MultiSiteSearchRequest added in v0.2.0

type MultiSiteSearchRequest struct {
	Keyword      string                      `json:"keyword"`
	Category     string                      `json:"category,omitempty"`
	FreeOnly     bool                        `json:"freeOnly,omitempty"`
	Sites        []string                    `json:"sites,omitempty"`
	MinSeeders   int                         `json:"minSeeders,omitempty"`
	MaxSizeBytes int64                       `json:"maxSizeBytes,omitempty"`
	MinSizeBytes int64                       `json:"minSizeBytes,omitempty"`
	Page         int                         `json:"page,omitempty"`
	PageSize     int                         `json:"pageSize,omitempty"`
	TimeoutSecs  int                         `json:"timeoutSecs,omitempty"`
	SortBy       string                      `json:"sortBy,omitempty"`     // 排序字段
	OrderDesc    bool                        `json:"orderDesc,omitempty"`  // 降序排列
	SiteParams   map[string]SiteSearchParams `json:"siteParams,omitempty"` // 每个站点的特定搜索参数
}

MultiSiteSearchRequest represents a multi-site search request

type MultiSiteSearchResponse added in v0.2.0

type MultiSiteSearchResponse struct {
	Items        []TorrentItemResponse `json:"items"`
	TotalResults int                   `json:"totalResults"`
	SiteResults  map[string]int        `json:"siteResults"`
	Errors       []SearchErrorResponse `json:"errors,omitempty"`
	DurationMs   int64                 `json:"durationMs"`
}

MultiSiteSearchResponse represents a multi-site search response

type PausedTorrentResponse added in v0.3.0

type PausedTorrentResponse struct {
	ID               uint       `json:"id"`
	SiteName         string     `json:"site_name"`
	Title            string     `json:"title"`
	TorrentHash      *string    `json:"torrent_hash,omitempty"`
	Progress         float64    `json:"progress"`
	TorrentSize      int64      `json:"torrent_size"`
	DownloaderName   string     `json:"downloader_name"`
	DownloaderTaskID string     `json:"downloader_task_id"`
	PausedAt         *time.Time `json:"paused_at"`
	PauseReason      string     `json:"pause_reason"`
	FreeEndTime      *time.Time `json:"free_end_time,omitempty"`
	CreatedAt        time.Time  `json:"created_at"`
}

PausedTorrentResponse 暂停种子响应结构

type RSSFilterAssociationRequest added in v0.2.0

type RSSFilterAssociationRequest struct {
	FilterRuleIDs []uint `json:"filter_rule_ids"`
}

RSSFilterAssociationRequest RSS-Filter 关联请求结构

type RSSFilterAssociationResponse added in v0.2.0

type RSSFilterAssociationResponse struct {
	RSSID         uint                 `json:"rss_id"`
	FilterRuleIDs []uint               `json:"filter_rule_ids"`
	FilterRules   []FilterRuleResponse `json:"filter_rules"`
}

RSSFilterAssociationResponse RSS-Filter 关联响应结构

type ResumeTorrentResponse added in v0.3.0

type ResumeTorrentResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

ResumeTorrentResponse 恢复种子响应

type SearchErrorResponse added in v0.2.0

type SearchErrorResponse struct {
	Site  string `json:"site"`
	Error string `json:"error"`
}

SearchErrorResponse represents a search error in API response

type Server

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

func NewServer

func NewServer(store *core.ConfigStore, mgr *scheduler.Manager) *Server

func (*Server) Serve

func (s *Server) Serve(addr string) error

type SiteCategoriesConfig added in v0.2.0

type SiteCategoriesConfig struct {
	SiteID     string         `json:"site_id"`
	SiteName   string         `json:"site_name"`
	Categories []SiteCategory `json:"categories"`
}

SiteCategoriesConfig 站点分类配置集合

func GetSiteCategories added in v0.2.0

func GetSiteCategories(siteID string) *SiteCategoriesConfig

GetSiteCategories 获取指定站点的分类配置

type SiteCategory added in v0.2.0

type SiteCategory struct {
	Name    string               `json:"name"`
	Key     string               `json:"key"`
	Options []SiteCategoryOption `json:"options"`
	Cross   bool                 `json:"cross"` // 是否支持多选
	Notes   string               `json:"notes,omitempty"`
}

SiteCategory 站点分类配置

type SiteCategoryOption added in v0.2.0

type SiteCategoryOption struct {
	Value any    `json:"value"`
	Name  string `json:"name"`
}

SiteCategoryOption 分类选项

type SiteFaviconInfo added in v0.2.0

type SiteFaviconInfo struct {
	SiteID      string `json:"site_id"`
	SiteName    string `json:"site_name"`
	FaviconURL  string `json:"favicon_url,omitempty"`
	CacheURL    string `json:"cache_url,omitempty"`
	HasCache    bool   `json:"has_cache"`
	LastFetched int64  `json:"last_fetched,omitempty"`
}

SiteFaviconInfo 站点图标信息

type SiteLevelsResponse added in v0.2.0

type SiteLevelsResponse struct {
	SiteID   string                    `json:"siteId"`
	SiteName string                    `json:"siteName"`
	Levels   []v2.SiteLevelRequirement `json:"levels"`
}

SiteLevelsResponse represents the response for site level requirements API

type SiteSearchParams added in v0.2.0

type SiteSearchParams struct {
	Cat        any `json:"cat,omitempty"`        // 类别
	Medium     any `json:"medium,omitempty"`     // 媒介
	Codec      any `json:"codec,omitempty"`      // 编码
	AudioCodec any `json:"audiocodec,omitempty"` // 音频编码
	Standard   any `json:"standard,omitempty"`   // 分辨率
	Team       any `json:"team,omitempty"`       // 制作组
	Source     any `json:"source,omitempty"`     // 地区(某些站点)
	Incldead   any `json:"incldead,omitempty"`   // 断种/活种
	Spstate    any `json:"spstate,omitempty"`    // 促销状态
}

SiteSearchParams represents site-specific search parameters

type SiteValidationRequest added in v0.2.0

type SiteValidationRequest struct {
	Name       string `json:"name"`
	BaseURL    string `json:"base_url"`
	AuthMethod string `json:"auth_method"` // cookie, api_key
	Cookie     string `json:"cookie,omitempty"`
	APIKey     string `json:"api_key,omitempty"`
	APIURL     string `json:"api_url,omitempty"`
}

SiteValidationRequest 站点验证请求

type SiteValidationResponse added in v0.2.0

type SiteValidationResponse struct {
	Valid        bool     `json:"valid"`
	Message      string   `json:"message"`
	FreeTorrents []string `json:"free_torrents,omitempty"` // 免费种子预览
}

SiteValidationResponse 站点验证响应

type SyncFailedEntry added in v0.2.0

type SyncFailedEntry struct {
	Site  string `json:"site"`
	Error string `json:"error"`
}

SyncFailedEntry represents a failed sync entry

type SyncRequest added in v0.2.0

type SyncRequest struct {
	Sites []string `json:"sites,omitempty"` // Empty means sync all
}

SyncRequest represents a sync request

type SyncResponse added in v0.2.0

type SyncResponse struct {
	Success []string          `json:"success"`
	Failed  []SyncFailedEntry `json:"failed,omitempty"`
}

SyncResponse represents a sync response

type TemplateImportRequest added in v0.2.0

type TemplateImportRequest struct {
	Template json.RawMessage `json:"template"`
	Cookie   string          `json:"cookie,omitempty"`
	APIKey   string          `json:"api_key,omitempty"`
}

TemplateImportRequest 模板导入请求

type TemplateResponse added in v0.2.0

type TemplateResponse struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	BaseURL     string `json:"base_url"`
	AuthMethod  string `json:"auth_method"`
	Description string `json:"description,omitempty"`
	Version     string `json:"version,omitempty"`
	Author      string `json:"author,omitempty"`
}

TemplateResponse 模板响应

type TorrentItemResponse added in v0.2.0

type TorrentItemResponse struct {
	ID              string   `json:"id"`
	URL             string   `json:"url,omitempty"`
	Title           string   `json:"title"`
	Subtitle        string   `json:"subtitle,omitempty"`
	InfoHash        string   `json:"infoHash,omitempty"`
	Magnet          string   `json:"magnet,omitempty"`
	SizeBytes       int64    `json:"sizeBytes"`
	Seeders         int      `json:"seeders"`
	Leechers        int      `json:"leechers"`
	Snatched        int      `json:"snatched,omitempty"`
	UploadedAt      int64    `json:"uploadedAt,omitempty"`
	Tags            []string `json:"tags,omitempty"`
	SourceSite      string   `json:"sourceSite"`
	DiscountLevel   string   `json:"discountLevel"`
	DiscountEndTime int64    `json:"discountEndTime,omitempty"`
	HasHR           bool     `json:"hasHR,omitempty"`
	DownloadURL     string   `json:"downloadUrl,omitempty"`
	Category        string   `json:"category,omitempty"`
	IsFree          bool     `json:"isFree"`
}

TorrentItemResponse represents a torrent item in API response

type TorrentManifestItem added in v0.2.0

type TorrentManifestItem struct {
	ID            string `json:"id"`
	Title         string `json:"title"`
	SizeBytes     int64  `json:"sizeBytes"`
	DiscountLevel string `json:"discountLevel"`
	DownloadURL   string `json:"downloadUrl"`
	Category      string `json:"category,omitempty"`
	Seeders       int    `json:"seeders,omitempty"`
	Leechers      int    `json:"leechers,omitempty"`
}

TorrentManifestItem represents a torrent in the manifest

type TorrentPushItem added in v0.2.0

type TorrentPushItem struct {
	DownloadURL  string `json:"downloadUrl,omitempty"`
	TorrentID    string `json:"torrentId,omitempty"`
	TorrentTitle string `json:"torrentTitle,omitempty"`
	SourceSite   string `json:"sourceSite,omitempty"`
	SizeBytes    int64  `json:"sizeBytes,omitempty"`
}

TorrentPushItem 批量推送中的单个种子项

type TorrentPushRequest added in v0.2.0

type TorrentPushRequest struct {
	// 种子信息(二选一)
	DownloadURL string `json:"downloadUrl,omitempty"` // 种子下载链接(内部API路径)
	TorrentID   string `json:"torrentId,omitempty"`   // 种子ID

	// 下载器配置
	DownloaderIDs []uint `json:"downloaderIds"`       // 目标下载器ID列表
	SavePath      string `json:"savePath,omitempty"`  // 保存路径(可选)
	Category      string `json:"category,omitempty"`  // 分类
	Tags          string `json:"tags,omitempty"`      // 标签
	AutoStart     *bool  `json:"autoStart,omitempty"` // 是否自动开始(覆盖下载器默认设置)

	// 种子元信息(用于日志和数据库记录)
	TorrentTitle string `json:"torrentTitle,omitempty"`
	SourceSite   string `json:"sourceSite,omitempty"`
	SizeBytes    int64  `json:"sizeBytes,omitempty"`
}

TorrentPushRequest 种子推送请求

type TorrentPushResponse added in v0.2.0

type TorrentPushResponse struct {
	Success bool                    `json:"success"`
	Results []TorrentPushResultItem `json:"results"`
	Message string                  `json:"message,omitempty"`
}

TorrentPushResponse 种子推送响应

type TorrentPushResultItem added in v0.2.0

type TorrentPushResultItem struct {
	DownloaderID   uint   `json:"downloaderId"`
	DownloaderName string `json:"downloaderName"`
	Success        bool   `json:"success"`
	Skipped        bool   `json:"skipped,omitempty"` // 种子已存在时跳过
	Message        string `json:"message,omitempty"`
	TorrentHash    string `json:"torrentHash,omitempty"`
}

TorrentPushResultItem 单个下载器的推送结果

type UserInfoResponse added in v0.2.0

type UserInfoResponse struct {
	Site       string  `json:"site"`
	Username   string  `json:"username"`
	UserID     string  `json:"userId"`
	Uploaded   int64   `json:"uploaded"`
	Downloaded int64   `json:"downloaded"`
	Ratio      float64 `json:"ratio"`
	Bonus      float64 `json:"bonus"`
	Seeding    int     `json:"seeding"`
	Leeching   int     `json:"leeching"`
	Rank       string  `json:"rank"`
	JoinDate   int64   `json:"joinDate,omitempty"`
	LastAccess int64   `json:"lastAccess,omitempty"`
	LastUpdate int64   `json:"lastUpdate"`
	// Extended fields
	LevelName           string  `json:"levelName,omitempty"`
	LevelID             int     `json:"levelId,omitempty"`
	BonusPerHour        float64 `json:"bonusPerHour,omitempty"`
	SeedingBonus        float64 `json:"seedingBonus,omitempty"`
	SeedingBonusPerHour float64 `json:"seedingBonusPerHour,omitempty"`
	UnreadMessageCount  int     `json:"unreadMessageCount,omitempty"`
	TotalMessageCount   int     `json:"totalMessageCount,omitempty"`
	SeederCount         int     `json:"seederCount,omitempty"`
	SeederSize          int64   `json:"seederSize,omitempty"`
	LeecherCount        int     `json:"leecherCount,omitempty"`
	LeecherSize         int64   `json:"leecherSize,omitempty"`
	HnRUnsatisfied      int     `json:"hnrUnsatisfied,omitempty"`
	HnRPreWarning       int     `json:"hnrPreWarning,omitempty"`
	TrueUploaded        int64   `json:"trueUploaded,omitempty"`
	TrueDownloaded      int64   `json:"trueDownloaded,omitempty"`
	Uploads             int     `json:"uploads,omitempty"`
}

UserInfoResponse represents user info API response

Jump to

Keyboard shortcuts

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