Two visibility fixes so the UI reflects the shelf's real state on the next scan instead of only after the archive gate: - Missing items disappear at once: the user-facing filters already hid archived rows; the same listings now also require missing_scan_count = 0. A deleted or moved-then-not-yet-repointed file vanishes from the UI immediately, while purge timing stays gated on archived_at plus the retention window - grace protects data, not visibility. Restored automatically when the file returns. - Steam Deck SD-card model for unmounted storage: resolveLibrary stats each library's folder roots and flags libraries with no live folder as Offline (LibraryData gains the field, computed at request time so mounts/unmounts react instantly). The bookshelf shows an empty shelf plus a 'storage is not connected' notice for an offline selected library, and both the shared LibrarySwitcher and the bookshelf's inline select label offline libraries with their true holding counts. Nothing is marked or purged while offline. - TotalMediaCount skips offline libraries, so the 'All Books/Libraries' totals match what is actually visible. Verified live: renaming uploads/Manga away produced the notice, an empty shelf, and the offline dropdown label with a corrected total; renaming it back restored all 38 cards with zero dirty rows.
294 lines
5.9 KiB
Go
294 lines
5.9 KiB
Go
package templates
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/a-h/templ"
|
|
)
|
|
|
|
type User struct {
|
|
ID string
|
|
Username string
|
|
Email string
|
|
Role string
|
|
Theme string
|
|
FirstName string
|
|
LastName string
|
|
CreatedAt time.Time
|
|
Token string
|
|
Timezone string
|
|
}
|
|
|
|
type PageData struct {
|
|
User User
|
|
CurrentPage string
|
|
}
|
|
|
|
type CollectionData struct {
|
|
ID string
|
|
Name string
|
|
Description string
|
|
Color string
|
|
Icon string
|
|
IsSystem bool
|
|
}
|
|
|
|
type LibraryData struct {
|
|
ID string
|
|
Name string
|
|
Description string
|
|
TypeName string
|
|
TypeValue string
|
|
MediaCount int64
|
|
FolderCount int
|
|
// Offline is true when none of the library's folders exist on disk
|
|
// (e.g. an unmounted external drive). Contents stay intact and reappear
|
|
// when the storage returns.
|
|
Offline bool
|
|
}
|
|
|
|
type FolderData struct {
|
|
FolderPath string
|
|
}
|
|
|
|
// ArchivedItem feeds the admin archived-items page: media hidden from
|
|
// libraries because their files vanished, with their pending fate.
|
|
type ArchivedItem struct {
|
|
ID string
|
|
Title string
|
|
Author string
|
|
LibraryName string
|
|
FilePath string
|
|
MissingScans int32
|
|
ArchivedAt *time.Time
|
|
PurgeAt *time.Time
|
|
Status string
|
|
}
|
|
|
|
type DirEntry struct {
|
|
Name string
|
|
Path string
|
|
}
|
|
|
|
type UserVisibilityData struct {
|
|
UserID string
|
|
Username string
|
|
Email string
|
|
IsVisible bool
|
|
}
|
|
|
|
type AdminStats struct {
|
|
LibraryCount int
|
|
MediaCount int
|
|
UserCount int
|
|
DeviceCount int
|
|
}
|
|
|
|
type ScanSettingsData struct {
|
|
AutoScanEnabled bool
|
|
ScanPollIntervalSeconds int
|
|
}
|
|
|
|
// SettingEntry mirrors database.SettingEntry for the admin UI. Kept as a
|
|
// template-local type so the templates package does not import database.
|
|
type SettingEntry struct {
|
|
Key string
|
|
Value string
|
|
Type string
|
|
Min string
|
|
Max string
|
|
RequiresRestart bool
|
|
Category string
|
|
Group string
|
|
Description string
|
|
IsDefault bool
|
|
}
|
|
|
|
// SettingGroup is a labeled cluster of related settings rendered as a
|
|
// sub-section within a tunable-settings card.
|
|
type SettingGroup struct {
|
|
Name string
|
|
Entries []SettingEntry
|
|
}
|
|
|
|
type SeriesCardData struct {
|
|
Name string
|
|
BookCount int64
|
|
TotalInSeries int
|
|
CoverPaths []string
|
|
}
|
|
|
|
type PendingRegistrationData struct {
|
|
RegistrationID string
|
|
DeviceName string
|
|
DeviceType string
|
|
ExpiresAt string
|
|
}
|
|
|
|
type ConflictData struct {
|
|
ID string
|
|
MediaItemID string
|
|
MediaItemTitle string
|
|
ConflictType string
|
|
ResolutionStatus string
|
|
CreatedAt string
|
|
ResolutionData map[string]interface{}
|
|
ResolvedBy string
|
|
ResolvedAt string
|
|
}
|
|
|
|
type QueueItemData struct {
|
|
ID string
|
|
DeviceID string
|
|
DeviceName string
|
|
DeviceType string
|
|
SyncType string
|
|
Status string
|
|
Priority int32
|
|
Attempts int32
|
|
CreatedAt string
|
|
}
|
|
|
|
type DeviceShelfMappingData struct {
|
|
ID string
|
|
CollectionID string
|
|
CollectionName string
|
|
DeviceShelfName string
|
|
SyncDirection string
|
|
CreatedAt string
|
|
}
|
|
|
|
type UnlinkedBookData struct {
|
|
ProgressID string
|
|
DeviceID string
|
|
DeviceType string
|
|
DeviceName string
|
|
FilePath string
|
|
SHA256 string
|
|
TitleFromDevice string
|
|
LastSyncTime string
|
|
ConfidenceScore float64
|
|
PotentialMatches []PotentialMatchData
|
|
}
|
|
|
|
type PotentialMatchData struct {
|
|
MediaItemID string
|
|
Title string
|
|
Author string
|
|
CoverImagePath string
|
|
MatchMethod string
|
|
Confidence float64
|
|
}
|
|
|
|
// Documentation types
|
|
type Navigation struct {
|
|
Sections []NavSection
|
|
}
|
|
|
|
type NavSection struct {
|
|
Title string
|
|
Items []NavItem
|
|
Collapsed bool
|
|
}
|
|
|
|
type NavItem struct {
|
|
Title string
|
|
URL string
|
|
Icon string
|
|
}
|
|
|
|
type Document struct {
|
|
Title string
|
|
Content string
|
|
TOC []TOCItem
|
|
Breadcrumb []BreadcrumbItem
|
|
Category string
|
|
SourceFile string
|
|
}
|
|
|
|
type TOCItem struct {
|
|
Level int
|
|
Title string
|
|
Anchor string
|
|
}
|
|
|
|
type BreadcrumbItem struct {
|
|
Title string
|
|
URL string
|
|
}
|
|
|
|
// UnsafeHTML is used for rendering raw HTML (like rendered markdown)
|
|
type UnsafeHTML string
|
|
|
|
// ToComponent converts UnsafeHTML to a templ Component
|
|
func (u UnsafeHTML) ToComponent() templ.Component {
|
|
return templ.Raw(string(u))
|
|
}
|
|
|
|
// Reader types
|
|
type ReaderMetadata struct {
|
|
MediaItemID string `json:"media_item_id"`
|
|
Title string `json:"title"`
|
|
Author string `json:"author"`
|
|
CoverImagePath string `json:"cover_image_path"`
|
|
LibraryType string `json:"library_type"`
|
|
MimeType string `json:"mime_type"`
|
|
FilePath string `json:"file_path"`
|
|
TotalPages int `json:"total_pages"`
|
|
ChapterCount int `json:"chapter_count"`
|
|
FormatGroup string `json:"format_group"`
|
|
MangaType string `json:"manga_type"`
|
|
ReadingDirection string `json:"reading_direction"`
|
|
FileURL string `json:"file_url"`
|
|
LibraryID string `json:"library_id"`
|
|
TotalCharacters int64 `json:"total_characters"`
|
|
EstimatedPages int `json:"estimated_pages"`
|
|
}
|
|
|
|
type ReadingProgress struct {
|
|
ID string
|
|
MediaItemID string
|
|
UserID string
|
|
CurrentPage int
|
|
TotalPages int
|
|
Percentage float64
|
|
EpubCfi string
|
|
LastReadAt time.Time
|
|
Chapter int
|
|
ChapterProgress float64
|
|
FormatGroup string
|
|
}
|
|
|
|
type Bookmark struct {
|
|
ID string
|
|
MediaItemID string
|
|
UserID string
|
|
PageNumber *int
|
|
ChapterNumber *int
|
|
CfiPosition string
|
|
Title string
|
|
Position string
|
|
Notes string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
// ProcessingIssueData - Processing issue types
|
|
type ProcessingIssueData struct {
|
|
ID string
|
|
MediaItemID string
|
|
Title string
|
|
FilePath string
|
|
FormatGroup string
|
|
LibraryTypeName string
|
|
IssueType string
|
|
IssueDescription string
|
|
Severity string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type IssueStats struct {
|
|
ErrorCount int64
|
|
WarningCount int64
|
|
InfoCount int64
|
|
}
|