feat: initial Phase 1 implementation — core framework + Docker
- Data types (SManga, SChapter, Page, MangasPage, all Filter variants) - Source interfaces (Source, CatalogueSource) with MD5-based ID generation matching Tachiyomi/Suwayomi - HTTP client with per-host rate limiting, cookie jar, and 429 retry - FlareSolverr v1 client (FLARESOLVERR_URL env) - Generic GraphQL POST helper - goquery HTML parser wrappers - Source registry (panics on duplicate ID) - Multi-stage Dockerfile (golang:1.26-alpine + distroless) and compose.yml (postgres, flaresolverr, app)
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
package source
|
||||
|
||||
const (
|
||||
StatusUnknown = 0
|
||||
StatusOngoing = 1
|
||||
StatusCompleted = 2
|
||||
StatusLicensed = 3
|
||||
StatusHiatus = 5
|
||||
StatusCancelled = 6
|
||||
)
|
||||
|
||||
type SManga struct {
|
||||
URL string
|
||||
Title string
|
||||
Artist string
|
||||
Author string
|
||||
Description string
|
||||
Genre string // comma-separated
|
||||
Status int
|
||||
ThumbnailURL string
|
||||
Initialized bool
|
||||
}
|
||||
|
||||
type SChapter struct {
|
||||
URL string
|
||||
Name string
|
||||
DateUpload int64 // unix milliseconds
|
||||
ChapterNumber float32
|
||||
Scanlator string
|
||||
}
|
||||
|
||||
type Page struct {
|
||||
Index int
|
||||
URL string
|
||||
ImageURL string
|
||||
}
|
||||
|
||||
type MangasPage struct {
|
||||
Mangas []SManga
|
||||
HasNextPage bool
|
||||
}
|
||||
|
||||
// Filter interface
|
||||
|
||||
type Filter interface {
|
||||
Name() string
|
||||
Value() any
|
||||
}
|
||||
|
||||
// TextFilter — free-text input
|
||||
|
||||
type TextFilter struct {
|
||||
FilterName string
|
||||
Text string
|
||||
}
|
||||
|
||||
func (f *TextFilter) Name() string { return f.FilterName }
|
||||
func (f *TextFilter) Value() any { return f.Text }
|
||||
|
||||
// CheckboxFilter — boolean
|
||||
|
||||
type CheckboxFilter struct {
|
||||
FilterName string
|
||||
State bool
|
||||
}
|
||||
|
||||
func (f *CheckboxFilter) Name() string { return f.FilterName }
|
||||
func (f *CheckboxFilter) Value() any { return f.State }
|
||||
|
||||
// TriStateFilter — 0=ignore, 1=include, 2=exclude
|
||||
|
||||
type TriStateFilter struct {
|
||||
FilterName string
|
||||
State int
|
||||
}
|
||||
|
||||
func (f *TriStateFilter) Name() string { return f.FilterName }
|
||||
func (f *TriStateFilter) Value() any { return f.State }
|
||||
|
||||
// SelectFilter — dropdown
|
||||
|
||||
type SelectFilter struct {
|
||||
FilterName string
|
||||
Values []string
|
||||
Selected int
|
||||
}
|
||||
|
||||
func (f *SelectFilter) Name() string { return f.FilterName }
|
||||
func (f *SelectFilter) Value() any { return f.Selected }
|
||||
|
||||
// SortFilter
|
||||
|
||||
type SortSelection struct {
|
||||
Index int
|
||||
Ascending bool
|
||||
}
|
||||
|
||||
type SortFilter struct {
|
||||
FilterName string
|
||||
Values []string
|
||||
Selection SortSelection
|
||||
}
|
||||
|
||||
func (f *SortFilter) Name() string { return f.FilterName }
|
||||
func (f *SortFilter) Value() any { return f.Selection }
|
||||
|
||||
// GroupFilter — container of sub-filters
|
||||
|
||||
type GroupFilter struct {
|
||||
FilterName string
|
||||
Filters []Filter
|
||||
}
|
||||
|
||||
func (f *GroupFilter) Name() string { return f.FilterName }
|
||||
func (f *GroupFilter) Value() any { return f.Filters }
|
||||
Reference in New Issue
Block a user