Documentation
¶
Overview ¶
Package web provides HTTP server and API handlers
Index ¶
- Constants
- func AddDeprecatedEndpoint(path, replacement, version, message string)
- func GetAllSiteCategories() map[string]SiteCategoriesConfig
- func GetDeprecatedEndpoints() map[string]DeprecatedEndpoint
- func GetSearchOrchestrator() *v2.CachedSearchOrchestrator
- func GetSiteRegistry() *v2.SiteRegistry
- func GetUserInfoService() *v2.UserInfoService
- func InitSearchOrchestrator(orchestrator *v2.CachedSearchOrchestrator)
- func InitSiteRegistry(registry *v2.SiteRegistry)
- func InitUserInfoService(service *v2.UserInfoService)
- func IsDeprecated(path string) bool
- func ListSupportedSites() []string
- func RefreshSiteRegistrations(store interface{ ... }) error
- func RegisterChatOpsRoutes(mux *http.ServeMux, deps *ChatOpsDeps, ...)
- type AddDownloaderTorrentRequest
- type AddDownloaderTorrentResponse
- type AddDownloaderTorrentResult
- type AggregatedStatsResponse
- type AllSiteLevelsResponse
- type AppBrushPeriod
- type AppBrushStat
- type AppBrushStats
- type AppBrushTask
- type AppBrushTaskPeriods
- type AppDelta
- type AppDownloader
- type AppDownloaderFailure
- type AppDownloaderList
- type AppEpisode
- type AppEpisodeRule
- type AppEpisodeRuleInput
- type AppEpisodeSkip
- type AppEpisodeUnlock
- type AppExploreItem
- type AppExplorePage
- type AppFromTorrent
- type AppLibraryRef
- type AppMediaHistory
- type AppMediaLibrary
- type AppMediaMatch
- type AppMediaMeta
- type AppMeta
- type AppMobileOption
- type AppMobileOptions
- type AppMobileSiteOption
- type AppOrganizeInput
- type AppOrganizeItem
- type AppOrganizePlan
- type AppOrganizeResult
- type AppOverview
- type AppPage
- type AppPrincipalV
- type AppProgress
- type AppPushRequest
- type AppPushResult
- type AppRecognition
- type AppRecognizeInput
- type AppRescrapeResult
- type AppRunStep
- type AppSchedule
- type AppSchedulePreview
- type AppSchedulePreviewInput
- type AppSearchError
- type AppSearchItem
- type AppSearchRequest
- type AppSearchResult
- type AppSite
- type AppSiteAttendance
- type AppSiteDelta
- type AppSiteList
- type AppSiteLogin
- type AppSiteUser
- type AppSubscription
- type AppSubscriptionCreate
- type AppSubscriptionDetail
- type AppSubscriptionRun
- type AppSubscriptionStatus
- type AppSubscriptionTorrent
- type AppSubscriptionUpdate
- type AppTask
- type AppTemplate
- type AppTemplateCatalog
- type AppTemplateGroup
- type AppTemplateInput
- type AppTemplatePreview
- type AppTemplatePreviewInput
- type AppTemplateVar
- type AppTorrent
- type AppTorrentActionResult
- type AppTorrentActionsRequest
- type AppTorrentActionsResult
- type AppTorrentFile
- type AppTorrentPage
- type AppTotals
- type ApplyDownloaderToSitesRequest
- type ApplyDownloaderToSitesResponse
- type ArchiveTorrentResponse
- type AttendanceDayResponse
- type AttendanceDaySite
- type AttendanceDaySummary
- type AttendanceEventView
- type AttendanceHistoryResponse
- type AttendanceHistoryRow
- type AttendanceRunResponse
- type AttendanceSettingsDTO
- type BatchDownloadItem
- type BatchDownloadRequest
- type BatchTorrentActionRequest
- type BatchTorrentActionResponse
- type BatchTorrentActionResult
- type BatchTorrentPushRequest
- type BatchTorrentPushResponse
- type BatchTorrentPushResultItem
- type BrushDeleteResponse
- type BrushKeepFailure
- type BrushRunPage
- type BrushRunResponse
- type BrushRunView
- type BrushStatView
- type BrushStatsResponse
- type BrushStatsSeriesPoint
- type BrushStatsTask
- type BrushTaskRequest
- type BrushTaskView
- type ChatOpsDeps
- type CleanupPreviewInput
- type CleanupPreviewView
- type CleanupStatusView
- type ConfigCatalog
- type ConfigChange
- type ConfigChangeResult
- type ConfigDiff
- type ConfigResourceView
- type ConfigState
- type DeletePausedRequest
- type DeletePausedResponse
- type DeleteTasksRequest
- type DeleteTasksResponse
- type DeprecatedEndpoint
- type DownloaderCapabilitiesResponse
- type DownloaderCapability
- type DownloaderDirectoryRequest
- type DownloaderDirectoryResponse
- type DownloaderFailure
- type DownloaderRequest
- type DownloaderResponse
- type DownloaderTorrentItem
- type DownloaderTorrentMetaResponse
- type DownloaderTorrentsResponse
- type DownloaderTransferStatItem
- type DownloaderTransferStatsResponse
- type DynamicSiteRequest
- type DynamicSiteResponse
- type FaviconService
- type FilterRuleRequest
- type FilterRuleResponse
- type FilterRuleTestMatch
- type FilterRuleTestRequest
- type FilterRuleTestResponse
- type FreeTorrentBatchRequest
- type FreeTorrentBatchResponse
- type HealthCheckResponse
- type LogLevelRequest
- type LogLevelResponse
- type MCPSettingsInput
- type MCPSettingsView
- type MultiSiteSearchRequest
- type MultiSiteSearchResponse
- type NotifyStatsChannel
- type NotifyStatsRequeue
- type NotifyStatsSource
- type NotifyStatsView
- type PausedTorrentResponse
- type QbitCompatControl
- type QbitCompatLogin
- type QbitCompatRuntime
- type QbitCompatView
- type RSSFilterAssociationRequest
- type RSSFilterAssociationResponse
- type RSSLinkTestRequest
- type RSSLinkTestResponse
- type RecentNotification
- type RemoteDeviceInput
- type RemotePairingInput
- type RemotePairingView
- type ReseedSettingsView
- type ResumeTorrentResponse
- type SchedulePreviewInput
- type SchedulePreviewView
- type SearchErrorResponse
- type Server
- func (s *Server) AssistantToolServer(c mcp.Caller) *sdk.Server
- func (s *Server) ConfigApply(ctx context.Context, name string, in ConfigChange) (ConfigChangeResult, error)
- func (s *Server) ConfigCatalog() ConfigCatalog
- func (s *Server) ConfigPreview(ctx context.Context, name string, in ConfigChange) (ConfigChangeResult, error)
- func (s *Server) ConfigRead(ctx context.Context, name, id string) (ConfigState, error)
- func (s *Server) QbitCompatAddr() string
- func (s *Server) RemoteAudit(ctx context.Context, deviceID uint, command, result string)
- func (s *Server) RemoteDispatcher() remote.Dispatcher
- func (s *Server) Serve(addr string) error
- func (s *Server) SetAPITokens(store *apitoken.Store, audit appAuditRecorder)
- func (s *Server) SetAssistantService(svc *assistant.Service)
- func (s *Server) SetChatOpsDeps(deps *ChatOpsDeps)
- func (s *Server) SetMediaService(svc *recognize.Service)
- func (s *Server) SetOrganizeService(svc *organize.Service)
- func (s *Server) SetQAHook(fn func(*http.ServeMux))
- func (s *Server) SetQbitCompat(qc *qbitcompat.Server)
- func (s *Server) SetQbitCompatControl(c QbitCompatControl)
- func (s *Server) SetRemoteHost(h *remote.Host)
- func (s *Server) SetSubscribeService(svc *subscribe.Service)
- func (s *Server) Shutdown(ctx context.Context) error
- type SiteAttendanceResponse
- type SiteCategoriesConfig
- type SiteCategory
- type SiteCategoryOption
- type SiteConfigResponse
- type SiteDownloaderSummaryItem
- type SiteDownloaderSummaryResponse
- type SiteFaviconInfo
- type SiteLevelsResponse
- type SiteLoginConfigUpdateRequest
- type SiteLoginStateResponse
- type SiteProxyOption
- type SiteProxyRequest
- type SiteProxyResponse
- type SiteSearchParams
- type SiteValidationRequest
- type SiteValidationResponse
- type SiteVisitReportRequest
- type SupportedSiteDefinition
- type SyncFailedEntry
- type SyncRequest
- type SyncResponse
- type TemplateImportRequest
- type TemplateResponse
- type TokenCreated
- type TorrentActionTarget
- type TorrentDetailFile
- type TorrentDetailRequest
- type TorrentDetailResponse
- type TorrentDetailTracker
- type TorrentItemResponse
- type TorrentManifestItem
- type TorrentPushItem
- type TorrentPushRequest
- type TorrentPushResponse
- type TorrentPushResultItem
- type TransferJobView
- type TransferPathMapsRequest
- type TransferRequest
- type TransferRuleRequest
- type TransferRuleView
- type UserInfoHistoryResponse
- type UserInfoResponse
- type UserInfoTrendsResponse
Constants ¶
const ( BrushGranDay = utils.PeriodDay BrushGranWeek = utils.PeriodWeek BrushGranMonth = utils.PeriodMonth BrushGranQuarter = utils.PeriodQuarter BrushGranYear = utils.PeriodYear )
刷流收益的分段与每种分段默认、最多几段(与辅种统计共用 utils 里的分段)。
const ( // BrushDeleteHandover(默认,不带参数也是它)交给自动删种:删掉任务和刷流记录以后,种子不再归刷流管,按自动删种的规则处理。 BrushDeleteHandover = "handover" // BrushDeleteKeep 保留:先给种子加上保留标签(pt-tools-keep),自动删除都跳过它们,再删任务。 BrushDeleteKeep = "keep" )
删除刷流任务时,任务名下留在下载器里的种子怎么办:DELETE /api/brush/tasks/{id}?torrents=。
const (
// AppRemoteAPILevel 是 App API 的兼容级别:不兼容的改动才加一,App 遇到不认识的级别时提示升级
AppRemoteAPILevel = 1
)
const ConfigSecretSet = "<已设置>"
ConfigSecretSet 是读配置时有值的密钥显示成的占位;没有值时是空串。改的时候交回占位表示不改。
const FeatureCredentialKeepEnabled = "site_credential_keep_enabled"
FeatureCredentialKeepEnabled 写在 /api/ping 的 features 里:扩展看到它才会让定时同步推没启用的站点。 旧版 pt-tools 不认 keep_enabled,照样会把站点启用,所以扩展要先确认。
const FeatureCredentialVerify = "site_credential_verify"
FeatureCredentialVerify 写在 /api/ping 的 features 里:扩展看到它才会把认不出格式的 Cookie 带上 verify_cookie 推过来。 旧版 pt-tools 不认 verify_cookie,会不验证直接保存,可能拿一组没登录的 Cookie 换掉能用的那组。
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
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
func RegisterChatOpsRoutes ¶ added in v0.31.0
Types ¶
type AddDownloaderTorrentRequest ¶ added in v0.18.0
type AddDownloaderTorrentRequest struct {
DownloaderIDs []uint `json:"downloader_ids"`
SourceURL string `json:"source_url"`
MagnetLink string `json:"magnet_link"`
TorrentBase64 string `json:"torrent_base64"`
SavePath string `json:"save_path"`
Category string `json:"category"`
Tags string `json:"tags"`
AddPaused bool `json:"add_paused"`
}
type AddDownloaderTorrentResponse ¶ added in v0.18.0
type AddDownloaderTorrentResponse struct {
SuccessCount int `json:"success_count"`
FailedCount int `json:"failed_count"`
Results []AddDownloaderTorrentResult `json:"results"`
}
type AddDownloaderTorrentResult ¶ added in v0.18.0
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 AppBrushPeriod ¶
type AppBrushPeriod struct {
// Start 是这一段的第一天,End 是最后一天(yyyy-mm-dd,主机时区;最后一段的 End 可能在今天以后)
Start string `json:"start"`
End string `json:"end"`
AppBrushStat
}
AppBrushPeriod 是一段时间(一天、一周、一个月、一个季度或一年)的刷流收益。
type AppBrushStat ¶
type AppBrushStat struct {
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
Added int `json:"added"`
Removed int `json:"removed"`
}
AppBrushStat 是一段时间的刷流收益。
type AppBrushStats ¶
type AppBrushStats struct {
Granularity string `json:"granularity"`
Periods int `json:"periods"`
From string `json:"from"`
To string `json:"to"`
Totals []AppBrushPeriod `json:"totals"`
Tasks []AppBrushTaskPeriods `json:"tasks"`
}
AppBrushStats 是 GET /brush/stats:最近若干段全部刷流任务的合计与每个任务的收益,最后一段是当前这一段(只算到今天)。
type AppBrushTask ¶
type AppBrushTask struct {
ID uint `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Site string `json:"site"`
SiteEnabled bool `json:"site_enabled"`
Downloader string `json:"downloader"`
Active int `json:"active"`
Downloading int `json:"downloading"`
ActiveSize int64 `json:"active_size"`
Today AppBrushStat `json:"today"`
Total AppBrushStat `json:"total"`
}
AppBrushTask 是 GET /brush/tasks 的一项。
type AppBrushTaskPeriods ¶
type AppBrushTaskPeriods struct {
ID uint `json:"id"`
Name string `json:"name"`
Periods []AppBrushPeriod `json:"periods"`
}
AppBrushTaskPeriods 是一个任务各段的收益。
type AppDelta ¶
type AppDelta struct {
From string `json:"from"`
To string `json:"to"`
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
Bonus float64 `json:"bonus"`
Sites []AppSiteDelta `json:"sites"`
Error string `json:"error,omitempty"`
}
AppDelta 是一段时间里的增量(站点数据历史,M2)。Error 不为空时增量没算出来,数字都是 0,不代表这段时间没有流量。 增量来自每日快照,Downloaded 只有计费口径。
type AppDownloader ¶
type AppDownloader struct {
ID uint `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Default bool `json:"default"`
// Reachable 是这一次读到了状态或剩余空间;读不到时 Error 写明原因
Reachable bool `json:"reachable"`
Error string `json:"error,omitempty"`
Version string `json:"version,omitempty"`
UploadSpeed int64 `json:"upload_speed"`
DownloadSpeed int64 `json:"download_speed"`
// Uploaded、Downloaded 是下载器自己记的累计量
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
FreeSpace int64 `json:"free_space"`
}
AppDownloader 是 GET /downloaders 的一项:启用的下载器与它现在的传输状态。不含地址、账号与密码。
type AppDownloaderFailure ¶
type AppDownloaderFailure struct {
DownloaderID uint `json:"downloader_id"`
Downloader string `json:"downloader"`
Error string `json:"error"`
}
AppDownloaderFailure 是一台没取到种子的下载器。
type AppDownloaderList ¶
type AppDownloaderList struct {
Items []AppDownloader `json:"items"`
}
AppDownloaderList 是 GET /downloaders。
type AppEpisode ¶
type AppEpisode struct {
Number int `json:"number"`
Name string `json:"name,omitempty"`
AirDate string `json:"air_date,omitempty"`
State string `json:"state"`
// Source 是状态从哪里来的(library、subscription、downloader),Version 是现在的版本(制作组与分辨率)
Source string `json:"source,omitempty"`
Version string `json:"version,omitempty"`
ManualSkip bool `json:"manual_skip,omitempty"`
ManualUnlock bool `json:"manual_unlock,omitempty"`
}
AppEpisode 是剧集一集的情况:library、downloading、missing、waiting_version(等锁住的版本)、upcoming 或 skipped(不追)。
type AppEpisodeRule ¶
type AppEpisodeRule struct {
Group string `json:"group"`
Mode string `json:"mode"`
Offset int `json:"offset"`
Source string `json:"source"`
Note string `json:"note,omitempty"`
UpdatedAt int64 `json:"updated_at"`
}
AppEpisodeRule 是追剧对一个制作组(空 = 所有组)的集号规则:mode 是 tmdb、period_part(按期号与上下)、date(按播出日期) 或 offset(TMDB 的集号 = 标题里的集号 + offset)。
type AppEpisodeRuleInput ¶
type AppEpisodeRuleInput struct {
Group string `json:"group"`
Mode string `json:"mode"`
Offset int `json:"offset"`
Note string `json:"note"`
}
AppEpisodeRuleInput 是 PUT /subscriptions/{id}/episode-rules:同一个制作组已有规则时替换。
type AppEpisodeSkip ¶
type AppEpisodeSkip struct {
Skip *bool `json:"skip"`
}
AppEpisodeSkip 是 POST /subscriptions/{id}/episodes/{n}/skip:true 跳过这一集,false 重新要。
type AppEpisodeUnlock ¶
type AppEpisodeUnlock struct {
Unlock *bool `json:"unlock"`
}
AppEpisodeUnlock 是 POST /subscriptions/{id}/episodes/{n}/unlock:true 这一集不受版本锁限制(并马上搜一次),false 恢复。
type AppExploreItem ¶
type AppExploreItem struct {
ID int `json:"id"`
MediaType string `json:"media_type"`
Title string `json:"title"`
OriginalTitle string `json:"original_title,omitempty"`
Year int `json:"year,omitempty"`
Overview string `json:"overview,omitempty"`
PosterPath string `json:"poster_path,omitempty"`
VoteAverage float64 `json:"vote_average,omitempty"`
InLibrary bool `json:"in_library"`
Subscribed bool `json:"subscribed"`
SubscriptionID uint `json:"subscription_id,omitempty"`
}
AppExploreItem 是 TMDB 的一个条目,标上已入库、已订阅。
type AppExplorePage ¶
type AppExplorePage struct {
Items []AppExploreItem `json:"items"`
Page int `json:"page"`
TotalPages int `json:"total_pages"`
}
AppExplorePage 是 GET /explore 的回应。
type AppFromTorrent ¶
type AppFromTorrent struct {
Site string `json:"site"`
TorrentID string `json:"torrent_id"`
Title string `json:"title,omitempty"`
}
AppFromTorrent 是一键追剧时选中的种子:Title 可选,只在搜索缓存里没有这个种子时用作在这个站点搜索的关键字。
type AppLibraryRef ¶
AppLibraryRef 是整理计划用的媒体库。
type AppMediaHistory ¶
type AppMediaHistory struct {
ID uint `json:"id"`
MediaType string `json:"media_type"`
TMDBID int `json:"tmdb_id"`
Title string `json:"title"`
Year int `json:"year,omitempty"`
Season int `json:"season,omitempty"`
Episode int `json:"episode,omitempty"`
EpisodeEnd int `json:"episode_end,omitempty"`
TorrentName string `json:"torrent_name"`
Library string `json:"library,omitempty"`
TargetPath string `json:"target_path,omitempty"`
Mode string `json:"mode"`
Size int64 `json:"size"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
CreatedAt int64 `json:"created_at"`
}
AppMediaHistory 是 GET /media/history 的一项。
type AppMediaLibrary ¶
type AppMediaLibrary struct {
ID uint `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Anime bool `json:"anime"`
Path string `json:"path"`
// Mode 是整理方式,空的是整理设置里的默认方式
Mode string `json:"mode"`
Scrape bool `json:"scrape"`
ClassifyDir bool `json:"classify_dir"`
OverwriteMode string `json:"overwrite_mode"`
Enabled bool `json:"enabled"`
}
AppMediaLibrary 是 GET /media/libraries 的一项。
type AppMediaMatch ¶
type AppMediaMatch struct {
ID int `json:"id"`
MediaType string `json:"media_type"`
Title string `json:"title"`
OriginalTitle string `json:"original_title,omitempty"`
Year int `json:"year,omitempty"`
Overview string `json:"overview,omitempty"`
PosterPath string `json:"poster_path,omitempty"`
VoteAverage float64 `json:"vote_average,omitempty"`
IMDbID string `json:"imdb_id,omitempty"`
Score float64 `json:"score,omitempty"`
}
AppMediaMatch 是 TMDB 上的一个条目:识别出来的,或者候选(候选带 score)。
type AppMediaMeta ¶
type AppMediaMeta struct {
NameCN string `json:"name_cn,omitempty"`
NameEN string `json:"name_en,omitempty"`
Year int `json:"year,omitempty"`
Type string `json:"type,omitempty"`
Season int `json:"season,omitempty"`
SeasonEnd int `json:"season_end,omitempty"`
Episode int `json:"episode,omitempty"`
EpisodeEnd int `json:"episode_end,omitempty"`
Complete bool `json:"complete,omitempty"`
Resolution string `json:"resolution,omitempty"`
Source string `json:"source,omitempty"`
VideoCodec string `json:"video_codec,omitempty"`
HDR []string `json:"hdr,omitempty"`
Audio []string `json:"audio,omitempty"`
Group string `json:"group,omitempty"`
Edition []string `json:"edition,omitempty"`
}
AppMediaMeta 是从种子标题解析出来的信息。
type AppMeta ¶
type AppMeta struct {
Name string `json:"name"`
Version string `json:"version"`
RemoteAPILevel int `json:"remote_api_level"`
Features []string `json:"features"`
Principal AppPrincipalV `json:"principal"`
}
AppMeta 是 GET /meta 的回应。
type AppMobileOption ¶
AppMobileOption is an editor choice. It deliberately contains no credentials or addresses.
type AppMobileOptions ¶
type AppMobileOptions struct {
Sites []AppMobileSiteOption `json:"sites"`
Downloaders []AppMobileOption `json:"downloaders"`
Profiles []AppMobileOption `json:"profiles"`
Libraries []AppMobileOption `json:"libraries"`
Errors map[string]string `json:"errors,omitempty"`
}
type AppMobileSiteOption ¶
type AppOrganizeInput ¶
type AppOrganizeInput struct {
DownloaderID uint `json:"downloader_id"`
Hash string `json:"hash"`
MediaType string `json:"media_type,omitempty"`
TMDBID int `json:"tmdb_id,omitempty"`
LibraryID uint `json:"library_id,omitempty"`
}
AppOrganizeInput 是 POST /media/organize 与 /media/organize/preview:下载器里的一个种子(hash 是 info hash,没有时用 task_id)。 可以指定 TMDB 条目(media_type 与 tmdb_id 一起给)与媒体库;不指定时自动识别、按类型选库。
type AppOrganizeItem ¶
type AppOrganizeItem struct {
Rel string `json:"rel"`
Size int64 `json:"size"`
Target string `json:"target,omitempty"`
Season int `json:"season,omitempty"`
Episode int `json:"episode,omitempty"`
EpisodeEnd int `json:"episode_end,omitempty"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
HistoryID uint `json:"history_id,omitempty"`
}
AppOrganizeItem 是整理计划里的一个视频文件。Status:pending 要整理,done 库里已经有了,exists 目标被别的文件占着(不覆盖), replace 换掉 pt-tools 之前放进库的旧版本,failed 整理不了(message 写明原因)。
type AppOrganizePlan ¶
type AppOrganizePlan struct {
DownloaderID uint `json:"downloader_id"`
Downloader string `json:"downloader"`
Hash string `json:"hash"`
Name string `json:"name"`
Match *AppMediaMatch `json:"match,omitempty"`
Library *AppLibraryRef `json:"library,omitempty"`
Category string `json:"category,omitempty"`
Mode string `json:"mode,omitempty"`
Items []AppOrganizeItem `json:"items"`
// Skipped 是不整理的文件(样片、太小的、不是视频的)有几个
Skipped int `json:"skipped"`
Problem string `json:"problem,omitempty"`
}
AppOrganizePlan 是一个种子的整理计划(预览与执行共用):problem 不为空时整个种子整理不了。
type AppOrganizeResult ¶
type AppOrganizeResult struct {
Plan *AppOrganizePlan `json:"plan,omitempty"`
Created int `json:"created"`
Done int `json:"done"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
Messages []string `json:"messages"`
Queued bool `json:"queued"`
}
AppOrganizeResult 是 POST /media/organize 与 /media/history/{id}/retry 的结果:queued 为真时整理还在后台进行,稍后看整理历史。
type AppOverview ¶
type AppOverview struct {
Totals AppTotals `json:"totals"`
Today AppDelta `json:"today"`
UpdatedAt int64 `json:"updated_at"`
}
AppOverview 是 GET /overview:已启用站点的合计与今天的增量。
type AppPage ¶
type AppPage[T any] struct { Items []T `json:"items"` Total int `json:"total"` Page int `json:"page"` PageSize int `json:"page_size"` }
AppPage 是分页的回应。
type AppPrincipalV ¶
type AppPrincipalV struct {
Kind string `json:"kind"`
Name string `json:"name,omitempty"`
Scopes []string `json:"scopes"`
}
AppPrincipalV 是调用者自己的主体(App 用来判断能不能显示写操作)。
type AppProgress ¶
type AppProgress struct {
Total int `json:"total"`
Required int `json:"required"`
Aired int `json:"aired"`
InLibrary int `json:"in_library"`
Downloading int `json:"downloading"`
Waiting int `json:"waiting"`
Skipped int `json:"skipped"`
Missing []int `json:"missing"`
}
AppProgress 是订阅的进度。剧集:Required 是要追的集(起始集以后、没跳过的),Waiting 是在等锁住的版本的(也算在 Missing 里), Skipped 是不追的。
type AppPushRequest ¶
type AppPushRequest struct {
Site string `json:"site"`
TorrentID string `json:"torrent_id"`
DownloaderID uint `json:"downloader_id"`
Title string `json:"title"`
Category string `json:"category"`
Tags string `json:"tags"`
SavePath string `json:"save_path"`
}
AppPushRequest 是 POST /push:服务端经站点下载种子文件,再经推送闸门(磁盘空间、站点做种容量)放进下载器。 DownloaderID 为 0 时用默认下载器。
type AppPushResult ¶
type AppPushResult struct {
Success bool `json:"success"`
Skipped bool `json:"skipped"`
Message string `json:"message,omitempty"`
InfoHash string `json:"info_hash,omitempty"`
DownloaderID uint `json:"downloader_id"`
Downloader string `json:"downloader"`
}
AppPushResult 是 POST /push 的回应。Skipped 为真时下载器里已经有这个种子。
type AppRecognition ¶
type AppRecognition struct {
Summary string `json:"summary"`
Meta AppMediaMeta `json:"meta"`
Match *AppMediaMatch `json:"match,omitempty"`
// Source 是怎么认出来的:override(手动纠正过)、imdb(按站点给的 IMDb 编号)、search(按名字搜)、none(没认出来)
Source string `json:"source"`
Score float64 `json:"score,omitempty"`
Candidates []AppMediaMatch `json:"candidates"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
}
AppRecognition 是 POST /media/recognize 的结果:Match 为空时没有可靠的匹配(看 candidates,或者到网页上手动纠正)。
type AppRecognizeInput ¶
type AppRecognizeInput struct {
Title string `json:"title"`
Subtitle string `json:"subtitle"`
IMDbID string `json:"imdb_id"`
}
AppRecognizeInput 是 POST /media/recognize:种子标题与副标题(至少一个)、站点给的 IMDb 编号(可选)。
type AppRescrapeResult ¶
type AppRescrapeResult struct {
Records int `json:"records"`
Written int `json:"written"`
Messages []string `json:"messages"`
Queued bool `json:"queued"`
}
AppRescrapeResult 是 POST /media/history/{id}/scrape 与 /subscriptions/{id}/torrents/{tid}/scrape 的结果: records 是刮削了的整理记录数(同一部在这个媒体库里的),written 是写了的文件数;queued 为真时还在后台刮削。
type AppRunStep ¶
AppRunStep 是一次运行里的一步:search、reject、lock、push、fail、adopt、wait 或 info。
type AppSchedule ¶
type AppSchedule struct {
Kind string `json:"kind"`
At string `json:"at,omitempty"`
Every int `json:"every,omitempty"`
Days []int `json:"days,omitempty"`
AirDelayHours int `json:"air_delay_hours,omitempty"`
AirRetryHours int `json:"air_retry_hours,omitempty"`
AirWindowDays int `json:"air_window_days,omitempty"`
IntervalMinutes int `json:"interval_minutes,omitempty"`
Cron string `json:"cron,omitempty"`
}
AppSchedule 是追剧主动搜索的定时:kind 为空时沿用全局间隔;airtime 按播出时间(at 是播出时刻,空的按 20:00)、 interval 每隔 interval_minutes 分钟(30 分钟到 7 天,从上次搜索算起)、 daily / every_days / weekly / monthly 按 at 的钟点(every 是每隔几天,days 是星期几 0–6 或几号 1–31)、 cron 按 cron 表达式(分 时 日 月 星期,几条用分号分开)。字段和 subscribe.Schedule 一一对应。
type AppSchedulePreview ¶
AppSchedulePreview 是预览:接下来几次搜索的时间(Unix 秒,不算随机偏移);按播出时间的不算,note 说明。
type AppSchedulePreviewInput ¶
type AppSchedulePreviewInput struct {
Schedule AppSchedule `json:"schedule"`
MediaType string `json:"media_type,omitempty"`
SubscriptionID uint `json:"subscription_id,omitempty"`
Count int `json:"count,omitempty"`
}
AppSchedulePreviewInput 是 POST /subscriptions/schedule/preview:看一个定时接下来几次什么时候搜(只读,不改订阅)。 subscription_id 给了时按那个订阅的类型与建立时间算(每隔几天从建立那天对齐);count 是几次(1–10,默认 5)。
type AppSearchError ¶
AppSearchError 是一个站点的搜索错误。
type AppSearchItem ¶
type AppSearchItem struct {
Site string `json:"site"`
TorrentID string `json:"torrent_id"`
Title string `json:"title"`
Subtitle string `json:"subtitle,omitempty"`
InfoHash string `json:"info_hash,omitempty"`
Size int64 `json:"size"`
Seeders int `json:"seeders"`
Leechers int `json:"leechers"`
Snatched int `json:"snatched,omitempty"`
UploadedAt int64 `json:"uploaded_at,omitempty"`
Category string `json:"category,omitempty"`
Tags []string `json:"tags,omitempty"`
Discount string `json:"discount,omitempty"`
DiscountEndAt int64 `json:"discount_end_at,omitempty"`
Free bool `json:"free"`
HasHR bool `json:"has_hr"`
IMDbID string `json:"imdb_id,omitempty"`
DoubanID string `json:"douban_id,omitempty"`
}
AppSearchItem 是一个搜索结果:只有站点与种子编号,不含详情、下载与磁力链接;推送用 POST /push。
type AppSearchRequest ¶
type AppSearchRequest struct {
Keyword string `json:"keyword"`
Sites []string `json:"sites"`
Category string `json:"category"`
FreeOnly bool `json:"free_only"`
MinSeeders int `json:"min_seeders"`
}
AppSearchRequest 是 POST /search:多站搜索。Sites 为空时搜所有启用的站点。
type AppSearchResult ¶
type AppSearchResult struct {
Items []AppSearchItem `json:"items"`
Total int `json:"total"`
Sites map[string]int `json:"sites"`
Errors []AppSearchError `json:"errors"`
DurationMs int64 `json:"duration_ms"`
}
AppSearchResult 是 POST /search 的回应。
type AppSite ¶
type AppSite struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
Enabled bool `json:"enabled"`
Login AppSiteLogin `json:"login"`
Attendance AppSiteAttendance `json:"attendance"`
User *AppSiteUser `json:"user,omitempty"`
}
AppSite 是 GET /sites 的一项:站点、登录状态、今天的签到与站点上的用户数据。不含 Cookie、API key、passkey 与站点地址。
type AppSiteAttendance ¶
type AppSiteAttendance struct {
Supported bool `json:"supported"`
Enabled bool `json:"enabled"`
Day string `json:"day"`
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
LastAttemptAt *int64 `json:"last_attempt_at,omitempty"`
}
AppSiteAttendance 是今天的签到。
type AppSiteDelta ¶
type AppSiteDelta struct {
Site string `json:"site"`
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
Bonus float64 `json:"bonus"`
}
AppSiteDelta 是一个站点的增量。
type AppSiteList ¶
type AppSiteList struct {
Items []AppSite `json:"items"`
UserError string `json:"user_error,omitempty"`
}
AppSiteList 是 GET /sites 的回应。UserError 不为空时站点上的用户数据没读到,各项都没有 user,不代表从没同步过。
type AppSiteLogin ¶
type AppSiteLogin struct {
Tier string `json:"tier"`
DaysRemaining int `json:"days_remaining"`
LastActiveAt *int64 `json:"last_active_at,omitempty"`
LastProbeAt *int64 `json:"last_probe_at,omitempty"`
LastProbeStatus string `json:"last_probe_status,omitempty"`
}
AppSiteLogin 是登录状态:Tier 是提醒档位(none、30d、14d、7d、3d、banned-imminent,没有访问记录时是 unknown), DaysRemaining 是离封号阈值还有几天。
type AppSiteUser ¶
type AppSiteUser struct {
Username string `json:"username"`
Level string `json:"level,omitempty"`
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
Ratio float64 `json:"ratio"`
Bonus float64 `json:"bonus"`
BonusPerHour float64 `json:"bonus_per_hour,omitempty"`
Seeding int `json:"seeding"`
Leeching int `json:"leeching"`
SeedingSize int64 `json:"seeding_size,omitempty"`
UnreadMessages int `json:"unread_messages"`
HnRUnsatisfied int `json:"hnr_unsatisfied,omitempty"`
UpdatedAt int64 `json:"updated_at"`
}
AppSiteUser 是站点上的用户数据。Downloaded 是计费下载量,不是实际传输量。
type AppSubscription ¶
type AppSubscription struct {
IncludeKeywords string `json:"include_keywords"`
ExcludeKeywords string `json:"exclude_keywords"`
ID uint `json:"id"`
MediaType string `json:"media_type"`
TMDBID int `json:"tmdb_id"`
Season int `json:"season"`
Title string `json:"title"`
OriginalTitle string `json:"original_title,omitempty"`
Year int `json:"year,omitempty"`
PosterPath string `json:"poster_path,omitempty"`
Status string `json:"status"`
Upgrade bool `json:"upgrade"`
Source string `json:"source"`
TotalEpisodes int `json:"total_episodes,omitempty"`
Progress AppProgress `json:"progress"`
Message string `json:"message,omitempty"`
LastSearchAt *int64 `json:"last_search_at,omitempty"`
NextSearchAt *int64 `json:"next_search_at,omitempty"`
CreatedAt int64 `json:"created_at"`
// ProfileID 是质量档案(0 用设置里的默认);Sites 是只在这些站点找(空的是全部站点);DownloaderID 是推送到哪个下载器
// (0 用设置里的);Category、Tags、SavePath 是推送时的分类、标签与保存目录
ProfileID uint `json:"profile_id"`
Sites []string `json:"sites"`
DownloaderID uint `json:"downloader_id"`
Category string `json:"category,omitempty"`
Tags string `json:"tags,omitempty"`
SavePath string `json:"save_path,omitempty"`
// 以下是追剧(剧集)的设置
Schedule AppSchedule `json:"schedule"`
LockVersion bool `json:"lock_version"`
LockGroup string `json:"lock_group,omitempty"`
LockResolution string `json:"lock_resolution,omitempty"`
StartEpisode int `json:"start_episode,omitempty"`
FollowNextSeason bool `json:"follow_next_season"`
NextSeasonID uint `json:"next_season_id,omitempty"`
LibraryID uint `json:"library_id,omitempty"`
CompletedAt *int64 `json:"completed_at,omitempty"`
}
AppSubscription 是一个订阅。
type AppSubscriptionCreate ¶
type AppSubscriptionCreate struct {
IncludeKeywords *string `json:"include_keywords,omitempty"`
ExcludeKeywords *string `json:"exclude_keywords,omitempty"`
MediaType string `json:"media_type"`
TMDBID int `json:"tmdb_id"`
Season int `json:"season"`
ProfileID uint `json:"profile_id"`
Upgrade bool `json:"upgrade"`
// Sites 是只在这些站点找(空的是全部站点);DownloaderID 是推送到哪个下载器(0 用设置里的);
// Category、Tags、SavePath 是推送时的分类、标签(逗号分开)与保存目录(空的按下载器的默认)
Sites []string `json:"sites,omitempty"`
DownloaderID uint `json:"downloader_id,omitempty"`
Category string `json:"category,omitempty"`
Tags string `json:"tags,omitempty"`
SavePath string `json:"save_path,omitempty"`
Schedule *AppSchedule `json:"schedule,omitempty"`
LockVersion *bool `json:"lock_version,omitempty"`
StartEpisode *int `json:"start_episode,omitempty"`
FollowNextSeason *bool `json:"follow_next_season,omitempty"`
LibraryID *uint `json:"library_id,omitempty"`
FromTorrent *AppFromTorrent `json:"from_torrent,omitempty"`
}
AppSubscriptionCreate 是 POST /subscriptions:订阅一部电影或剧集的一季(Season 为 0 时订最新一季)。 ProfileID 为 0 时用设置里的默认质量档案。剧集是追剧:没给定时与版本锁时按播出时间搜索、开着版本锁; FromTorrent 是从站点上的这个种子开始追(起始集默认取它的集号)。
type AppSubscriptionDetail ¶
type AppSubscriptionDetail struct {
AppSubscription
Episodes []AppEpisode `json:"episodes"`
Torrents []AppSubscriptionTorrent `json:"torrents"`
}
AppSubscriptionDetail 是 GET /subscriptions/{id}:订阅、每一集与下载过的种子。
type AppSubscriptionRun ¶
type AppSubscriptionRun struct {
ID uint `json:"id"`
Trigger string `json:"trigger"`
StartedAt int64 `json:"started_at"`
FinishedAt *int64 `json:"finished_at,omitempty"`
Status string `json:"status"`
Summary string `json:"summary"`
Steps []AppRunStep `json:"steps"`
StepsTruncated bool `json:"steps_truncated"`
}
AppSubscriptionRun 是订阅的一次运行(主动搜索、RSS 命中、建立、手动操作)。
type AppSubscriptionStatus ¶
type AppSubscriptionStatus struct {
Status string `json:"status"`
}
AppSubscriptionStatus 是 POST /subscriptions/{id}/status:active 开始(或接着)找,paused 暂停。
type AppSubscriptionTorrent ¶
type AppSubscriptionTorrent struct {
ID uint `json:"id"`
Site string `json:"site"`
TorrentID string `json:"torrent_id"`
Title string `json:"title"`
Status string `json:"status"`
Episode int `json:"episode,omitempty"`
EpisodeEnd int `json:"episode_end,omitempty"`
Complete bool `json:"complete"`
Size int64 `json:"size"`
Message string `json:"message,omitempty"`
CreatedAt int64 `json:"created_at"`
Files []AppTorrentFile `json:"files"`
CanOrganize bool `json:"can_organize"`
CanRescrape bool `json:"can_rescrape"`
}
AppSubscriptionTorrent 是订阅下载过的一个种子,带上每个视频文件整理、刮削得怎样。ID 是重新整理、重新刮削用的编号; can_organize 为真时能重新整理(有整理没成、不在自动重试的文件,或者种子标成了失败),can_rescrape 为真时能重新刮削。
type AppSubscriptionUpdate ¶
type AppSubscriptionUpdate struct {
IncludeKeywords *string `json:"include_keywords,omitempty"`
ExcludeKeywords *string `json:"exclude_keywords,omitempty"`
ProfileID *uint `json:"profile_id,omitempty"`
Upgrade *bool `json:"upgrade,omitempty"`
// Sites(空数组是全部站点)、DownloaderID(0 用设置里的)、Category、Tags、SavePath 是在哪里找、推到哪里
Sites *[]string `json:"sites,omitempty"`
DownloaderID *uint `json:"downloader_id,omitempty"`
Category *string `json:"category,omitempty"`
Tags *string `json:"tags,omitempty"`
SavePath *string `json:"save_path,omitempty"`
Schedule *AppSchedule `json:"schedule,omitempty"`
LockVersion *bool `json:"lock_version,omitempty"`
LockGroup *string `json:"lock_group,omitempty"`
LockResolution *string `json:"lock_resolution,omitempty"`
StartEpisode *int `json:"start_episode,omitempty"`
FollowNextSeason *bool `json:"follow_next_season,omitempty"`
LibraryID *uint `json:"library_id,omitempty"`
// TotalEpisodes 大于 0 时以它为这一季的集数,0 改回按 TMDB
TotalEpisodes *int `json:"total_episodes,omitempty"`
}
AppSubscriptionUpdate 是 PUT /subscriptions/{id}:只改给了的字段(没给的不变)。条目与季不能改。
type AppTask ¶
type AppTask struct {
ID uint `json:"id"`
Site string `json:"site"`
TorrentID string `json:"torrent_id"`
Title string `json:"title"`
Size int64 `json:"size"`
Category string `json:"category,omitempty"`
Tags string `json:"tags,omitempty"`
Free bool `json:"free"`
FreeLevel string `json:"free_level,omitempty"`
FreeEndAt *int64 `json:"free_end_at,omitempty"`
HasHR bool `json:"has_hr"`
Pushed bool `json:"pushed"`
PushedAt *int64 `json:"pushed_at,omitempty"`
Downloader string `json:"downloader,omitempty"`
Progress float64 `json:"progress"`
Completed bool `json:"completed"`
CompletedAt *int64 `json:"completed_at,omitempty"`
Source string `json:"source,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt int64 `json:"created_at"`
}
AppTask 是 GET /tasks 的一项:RSS 推送记录。不含下载地址;错误信息去掉了地址里的查询串。
type AppTemplate ¶
type AppTemplate struct {
Type string `json:"type"`
Group string `json:"group"`
Name string `json:"name"`
Desc string `json:"desc"`
NoTitle bool `json:"no_title"`
Vars []AppTemplateVar `json:"vars"`
SampleTitle string `json:"sample_title"`
SampleText string `json:"sample_text"`
Title string `json:"title"`
Text string `json:"text"`
Customized bool `json:"customized"`
UpdatedAt int64 `json:"updated_at,omitempty"`
}
AppTemplate 是一种事件与它现在的模板;没有自定义时 title、text 是空的,发的是内置文字(sample_title、sample_text 是它的样子)。 title、text 只给有 app:write 的调用者,只读的调用者看 customized 知道有没有自定义。no_title 的事件只有正文。
type AppTemplateCatalog ¶
type AppTemplateCatalog struct {
Groups []AppTemplateGroup `json:"groups"`
CommonVars []AppTemplateVar `json:"common_vars"`
Events []AppTemplate `json:"events"`
}
AppTemplateCatalog 是 GET /templates 的回应。
type AppTemplateGroup ¶
type AppTemplateGroup struct {
Key string `json:"key"`
Name string `json:"name"`
Desc string `json:"desc"`
}
AppTemplateGroup 是事件的一组:notify(通知)、reply(ChatOps 命令回复)、assistant(AI 助手回复)。
type AppTemplateInput ¶
AppTemplateInput 是 PUT /templates/{type} 的请求:空着的一项用内置文字,两项都空等于恢复默认。
type AppTemplatePreview ¶
AppTemplatePreview 是按示例数据渲染出来的标题与正文(只有正文的事件 title 是空的)。
type AppTemplatePreviewInput ¶
type AppTemplatePreviewInput struct {
Type string `json:"type"`
Title string `json:"title"`
Text string `json:"text"`
}
AppTemplatePreviewInput 是 POST /templates/preview 的请求。
type AppTemplateVar ¶
type AppTemplateVar struct {
Key string `json:"key"`
Type string `json:"type"`
Desc string `json:"desc"`
Sample string `json:"sample,omitempty"`
Item []AppTemplateVar `json:"item,omitempty"`
}
AppTemplateVar 是一个模板变量。sample 是示例值写成的文字(列表没有示例,字段在 item 里)。
type AppTorrent ¶
type AppTorrent struct {
DownloaderID uint `json:"downloader_id"`
Downloader string `json:"downloader"`
TaskID string `json:"task_id"`
InfoHash string `json:"info_hash"`
Title string `json:"title"`
Progress float64 `json:"progress"`
Size int64 `json:"size"`
State string `json:"state"`
Ratio float64 `json:"ratio"`
Seeds int `json:"seeds"`
Peers int `json:"peers"`
UploadSpeed int64 `json:"upload_speed"`
DownloadSpeed int64 `json:"download_speed"`
ETA int64 `json:"eta"`
AddedAt int64 `json:"added_at"`
CompletedAt int64 `json:"completed_at"`
Category string `json:"category,omitempty"`
Tags string `json:"tags,omitempty"`
SavePath string `json:"save_path,omitempty"`
}
AppTorrent 是下载器里的一个种子。
type AppTorrentActionResult ¶
type AppTorrentActionResult struct {
DownloaderID uint `json:"downloader_id"`
TaskID string `json:"task_id"`
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
AppTorrentActionResult 是一个种子的结果。
type AppTorrentActionsRequest ¶
type AppTorrentActionsRequest struct {
Action string `json:"action"`
Targets []TorrentActionTarget `json:"targets"`
}
AppTorrentActionsRequest 是 POST /torrents/actions:对一批种子暂停、继续、删除(只删种子)或连数据删除。
type AppTorrentActionsResult ¶
type AppTorrentActionsResult struct {
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Results []AppTorrentActionResult `json:"results"`
}
AppTorrentActionsResult 是 POST /torrents/actions 的回应。
type AppTorrentFile ¶
type AppTorrentFile struct {
ID uint `json:"id"`
Name string `json:"name"`
Episode int `json:"episode,omitempty"`
EpisodeEnd int `json:"episode_end,omitempty"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
ScrapeStatus string `json:"scrape_status,omitempty"`
ScrapeNote string `json:"scrape_note,omitempty"`
NextRetryAt *int64 `json:"next_retry_at,omitempty"`
Retrying bool `json:"retrying,omitempty"`
}
AppTorrentFile 是种子里一个视频文件的整理记录:status 是 done、failed、skipped 或 removed, scrape_status 是 ok、partial、failed 或空(没刮削过);retrying 为真时整理队列正在重试它。
type AppTorrentPage ¶
type AppTorrentPage struct {
Items []AppTorrent `json:"items"`
Total int `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
Failures []AppDownloaderFailure `json:"failures"`
}
AppTorrentPage 是 GET /torrents 的回应:Failures 不为空时列表不完整(有下载器没取到)。
type AppTotals ¶
type AppTotals struct {
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
Ratio float64 `json:"ratio"`
Seeding int `json:"seeding"`
Leeching int `json:"leeching"`
Bonus float64 `json:"bonus"`
BonusPerHour float64 `json:"bonus_per_hour"`
SeedingSize int64 `json:"seeding_size"`
SiteCount int `json:"site_count"`
UnreadMessages int `json:"unread_messages"`
}
AppTotals 是已启用站点的合计。Downloaded 是计费下载量(站点按优惠折算以后计入分享率),不是实际传输量。
type ApplyDownloaderToSitesRequest ¶ added in v0.6.0
type ApplyDownloaderToSitesRequest struct {
SiteIDs []uint `json:"site_ids"`
}
type ApplyDownloaderToSitesResponse ¶ added in v0.6.0
type ApplyDownloaderToSitesResponse struct {
UpdatedCount int `json:"updated_count"`
}
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 AttendanceDayResponse ¶
type AttendanceDayResponse struct {
Day string `json:"day"`
Today string `json:"today"`
Summary AttendanceDaySummary `json:"summary"`
Sites []AttendanceDaySite `json:"sites"`
}
AttendanceDayResponse 是「签到详情」:某天每个站点怎么签的。
type AttendanceDaySite ¶
type AttendanceDaySite struct {
SiteName string `json:"site_name"`
Status string `json:"status"`
Attempts int `json:"attempts"`
Message string `json:"message,omitempty"`
LastError string `json:"last_error,omitempty"`
LastAttemptAt *int64 `json:"last_attempt_at,omitempty"`
NextAttemptAt *int64 `json:"next_attempt_at,omitempty"`
// Method 是这一天签到用的方式:有尝试时取最后一次的,没有时按站点的签到方式
Method string `json:"method"`
// AI 这一天一共调了几次、最后用的模型与 token 合计
AIModel string `json:"ai_model,omitempty"`
AICalls int `json:"ai_calls"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
Events []AttendanceEventView `json:"events"`
}
AttendanceDaySite 是某天一个站点的签到:当天的结果(签到记录)加上每次尝试(签到事件)。
type AttendanceDaySummary ¶
type AttendanceDaySummary struct {
Sites int `json:"sites"`
Signed int `json:"signed"`
Already int `json:"already"`
Failed int `json:"failed"`
Pending int `json:"pending"`
Unsupported int `json:"unsupported"`
// AISites 是这一天借助 AI 签到(调过模型)的站点数
AISites int `json:"ai_sites"`
AICalls int `json:"ai_calls"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
}
AttendanceDaySummary 是某天所有站点签到的合计。
type AttendanceEventView ¶
type AttendanceEventView struct {
ID uint `json:"id"`
Trigger string `json:"trigger"`
Result string `json:"result"`
Method string `json:"method"`
AIModel string `json:"ai_model,omitempty"`
AICalls int `json:"ai_calls"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
DurationMs int64 `json:"duration_ms"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
StartedAt int64 `json:"started_at"`
FinishedAt int64 `json:"finished_at"`
}
AttendanceEventView 是一次签到尝试(时间为 Unix 秒)。
type AttendanceHistoryResponse ¶
type AttendanceHistoryResponse struct {
Days []string `json:"days"`
Rows []AttendanceHistoryRow `json:"rows"`
}
AttendanceHistoryResponse 是最近几天的签到记录:Days 从今天往前排。
type AttendanceHistoryRow ¶
type AttendanceHistoryRow struct {
SiteName string `json:"site_name"`
Day string `json:"day"`
Status string `json:"status"`
Attempts int `json:"attempts"`
Message string `json:"message,omitempty"`
LastError string `json:"last_error,omitempty"`
LastAttemptAt *int64 `json:"last_attempt_at,omitempty"`
}
AttendanceHistoryRow 是某站某天的签到结果。
type AttendanceRunResponse ¶
type AttendanceRunResponse struct {
Running bool `json:"running"`
StartedAt *int64 `json:"started_at,omitempty"`
FinishedAt *int64 `json:"finished_at,omitempty"`
Done int `json:"done"`
Total int `json:"total"`
Error string `json:"error,omitempty"`
}
AttendanceRunResponse 是一键签到的进度:Running 为 false 且有 FinishedAt 时是上一轮的结果。
type AttendanceSettingsDTO ¶
type AttendanceSettingsDTO struct {
WindowStart string `json:"window_start"`
WindowEnd string `json:"window_end"`
// AIEnabled 让 AI 过签到的验证码与答题;VisionModel 是识别验证码用的模型,空时用 AI 助手的模型
AIEnabled bool `json:"ai_enabled"`
VisionModel string `json:"vision_model"`
// AssistantReady、AssistantModel 只读:AI 助手是否启用并配好、用的哪个模型(界面提示用)
AssistantReady bool `json:"assistant_ready"`
AssistantModel string `json:"assistant_model,omitempty"`
// NotifyEnabled:每天所有站点签完后推一条签到结果(默认开);NotifyChannelIDs 是推到哪些通道,空表示所有启用的通道
NotifyEnabled bool `json:"notify_enabled"`
NotifyChannelIDs []uint `json:"notify_channel_ids"`
}
AttendanceSettingsDTO 是每日签到设置:时间窗(HH:MM,进程时区)与 AI 签到。
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 BatchTorrentActionRequest ¶ added in v0.18.0
type BatchTorrentActionRequest struct {
Action string `json:"action"`
Targets []TorrentActionTarget `json:"targets"`
SavePath string `json:"save_path"`
}
type BatchTorrentActionResponse ¶ added in v0.18.0
type BatchTorrentActionResponse struct {
SuccessCount int `json:"success_count"`
FailedCount int `json:"failed_count"`
Results []BatchTorrentActionResult `json:"results"`
}
type BatchTorrentActionResult ¶ added in v0.18.0
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 BrushDeleteResponse ¶
type BrushDeleteResponse struct {
Success bool `json:"success"`
Error string `json:"error,omitempty"`
Kept int `json:"kept,omitempty"`
Missing int `json:"missing,omitempty"`
Failed []BrushKeepFailure `json:"failed,omitempty"`
}
BrushDeleteResponse 是删除刷流任务的结果。选了保留时,Kept 是加上保留标签(本来就带的也算)并交还给用户的种子数, Missing 是已经不在下载器里的。有种子保留失败时任务不删、接口回 502,Error 与 Failed 写明是哪几个; 已经加上标签的保持保留(它们已经交还给用户)。
type BrushKeepFailure ¶
type BrushKeepFailure struct {
Title string `json:"title"`
InfoHash string `json:"info_hash"`
DownloaderID uint `json:"downloader_id"`
DownloaderName string `json:"downloader_name,omitempty"`
Message string `json:"message"`
}
BrushKeepFailure 是删除任务时保留失败的一个种子。
type BrushRunPage ¶
type BrushRunPage struct {
Items []BrushRunView `json:"items"`
Total int64 `json:"total"`
}
BrushRunPage 是运行记录的一页(新的在前)。
type BrushRunResponse ¶
type BrushRunResponse struct {
Result scheduler.BrushRunResult `json:"result"`
Error string `json:"error,omitempty"`
}
BrushRunResponse 是「立即运行」的结果;Error 不为空表示这一轮没跑完(站点或下载器出错)。
type BrushRunView ¶
type BrushRunView struct {
models.BrushRun
Steps []models.BrushRunStep `json:"steps"`
}
BrushRunView 是一轮运行记录,带上解开的步骤。
type BrushStatView ¶
type BrushStatView struct {
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
Added int `json:"added"`
Removed int `json:"removed"`
}
BrushStatView 是一段时间的收益。
type BrushStatsResponse ¶
type BrushStatsResponse struct {
// Granularity 是分段:day、week、month、quarter、year;Periods 是几段
Granularity string `json:"granularity"`
Periods int `json:"periods"`
// Days 是从第一段的第一天到今天一共几天
Days int `json:"days"`
From string `json:"from"`
To string `json:"to"`
Dates []string `json:"dates"`
Tasks []BrushStatsTask `json:"tasks"`
Totals []BrushStatsSeriesPoint `json:"totals"`
}
BrushStatsResponse 是最近若干段各任务与合计的收益(按进程时区分天,周从周一开始)。 最后一段是当前这一段(今天、本周、本月、本季度、今年),只算到今天。
type BrushStatsSeriesPoint ¶
type BrushStatsSeriesPoint struct {
// Date 是这一段的第一天,End 是最后一天(按天时两者相同;最后一段的 End 可能在今天以后)
Date string `json:"date"`
End string `json:"end"`
BrushStatView
}
BrushStatsSeriesPoint 是一段时间(一天、一周、一个月、一个季度或一年)的收益。
type BrushStatsTask ¶
type BrushStatsTask struct {
TaskID uint `json:"task_id"`
Name string `json:"name"`
Series []BrushStatsSeriesPoint `json:"series"`
}
BrushStatsTask 是一个任务最近若干段的收益。
type BrushTaskRequest ¶
type BrushTaskRequest struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
SiteName string `json:"site_name"`
DownloaderID uint `json:"downloader_id"`
SavePath string `json:"save_path"`
Category string `json:"category"`
Tags string `json:"tags"`
IntervalMin int `json:"interval_min"`
Section string `json:"section"`
Discounts string `json:"discounts"`
MinFreeRemainMin int `json:"min_free_remain_min"`
MinSizeGB float64 `json:"min_size_gb"`
MaxSizeGB float64 `json:"max_size_gb"`
MaxSeeders int `json:"max_seeders"`
MinLeechers int `json:"min_leechers"`
MaxPublishAgeMin int `json:"max_publish_age_min"`
ExcludeHR bool `json:"exclude_hr"`
IncludeKeywords string `json:"include_keywords"`
ExcludeKeywords string `json:"exclude_keywords"`
MaxDownloading int `json:"max_downloading"`
MaxTotalSizeGB float64 `json:"max_total_size_gb"`
MaxDailyDownloadGB float64 `json:"max_daily_download_gb"`
RemoveSeedTimeH float64 `json:"remove_seed_time_h"`
RemoveRatio float64 `json:"remove_ratio"`
RemoveLowSpeedKBs float64 `json:"remove_low_speed_kbs"`
RemoveLowSpeedWindowMin int `json:"remove_low_speed_window_min"`
RemoveInactiveH float64 `json:"remove_inactive_h"`
RemoveFreeExpiredIncomplete bool `json:"remove_free_expired_incomplete"`
RemoveWithData bool `json:"remove_with_data"`
}
BrushTaskRequest 是新建 / 修改刷流任务的请求体;字段含义见 models.BrushTask。
type BrushTaskView ¶
type BrushTaskView struct {
models.BrushTask
DownloaderName string `json:"downloader_name"`
SiteEnabled bool `json:"site_enabled"`
ActiveCount int `json:"active_count"`
DownloadingCount int `json:"downloading_count"`
ActiveSizeBytes int64 `json:"active_size_bytes"`
Today BrushStatView `json:"today"`
Total BrushStatView `json:"total"`
}
BrushTaskView 是任务列表 / 详情里的一项:配置加上当前状态与收益。
type ChatOpsDeps ¶ added in v0.31.0
type ChatOpsDeps struct {
NotificationSvc app.NotificationService
BindingSvc app.BindingService
AuditSvc app.AuditService
// TemplateSvc 是全局消息模板(M21);为 nil 时模板接口回 503
TemplateSvc app.TemplateService
}
type CleanupPreviewInput ¶
type CleanupPreviewInput struct {
CleanupScope string `json:"cleanup_scope"`
CleanupScopeTags string `json:"cleanup_scope_tags"`
CleanupRemoveData bool `json:"cleanup_remove_data"`
CleanupConditionMode string `json:"cleanup_condition_mode"`
CleanupMaxSeedTimeH int `json:"cleanup_max_seed_time_h"`
CleanupMinRatio float64 `json:"cleanup_min_ratio"`
CleanupMaxInactiveH int `json:"cleanup_max_inactive_h"`
CleanupSlowSeedTimeH int `json:"cleanup_slow_seed_time_h"`
CleanupSlowMaxRatio float64 `json:"cleanup_slow_max_ratio"`
CleanupDelFreeExpired bool `json:"cleanup_del_free_expired"`
CleanupDiskProtect bool `json:"cleanup_disk_protect"`
CleanupEmergency bool `json:"cleanup_emergency"`
CleanupMinDiskSpaceGB float64 `json:"cleanup_min_disk_space_gb"`
CleanupProtectDL bool `json:"cleanup_protect_dl"`
CleanupProtectHR bool `json:"cleanup_protect_hr"`
CleanupMinRetainH int `json:"cleanup_min_retain_h"`
CleanupProtectTags string `json:"cleanup_protect_tags"`
// 做种竞争度:超过 S/L 上限时删除(peer_ratio_remove_data)或只暂停
PeerRatioEnabled bool `json:"peer_ratio_enabled"`
PeerRatioMaxSL float64 `json:"peer_ratio_max_sl"`
PeerRatioRemoveData bool `json:"peer_ratio_remove_data"`
}
CleanupPreviewInput 是预览用的删种规则(自动删种页上的那几项,可以还没保存)。总开关与间隔不影响会删哪些,不用给。
type CleanupPreviewView ¶
type CleanupPreviewView struct {
Results []scheduler.CleanupResult `json:"results"`
}
CleanupPreviewView 是预览的结果:每台连得上的下载器一个。
type CleanupStatusView ¶
type CleanupStatusView struct {
Enabled bool `json:"enabled"`
IntervalMin int `json:"interval_min"`
// LastRun 是最近一轮(重启以后没有);NextRunAt 是下一轮大约什么时候(没启用时为空;磁盘空间不足时会提前)
LastRun *scheduler.CleanupRun `json:"last_run,omitempty"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
}
CleanupStatusView 是自动删种页上的「上次运行」。
type ConfigCatalog ¶
type ConfigCatalog struct {
Resources []ConfigResourceView `json:"resources"`
Excluded []string `json:"excluded"`
SecretPlaceholder string `json:"secret_placeholder"`
}
ConfigCatalog 是配置目录:能经网关读改的资源,以及不能的那些。
type ConfigChange ¶
type ConfigChange struct {
Op string `json:"op"`
ID string `json:"id,omitempty"`
Values map[string]any `json:"values,omitempty"`
}
ConfigChange 是一次改动:对象类用 set;列表类用 add(新增)、update、delete(要 id)。values 只写要改的字段。
type ConfigChangeResult ¶
type ConfigChangeResult struct {
Resource string `json:"resource"`
Op string `json:"op"`
ID string `json:"id,omitempty"`
Summary string `json:"summary"`
Changes []ConfigDiff `json:"changes"`
Impact []string `json:"impact"`
Applied bool `json:"applied"`
Item map[string]any `json:"item,omitempty"`
}
ConfigChangeResult 是预览或执行的结果。Applied 为假时没有改任何东西;为真时 Item 是改完的样子(删除时没有)。
type ConfigDiff ¶
type ConfigDiff struct {
Label string `json:"label"`
Field string `json:"field,omitempty"`
Before string `json:"before,omitempty"`
After string `json:"after,omitempty"`
Secret bool `json:"secret,omitempty"`
}
ConfigDiff 是一项改动:Label 是给人看的名字,Field 是字段;新增的没有 Before,删掉的没有 After。 Secret 为真时是密钥,两边都不写原文。
type ConfigResourceView ¶
type ConfigResourceView struct {
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
Kind string `json:"kind"`
IDField string `json:"id_field,omitempty"`
Ops []string `json:"ops"`
Fields []string `json:"fields"`
Required []string `json:"required,omitempty"`
Secrets []string `json:"secrets,omitempty"`
Hints map[string]string `json:"hints,omitempty"`
}
ConfigResourceView 是配置目录里的一项:资源的名字、说明、能做的操作、能改的字段与哪些是密钥。
type ConfigState ¶
type ConfigState struct {
Resource string `json:"resource"`
Kind string `json:"kind"`
IDField string `json:"id_field,omitempty"`
Item map[string]any `json:"item,omitempty"`
Items []map[string]any `json:"items,omitempty"`
}
ConfigState 是一个资源的现状(密钥已遮住):对象类是 item,列表类是 items(读一项时只有那一项)。
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 DeleteTasksRequest ¶ added in v0.21.0
type DeleteTasksRequest struct {
IDs []uint `json:"ids"` // 任务 ID 列表
}
DeleteTasksRequest 批量删除任务请求
type DeleteTasksResponse ¶ added in v0.21.0
type DeleteTasksResponse struct {
Success int `json:"success"` // 成功删除数量
Failed int `json:"failed"` // 失败数量
FailedIDs []uint `json:"failed_ids"` // 失败的任务 ID
FailedErrors []string `json:"failed_errors"` // 失败原因
}
DeleteTasksResponse 批量删除任务响应
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 DownloaderCapabilitiesResponse ¶ added in v0.18.0
type DownloaderCapabilitiesResponse struct {
Items []DownloaderCapability `json:"items"`
}
type DownloaderCapability ¶ added in v0.18.0
type DownloaderCapability struct {
DownloaderID uint `json:"downloader_id"`
DownloaderName string `json:"downloader_name"`
DownloaderType string `json:"downloader_type"`
CanPause bool `json:"can_pause"`
CanResume bool `json:"can_resume"`
CanDelete bool `json:"can_delete"`
CanDeleteWithData bool `json:"can_delete_with_data"`
CanSetLocation bool `json:"can_set_location"`
CanAddTorrent bool `json:"can_add_torrent"`
CanRecheck bool `json:"can_recheck"`
CanViewFiles bool `json:"can_view_files"`
CanViewTrackers bool `json:"can_view_trackers"`
// CanExportTorrent 表示能把种子导出成 .torrent(qBittorrent 4.5 起;实际版本在调用时再核对)。
CanExportTorrent bool `json:"can_export_torrent"`
// CanEditTrackers 表示能修改种子的 tracker 地址(qBittorrent 与 Transmission 都支持)。
CanEditTrackers bool `json:"can_edit_trackers"`
// CanKeep 表示能一键加、去「保留」标签(pt-tools-keep):qBittorrent 用标签,Transmission 用 labels。
CanKeep bool `json:"can_keep"`
}
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 DownloaderFailure ¶ added in v0.48.0
type DownloaderFailure struct {
DownloaderID uint `json:"downloader_id"`
DownloaderName string `json:"downloader_name"`
Error string `json:"error"`
}
DownloaderFailure 记录一台没能取到数据的下载器。
为什么要有它:这个接口会聚合多台下载器,以前某一台连不上就静默 continue, 然后照样返回 200 —— 前端看到的是一份「少了一台下载器的种子」的完整列表, 既没法提示用户,也无从判断数字为什么不对。设计文档 §5 的 partial 态 (「14 个站点里 12 个成功时,页面既不该整体报错也不该假装正常」)就是为这种情形定的, 而要表达它,响应里必须带上失败信息。
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 DownloaderTorrentItem ¶ added in v0.18.0
type DownloaderTorrentItem struct {
DownloaderID uint `json:"downloader_id"`
DownloaderName string `json:"downloader_name"`
DownloaderType string `json:"downloader_type"`
TaskID string `json:"task_id"`
InfoHash string `json:"info_hash"`
Title string `json:"title"`
Progress float64 `json:"progress"`
Seeds int `json:"seeds"`
Connections int `json:"connections"`
Size int64 `json:"size"`
AddedAt int64 `json:"added_at"`
CompletedAt int64 `json:"completed_at"`
Ratio float64 `json:"ratio"`
State string `json:"state"`
SavePath string `json:"save_path"`
Category string `json:"category"`
Tags string `json:"tags"`
UploadSpeed int64 `json:"upload_speed"`
DownloadSpeed int64 `json:"download_speed"`
ETA int64 `json:"eta"`
}
type DownloaderTorrentMetaResponse ¶ added in v0.18.0
type DownloaderTorrentsResponse ¶ added in v0.18.0
type DownloaderTorrentsResponse struct {
Items []DownloaderTorrentItem `json:"items"`
Total int `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
// Failures 为空表示所有已启用的下载器都取到了数据。非空即 partial:
// Items 里的数据是真的,但不完整。
Failures []DownloaderFailure `json:"failures,omitempty"`
}
type DownloaderTransferStatItem ¶ added in v0.18.0
type DownloaderTransferStatItem struct {
DownloaderID uint `json:"downloader_id"`
DownloaderName string `json:"downloader_name"`
DownloaderType string `json:"downloader_type"`
UploadSpeed int64 `json:"upload_speed"`
DownloadSpeed int64 `json:"download_speed"`
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
SessionUploaded int64 `json:"session_uploaded"`
SessionDownloaded int64 `json:"session_downloaded"`
FreeSpace int64 `json:"free_space"`
// Reachable 表示这一轮是否真的从这台下载器取到了数据(状态或剩余空间任一成功)。
//
// 为什么必须显式给出:本条目**只要能取到实例就会被追加**,取数失败时各字段留零值。
// 于是「出现在 downloaders 里」只证明实例构造成功,不证明客户端连得上 ——
// acquireDownloader 可能命中缓存实例,Transmission 的实现在普通 RPC 网络失败后
// 也不会清掉缓存的 healthy 标志。前端曾据此显示「已连接」,那是会说谎的。
Reachable bool `json:"reachable"`
// Error 是这一轮失败的原因(取到数据时为空)。给人看的诊断,不参与聚合。
Error string `json:"error,omitempty"`
// ClientVersion 是下载器自报的版本(画板 41 状态栏那格的第三段)。
//
// 取不到就留空:它是背景信息,不该让这个接口因为多问一句版本而变慢或失败。
// 值在 Server 上按「id + URL」缓存,所以每台只在第一次连上时问一次。
ClientVersion string `json:"client_version,omitempty"`
}
type DownloaderTransferStatsResponse ¶ added in v0.18.0
type DownloaderTransferStatsResponse struct {
TotalUploadSpeed int64 `json:"total_upload_speed"`
TotalDownloadSpeed int64 `json:"total_download_speed"`
TotalUploaded int64 `json:"total_uploaded"`
TotalDownloaded int64 `json:"total_downloaded"`
TotalSessionUploaded int64 `json:"total_session_uploaded"`
TotalSessionDownloaded int64 `json:"total_session_downloaded"`
TotalFreeSpace int64 `json:"total_free_space"`
Downloaders []DownloaderTransferStatItem `json:"downloaders"`
}
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"`
Passkey string `json:"passkey,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"`
MinSizeGB int `json:"min_size_gb"`
MaxSizeGB int `json:"max_size_gb"`
Enabled bool `json:"enabled"`
SiteID *uint `json:"site_id"`
RSSID *uint `json:"rss_id"`
Priority int `json:"priority"`
// Purpose 是规则用途:download(下载,默认)、notify(只用于命中规则的通知)、both。更新时空着表示不改
Purpose string `json:"purpose"`
}
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"`
MinSizeGB int `json:"min_size_gb"`
MaxSizeGB int `json:"max_size_gb"`
Enabled bool `json:"enabled"`
SiteID *uint `json:"site_id"`
RSSID *uint `json:"rss_id"`
Priority int `json:"priority"`
Purpose string `json:"purpose"`
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"` // 是否免费
SizeGB float64 `json:"size_gb"` // 种子大小(GB)
Decision string `json:"decision"` // 完整决策结果: downloaded / skipped
Reason string `json:"reason"` // 跳过原因(如果有)
Source string `json:"source"` // 下载通道: filter_rule / free_download / ""
// DetailMissing 是这个种子的详情没取到(RSS 试跑):标题按 RSS 里的,免费状态不知道(按非免费算)
DetailMissing bool `json:"detail_missing,omitempty"`
}
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"` // 是否仅匹配免费种子
MinSizeGB int `json:"min_size_gb"`
MaxSizeGB int `json:"max_size_gb"`
TestSizeGB float64 `json:"test_size_gb"` // 模拟种子大小,用于完整决策测试
TestIsFree *bool `json:"test_is_free"` // 覆盖 is_free 状态(nil=使用真实值)
GlobalSize int `json:"global_size"` // 模拟全局大小上限
FilterMode string `json:"filter_mode"` // 模拟 FilterMode
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"` // 匹配的种子详情
// Source 是这次试跑用的数据:history(最近入库的种子记录)或 rss(现拉的 RSS)
Source string `json:"source"`
// SourceName 是数据源的说明:RSS 的名称与站点,或「最近入库的种子记录(最多 N 条)」
SourceName string `json:"source_name"`
// DetailFailed 是 RSS 里详情没取到的条目数:它们按 RSS 里的标题算,免费状态不知道
DetailFailed int `json:"detail_failed,omitempty"`
}
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 MCPSettingsInput ¶
MCPSettingsInput 是 PUT /api/mcp/settings 的请求体:path 为空时用默认的 /mcp。
type MCPSettingsView ¶
type MCPSettingsView struct {
Enabled bool `json:"enabled"`
Path string `json:"path"`
// DefaultPath 是默认的路径(/mcp)
DefaultPath string `json:"default_path"`
// Tokens 是现在能连 MCP 的令牌个数(没过期、有 mcp:read 或 mcp:write);读不到令牌时是 -1
Tokens int `json:"tokens"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
MCPSettingsView 是 GET /api/mcp/settings 的回应。
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 NotifyStatsChannel ¶
type NotifyStatsChannel struct {
ConfID uint `json:"conf_id"`
Total int64 `json:"total"`
Sent int64 `json:"sent"`
Failed int64 `json:"failed"`
Pending int64 `json:"pending"`
Canceled int64 `json:"canceled"`
Throttled int64 `json:"throttled"`
Requeued NotifyStatsRequeue `json:"requeued"`
Sources []NotifyStatsSource `json:"sources"`
}
NotifyStatsChannel 是一个通道的统计。Sent 是已发出(含转进重发队列的 RSS 通知,以及发出后在消息里点了「忽略」的); Pending 是还在等(安静时段挂起、等重试);Canceled 是在 RSS 通知日志里取消的、或被同一种子后来的通知取代的; Throttled 是超出 RSS 每小时上限没发的。
type NotifyStatsRequeue ¶
type NotifyStatsRequeue struct {
Total int64 `json:"total"`
Sent int64 `json:"sent"`
Pending int64 `json:"pending"`
Dead int64 `json:"dead"`
}
NotifyStatsRequeue 是实时发不出去、转进重发队列的 RSS 通知(按发送的消息数,合并发送的一组算一条)。
type NotifyStatsSource ¶
type NotifyStatsSource struct {
Source string `json:"source"`
Total int64 `json:"total"`
Sent int64 `json:"sent"`
}
NotifyStatsSource 是一个来源在这个通道上的条数。
type NotifyStatsView ¶
type NotifyStatsView struct {
Since time.Time `json:"since"`
Days int `json:"days"`
Channels []NotifyStatsChannel `json:"channels"`
}
NotifyStatsView 是 GET /api/chatops/notifications/stats 的回应。
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 QbitCompatControl ¶
type QbitCompatControl interface {
// Runtime 是现在的监听情况
Runtime() QbitCompatRuntime
// Apply 按网页上设的地址重新监听(空串是关掉);地址由启动参数或环境变量指定时不动。返回监听失败的原因
Apply(addr string) error
}
QbitCompatControl 管 qB 兼容入口的监听(cmd 里实现):网页上改了监听地址时换监听。
type QbitCompatLogin ¶
type QbitCompatLogin struct {
At time.Time `json:"at"`
IP string `json:"ip"`
Username string `json:"username,omitempty"`
Token string `json:"token,omitempty"`
Result string `json:"result"`
}
QbitCompatLogin 是一次登录:时间、客户端的地址、客户端填的用户名、用的令牌(成功时)与结果 (ok、bad_credentials 令牌不对、scope 令牌没有 qB 兼容权限、locked 失败太多次被锁了)。
type QbitCompatRuntime ¶
type QbitCompatRuntime struct {
// Addr 是正在监听的地址;没在监听时为空
Addr string
// Want 是要监听的地址(启动参数、环境变量或网页上设的);都没设时为空
Want string
// Source 是 Want 从哪来:flag、env、settings;都没设时为空
Source string
// Error 是 Want 监听失败的原因
Error string
}
QbitCompatRuntime 是兼容入口的监听情况。
type QbitCompatView ¶
type QbitCompatView struct {
// ListenAddr 是正在监听的地址;Listening 为假时兼容入口没在监听
ListenAddr string `json:"listen_addr"`
Listening bool `json:"listening"`
// ListenSource 是要监听的地址从哪来:flag(启动参数)、env(环境变量)、settings(这里设的);都没设时为空
ListenSource string `json:"listen_source"`
// ConfiguredAddr 是要监听的地址;ListenError 是它监听失败的原因(例如端口被占了)
ConfiguredAddr string `json:"configured_addr"`
ListenError string `json:"listen_error,omitempty"`
// SettingsAddr 是这里存的监听地址(ListenSource 是 flag、env 时不管用)
SettingsAddr string `json:"settings_addr"`
DownloaderID uint `json:"downloader_id"`
FullControl bool `json:"full_control"`
// Downloader 是实际用的那台下载器的名字(没指定时是默认下载器);没有可用的下载器时是空的
Downloader string `json:"downloader"`
// DownloaderIssue 说明选的下载器为什么用不了(停用了、删掉了、没有默认下载器);用得了时为空
DownloaderIssue string `json:"downloader_issue,omitempty"`
// CompatTorrents 是经兼容入口加进实际用的那台下载器、还没经它删掉的种子数
CompatTorrents int64 `json:"compat_torrents"`
// Sessions 是登录着的客户端会话数;LastLogin、LastFailure 是最近一次成功、失败的登录(重启以后没有)
Sessions int `json:"sessions"`
LastLogin *QbitCompatLogin `json:"last_login,omitempty"`
LastFailure *QbitCompatLogin `json:"last_failure,omitempty"`
}
QbitCompatView 是 qB 兼容入口页看到的设置与状态。
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 RSSLinkTestRequest ¶
type RSSLinkTestRequest struct {
URL string `json:"url"`
// Site 是这条 RSS 所属的站点(站点页上试的时候带上):全局设置的「站点代理」按它判定;不带时按环境变量
Site string `json:"site,omitempty"`
}
RSSLinkTestRequest 是 POST /api/rss/test:添加、编辑 RSS 时先试一下链接(只拉一次,不存)。
type RSSLinkTestResponse ¶
type RSSLinkTestResponse struct {
Title string `json:"title"`
Count int `json:"count"`
Titles []string `json:"titles"`
}
RSSLinkTestResponse 是试的结果:RSS 的标题、条目数与最新的几条标题。
type RecentNotification ¶
type RecentNotification struct {
Source string `json:"source"`
LogID uint `json:"log_id"`
ConfID uint `json:"conf_id"`
Title string `json:"title"`
Site string `json:"site,omitempty"`
TorrentID string `json:"torrent_id,omitempty"`
Kind string `json:"kind"`
Result string `json:"result"`
Attempts int `json:"attempts"`
// Error 是最近一次投递失败的原因(遮掉凭证);没有失败过时为空
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
RecentNotification 是「最近的通知」里的一条:RSS 通知与后台监控通知合在一起按时间倒序。 Title 是通知的内置标题(RSS 是种子名),投递以前存下的:配了消息模板时实际收到的标题按模板, 几条 RSS 合并成一条发出时这里仍逐条列出。没有存下内容的(例如超出每小时上限没发的)为空。 Result 是 sent(已发出,含发出后点了「忽略」的)、failed、pending、canceled(取消或被取代)、throttled(超出每小时上限)。
type RemoteDeviceInput ¶
RemoteDeviceInput 是改设备的请求:不带的字段不改。
type RemotePairingInput ¶
type RemotePairingInput struct {
Scopes []string `json:"scopes"`
DirectURL string `json:"direct_url"`
}
RemotePairingInput 是添加设备的请求:权限(默认完全控制),以及这次链接里的直连地址(不填时用设置里的)。
type RemotePairingView ¶
type RemotePairingView struct {
remote.PairingTicket
// QRSVG 是链接的二维码(SVG 文本)
QRSVG string `json:"qr_svg"`
}
RemotePairingView 是新开的配对窗口:链接与二维码只在这里给一次。
type ReseedSettingsView ¶
type ReseedSettingsView struct {
reseed.Settings
Running bool `json:"running"`
CurrentRun *scheduler.ReseedCurrentRun `json:"current_run,omitempty"`
}
ReseedSettingsView 是设置加上「是否正在运行」与正在跑的那一轮。
type ResumeTorrentResponse ¶ added in v0.3.0
type ResumeTorrentResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
ResumeTorrentResponse 恢复种子响应
type SchedulePreviewInput ¶
type SchedulePreviewInput struct {
Schedule subscribe.Schedule `json:"schedule"`
MediaType string `json:"media_type,omitempty"`
SubscriptionID uint `json:"subscription_id,omitempty"`
Count int `json:"count,omitempty"`
}
SchedulePreviewInput 是 POST /api/media/subscriptions/schedule-preview:改定时的时候看接下来几次什么时候搜。 SubscriptionID 给了时按那个订阅的类型与建立时间算(每隔几天从建立那天对齐)。
type SchedulePreviewView ¶
type SchedulePreviewView struct {
Next []time.Time `json:"next"`
Note string `json:"note,omitempty"`
}
SchedulePreviewView 是预览的结果:接下来几次搜索的时间;按播出时间的不算,Note 说明为什么。
type SearchErrorResponse ¶ added in v0.2.0
SearchErrorResponse represents a search error in API response
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AssistantToolServer ¶
AssistantToolServer 是内置 AI 助手一次运行用的 MCP 服务:和 /mcp 同一套工具,调用方固定是 c(Kind 为 mcp.KindAssistant, 属主在 Subject),审计通道是 assistant。助手经内存传输连上它,运行结束时关掉。
func (*Server) ConfigApply ¶
func (s *Server) ConfigApply(ctx context.Context, name string, in ConfigChange) (ConfigChangeResult, error)
ConfigApply 按现状重新算一遍改动并保存,回改完的样子。
func (*Server) ConfigPreview ¶
func (s *Server) ConfigPreview(ctx context.Context, name string, in ConfigChange) (ConfigChangeResult, error)
ConfigPreview 算出一次改动会改什么(不保存)。
func (*Server) ConfigRead ¶
ConfigRead 读一类配置的现状(密钥遮住);id 不为空时只读列表里的那一项。
func (*Server) QbitCompatAddr ¶
QbitCompatAddr 是 qB 兼容入口正在监听的地址;没开时是空的。
func (*Server) RemoteAudit ¶
RemoteAudit 记下配对的结果(主机端的 Config.Audit):通道是 remote_device,用户是设备编号(密钥不对时是 0)。
func (*Server) RemoteDispatcher ¶
func (s *Server) RemoteDispatcher() remote.Dispatcher
RemoteDispatcher 是设备会话里请求的分发器:只挂 App API v1 的路由(不经主 mux,别的接口在这里根本不存在)。 主体是这台设备:权限范围是配对时(或之后改的)app:read / app:write,写请求按 remote_device 记审计。
func (*Server) SetAPITokens ¶
SetAPITokens 接上令牌库与写操作的审计(cmd 在启动时调用)。
func (*Server) SetAssistantService ¶
SetAssistantService 接上 AI 助手服务(为空时接口回 503)。
func (*Server) SetChatOpsDeps ¶ added in v0.31.0
func (s *Server) SetChatOpsDeps(deps *ChatOpsDeps)
func (*Server) SetMediaService ¶
SetMediaService 接上媒体识别服务(cmd 里建好后调用)。
func (*Server) SetOrganizeService ¶
SetOrganizeService 接上整理入库服务(cmd 里建好后调用)。
func (*Server) SetQAHook ¶ added in v0.31.0
SetQAHook installs a callback invoked once during Serve, after all production routes are registered. Used by the qa build tag (cmd/web_qa.go) to attach /test/* test injection endpoints. No-op in production builds.
func (*Server) SetQbitCompat ¶
func (s *Server) SetQbitCompat(qc *qbitcompat.Server)
SetQbitCompat 接上 qB 兼容入口(cmd 在开始接请求以前调用),设置页用它显示登录情况。
func (*Server) SetQbitCompatControl ¶
func (s *Server) SetQbitCompatControl(c QbitCompatControl)
SetQbitCompatControl 接上监听的管理(cmd 在开始接请求以前调用)。
func (*Server) SetRemoteHost ¶
SetRemoteHost 接上远程访问的主机端(cmd 构造)。没接时直连入口 404,设置接口回 503。
func (*Server) SetSubscribeService ¶
SetSubscribeService 接上订阅服务(cmd 里建好后调用)。
type SiteAttendanceResponse ¶
type SiteAttendanceResponse struct {
SiteName string `json:"site_name"`
SiteEnabled bool `json:"site_enabled"`
AttendanceEnabled bool `json:"attendance_enabled"`
Supported bool `json:"supported"`
UnsupportedReason string `json:"unsupported_reason,omitempty"`
// Challenge 是签到要过的一关(hdsky_captcha、opencd_captcha 要识别验证码,baka_quiz 要答题),要用 AI;不用时为空
Challenge string `json:"challenge,omitempty"`
Day string `json:"day"`
Status string `json:"status"`
Attempts int `json:"attempts"`
Message string `json:"message,omitempty"`
LastError string `json:"last_error,omitempty"`
ScheduledAt *int64 `json:"scheduled_at,omitempty"`
NextAttemptAt *int64 `json:"next_attempt_at,omitempty"`
LastAttemptAt *int64 `json:"last_attempt_at,omitempty"`
}
SiteAttendanceResponse 是一个站点的每日签到状态:能否签到、开关,以及当天的结果(没有记录时 Status 为空)。
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
SiteCategoryOption 分类选项
type SiteConfigResponse ¶ added in v0.6.0
type SiteConfigResponse struct {
Enabled *bool `json:"enabled"`
AuthMethod string `json:"auth_method"`
Cookie string `json:"cookie,omitempty"`
CookieEncrypted string `json:"cookie_encrypted,omitempty"`
HasCookie bool `json:"has_cookie"`
CookieFieldVisible bool `json:"cookie_field_visible"`
APIKey string `json:"api_key"`
APIUrl string `json:"api_url"`
Passkey string `json:"passkey"`
UploadLimitKBs int `json:"upload_limit_kbs"`
DownloadLimitKBs int `json:"download_limit_kbs"`
SeedingCapacityGB float64 `json:"seeding_capacity_gb"`
HRSeedTimeH int `json:"hr_seed_time_h"`
// HRRuleBuiltin:站点定义里已经写了 H&R 做种时长,用户填的 HRSeedTimeH 只在定义算不出时才用
HRRuleBuiltin bool `json:"hr_rule_builtin"`
RSS []models.RSSConfig `json:"rss"`
URLs []string `json:"urls,omitempty"`
WebURL string `json:"web_url,omitempty"`
IsBuiltin bool `json:"is_builtin"`
}
type SiteDownloaderSummaryItem ¶ added in v0.6.0
type SiteDownloaderSummaryResponse ¶ added in v0.6.0
type SiteDownloaderSummaryResponse struct {
Sites []SiteDownloaderSummaryItem `json:"sites"`
}
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 SiteLoginConfigUpdateRequest ¶ added in v0.35.0
type SiteLoginConfigUpdateRequest struct {
BanThresholdDays *int `json:"ban_threshold_days,omitempty"`
RemindBeforeDays *int `json:"remind_before_days,omitempty"`
ReminderCron *string `json:"reminder_cron,omitempty"`
NotificationChannelIDs *[]uint `json:"notification_channel_ids,omitempty"`
ProbeMode *string `json:"probe_mode,omitempty"`
}
SiteLoginConfigUpdateRequest is the payload for PUT /api/sites/{name}/login-state/config. All fields are optional; only non-nil pointers are applied so that callers can update one field at a time.
type SiteLoginStateResponse ¶ added in v0.35.0
type SiteLoginStateResponse struct {
SiteName string `json:"site_name"`
DisplayName string `json:"display_name,omitempty"`
BaseURL string `json:"base_url,omitempty"`
Enabled bool `json:"enabled"`
LastLoginAt *int64 `json:"last_login_at,omitempty"`
LastAccessAt *int64 `json:"last_access_at,omitempty"`
LastVisitAt *int64 `json:"last_visit_at,omitempty"`
EffectiveLastActiveAt *int64 `json:"effective_last_active_at,omitempty"`
EffectiveSource string `json:"effective_source"`
LastProbeAt *int64 `json:"last_probe_at,omitempty"`
NextProbeAt *int64 `json:"next_probe_at,omitempty"`
LastSuccessAt *int64 `json:"last_success_at,omitempty"`
FirstFailureAt *int64 `json:"first_failure_at,omitempty"`
AccessStaleSince *int64 `json:"access_stale_since,omitempty"`
LastProbeStatus string `json:"last_probe_status,omitempty"`
LastProbeError string `json:"last_probe_error,omitempty"`
ConsecutiveProbeFailures int `json:"consecutive_probe_failures"`
BanThresholdDays int `json:"ban_threshold_days"`
RemindBeforeDays int `json:"remind_before_days"`
ReminderCron string `json:"reminder_cron"`
NotificationChannelIDs []uint `json:"notification_channel_ids"`
LastReminderTier string `json:"last_reminder_tier"`
LastReminderSentAt *int64 `json:"last_reminder_sent_at,omitempty"`
DaysRemaining int `json:"days_remaining"`
Tier string `json:"tier"`
ProbeMode string `json:"probe_mode"`
}
SiteLoginStateResponse is the API representation of a site_login_state row. Cookie / CookieEncrypted MUST never appear here — the row is enriched with computed fields (effective_last_active, days_remaining, tier) at read time.
type SiteProxyOption ¶
type SiteProxyOption struct {
// ID 是规范化的站点 ID(注册表 ID 的小写)
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
}
SiteProxyOption 是站点多选里的一项:注册表里能发请求的站点。
type SiteProxyRequest ¶
type SiteProxyRequest struct {
Enabled bool `json:"enabled"`
ProxyURL string `json:"proxy_url"`
Mode string `json:"mode"`
Sites []string `json:"sites"`
}
SiteProxyRequest 是保存站点代理的请求。ProxyURL 与读到的(打了码的)相同表示不改,空串表示清除。
type SiteProxyResponse ¶
type SiteProxyResponse struct {
Enabled bool `json:"enabled"`
ProxyURL string `json:"proxy_url"`
Mode string `json:"mode"`
Sites []string `json:"sites"`
// UpdatedAt 是上次保存的时间,没保存过时为 null
UpdatedAt *time.Time `json:"updated_at"`
// SiteOptions 是站点多选的唯一数据来源:启用的在前,同组按名字排
SiteOptions []SiteProxyOption `json:"site_options"`
// ProxyUnreadable 为真时存着的代理地址解不开(加密密钥换过),要重新填
ProxyUnreadable bool `json:"proxy_unreadable,omitempty"`
}
SiteProxyResponse 是读到的站点代理设置。ProxyURL 里的密码换成了 ***。
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_and_api_key, passkey
Cookie string `json:"cookie,omitempty"`
APIKey string `json:"api_key,omitempty"`
APIURL string `json:"api_url,omitempty"`
Passkey string `json:"passkey,omitempty"`
}
SiteValidationRequest 站点验证请求
type SiteValidationResponse ¶ added in v0.2.0
type SiteValidationResponse struct {
Valid bool `json:"valid"`
// Verified 表示是否真的连接站点验证过凭证。目前只检查必填字段,恒为 false:
// 动态站点不在 site/v2 的定义注册表里,建不出驱动去发身份请求。
Verified bool `json:"verified"`
Message string `json:"message"`
FreeTorrents []string `json:"free_torrents,omitempty"` // 免费种子预览
}
SiteValidationResponse 站点验证响应
type SiteVisitReportRequest ¶ added in v0.35.0
type SiteVisitReportRequest struct {
SiteName string `json:"site_name"`
LastVisitAt string `json:"last_visit_at"`
}
SiteVisitReportRequest is the payload for POST /api/sites/visit emitted by the browser extension after webNavigation.onCompleted fires for a known PT site domain.
type SupportedSiteDefinition ¶ added in v0.30.1
type SupportedSiteDefinition struct {
ID string `json:"id"`
Name string `json:"name"`
Aka []string `json:"aka,omitempty"`
Description string `json:"description,omitempty"`
Schema string `json:"schema"`
URLs []string `json:"urls"`
FaviconURL string `json:"faviconUrl,omitempty"`
AuthMethod string `json:"authMethod,omitempty"`
HREnabled bool `json:"hrEnabled"`
}
type SyncFailedEntry ¶ added in v0.2.0
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"`
Passkey string `json:"passkey,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 TokenCreated ¶
type TokenCreated struct {
Token apitoken.Token `json:"token"`
Plaintext string `json:"plaintext"`
}
TokenCreated 是新建令牌的回应:明文只在这里出现一次。
type TorrentActionTarget ¶ added in v0.18.0
type TorrentDetailFile ¶ added in v0.18.0
type TorrentDetailRequest ¶ added in v0.18.0
type TorrentDetailResponse ¶ added in v0.18.0
type TorrentDetailResponse struct {
Torrent DownloaderTorrentItem `json:"torrent"`
Files []TorrentDetailFile `json:"files"`
Trackers []TorrentDetailTracker `json:"trackers"`
Features DownloaderCapability `json:"features"`
}
type TorrentDetailTracker ¶ added in v0.18.0
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 TransferJobView ¶
type TransferJobView struct {
models.TorrentTransferJob
SourceName string `json:"source_name"`
TargetName string `json:"target_name"`
Final bool `json:"final"`
}
TransferJobView 是任务列表里的一项:任务加上两台下载器的名称。
type TransferPathMapsRequest ¶
type TransferPathMapsRequest struct {
SourceID uint `json:"source_id"`
TargetID uint `json:"target_id"`
Items []transfer.PathMapEntry `json:"items"`
}
TransferPathMapsRequest 用 items 整体替换一对下载器之间的路径映射。
type TransferRequest ¶
type TransferRequest struct {
TargetID uint `json:"target_id"`
Items []transfer.Item `json:"items"`
}
TransferRequest 是预览与建任务的请求体:转到哪台下载器、哪些种子(源下载器 + info hash)。
type TransferRuleRequest ¶
type TransferRuleRequest struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
SourceDownloaderID uint `json:"source_downloader_id"`
TargetDownloaderID uint `json:"target_downloader_id"`
Category string `json:"category"`
Tag string `json:"tag"`
SiteName string `json:"site_name"`
MinSeedingHours int `json:"min_seeding_hours"`
MaxPerRun int `json:"max_per_run"`
IntervalMin int `json:"interval_min"`
}
TransferRuleRequest 是新建 / 修改规则的请求体;字段含义见 models.TransferRule。
type TransferRuleView ¶
type TransferRuleView struct {
models.TransferRule
SourceName string `json:"source_name"`
TargetName string `json:"target_name"`
}
TransferRuleView 是规则列表里的一项。
type UserInfoHistoryResponse ¶
type UserInfoHistoryResponse struct {
Site string `json:"site"`
Days int `json:"days"`
From string `json:"from"`
To string `json:"to"`
Points []v2.DailyPoint `json:"points"`
}
UserInfoHistoryResponse 是某站最近若干天的每日数据与增量。
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
type UserInfoTrendsResponse ¶
type UserInfoTrendsResponse struct {
Days int `json:"days"`
From string `json:"from"`
To string `json:"to"`
Dates []string `json:"dates"`
Totals []v2.TrendPoint `json:"totals"`
Sites map[string][]v2.TrendPoint `json:"sites"`
}
UserInfoTrendsResponse 是最近若干天每天的增量:各站一条序列,加上各站合计。
Source Files
¶
- api_app_v1.go
- api_app_v1_actions.go
- api_app_v1_assistant.go
- api_app_v1_config.go
- api_app_v1_follow.go
- api_app_v1_library.go
- api_app_v1_media.go
- api_app_v1_mobile.go
- api_app_v1_read.go
- api_app_v1_status.go
- api_app_v1_templates.go
- api_app_v1_torrents.go
- api_assistant.go
- api_brush.go
- api_chatops.go
- api_chatops_recent.go
- api_chatops_stats.go
- api_chatops_templates.go
- api_chatops_webhook.go
- api_cleanup.go
- api_cloak.go
- api_control.go
- api_cookiecloud.go
- api_credential.go
- api_downloader.go
- api_downloader_assistant.go
- api_downloader_directory.go
- api_downloader_torrents.go
- api_extension_actions.go
- api_favicon.go
- api_filter_rule.go
- api_levels.go
- api_log_level.go
- api_maintenance.go
- api_media.go
- api_media_library.go
- api_media_subscribe.go
- api_qbit_compat.go
- api_remote.go
- api_reseed.go
- api_rss_filter.go
- api_search.go
- api_site.go
- api_site_attendance.go
- api_site_attendance_events.go
- api_site_categories.go
- api_site_login.go
- api_site_proxy.go
- api_tokens.go
- api_torrent_download.go
- api_torrent_management.go
- api_torrent_push.go
- api_transfer.go
- api_userinfo.go
- api_userinfo_history.go
- api_version.go
- brush_delete.go
- config_gateway.go
- config_resources.go
- credential_verify.go
- deprecation.go
- login_limiter.go
- mcp.go
- mcp_setting.go
- remote.go
- routes_chatops.go
- server.go
- session_store.go
- site_categories.go
- torrent_keep.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package middleware 放请求主体(路线图 M12):谁发起的请求、有哪些权限范围。
|
Package middleware 放请求主体(路线图 M12):谁发起的请求、有哪些权限范围。 |
|
Package qbitcompat 是 qB 兼容入口(路线图 M13):在单独的端口上实现 qBittorrent WebUI API v2 的一个子集, 让 MoviePilot、IYUU、autobrr、Sonarr/Radarr 这类只认 qB 的工具把 pt-tools 当成下载器。
|
Package qbitcompat 是 qB 兼容入口(路线图 M13):在单独的端口上实现 qBittorrent WebUI API v2 的一个子集, 让 MoviePilot、IYUU、autobrr、Sonarr/Radarr 这类只认 qB 的工具把 pt-tools 当成下载器。 |