model

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryStatusUnread       = "unread"
	EntryStatusRead         = "read"
	EntryStatusRemoved      = "removed"
	DefaultSortingOrder     = "published_at"
	DefaultSortingDirection = "asc"
)

Entry statuses and default sorting order.

View Source
const (
	SchedulerRoundRobin     = "round_robin"
	SchedulerEntryFrequency = "entry_frequency"
	// Default settings for the feed query builder
	DefaultFeedSorting          = "parsing_error_count"
	DefaultFeedSortingDirection = "desc"
)

List of supported schedulers.

Variables

This section is empty.

Functions

func CategoriesSortingOptions

func CategoriesSortingOptions() map[string]string

func HomePages

func HomePages() map[string]string

HomePages returns the list of available home pages.

func OptionalNumber added in v2.1.2

func OptionalNumber[T Number](value T) *T

func OptionalString

func OptionalString(value string) *string

func Themes

func Themes() map[string]string

Themes returns the list of available themes.

Types

type APIKey

type APIKey struct {
	ID          int64
	UserID      int64
	Token       string
	Description string
	LastUsedAt  *time.Time
	CreatedAt   time.Time
}

APIKey represents an application API key.

func NewAPIKey

func NewAPIKey(userID int64, description string) *APIKey

NewAPIKey initializes a new APIKey.

type APIKeys

type APIKeys []*APIKey

APIKeys represents a collection of API Key.

type Categories

type Categories []*Category

Categories represents a list of categories.

type Category

type Category struct {
	ID           int64  `json:"id"`
	Title        string `json:"title"`
	UserID       int64  `json:"user_id"`
	HideGlobally bool   `json:"hide_globally"`
	FeedCount    *int   `json:"feed_count,omitempty"`
	TotalUnread  *int   `json:"total_unread,omitempty"`
}

Category represents a feed category.

func (*Category) String

func (c *Category) String() string

type CategoryRequest

type CategoryRequest struct {
	Title        string `json:"title"`
	HideGlobally string `json:"hide_globally"`
}

CategoryRequest represents the request to create or update a category.

func (*CategoryRequest) Patch

func (cr *CategoryRequest) Patch(category *Category)

Patch updates category fields.

type Enclosure

type Enclosure struct {
	ID               int64  `json:"id"`
	UserID           int64  `json:"user_id"`
	EntryID          int64  `json:"entry_id"`
	URL              string `json:"url"`
	MimeType         string `json:"mime_type"`
	Size             int64  `json:"size"`
	MediaProgression int64  `json:"media_progression"`
}

Enclosure represents an attachment.

func (Enclosure) Html5MimeType

func (e Enclosure) Html5MimeType() string

Html5MimeType will modify the actual MimeType to allow direct playback from HTML5 player for some kind of MimeType

func (*Enclosure) IsAudio added in v2.2.3

func (e *Enclosure) IsAudio() bool

func (*Enclosure) IsImage added in v2.2.3

func (e *Enclosure) IsImage() bool

func (*Enclosure) IsVideo added in v2.2.3

func (e *Enclosure) IsVideo() bool

func (*Enclosure) ProxifyEnclosureURL added in v2.2.0

func (e *Enclosure) ProxifyEnclosureURL(router *mux.Router)

type EnclosureList

type EnclosureList []*Enclosure

EnclosureList represents a list of attachments.

func (EnclosureList) ContainsAudioOrVideo added in v2.2.0

func (el EnclosureList) ContainsAudioOrVideo() bool

func (EnclosureList) FindMediaPlayerEnclosure added in v2.2.3

func (el EnclosureList) FindMediaPlayerEnclosure() *Enclosure

FindMediaPlayerEnclosure returns the first enclosure that can be played by a media player.

func (EnclosureList) ProxifyEnclosureURL added in v2.2.0

func (el EnclosureList) ProxifyEnclosureURL(router *mux.Router)

type EnclosureUpdateRequest added in v2.2.0

type EnclosureUpdateRequest struct {
	MediaProgression int64 `json:"media_progression"`
}

type Entries

type Entries []*Entry

Entries represents a list of entries.

type EntriesStatusUpdateRequest

type EntriesStatusUpdateRequest struct {
	EntryIDs []int64 `json:"entry_ids"`
	Status   string  `json:"status"`
}

EntriesStatusUpdateRequest represents a request to change entries status.

type Entry

type Entry struct {
	ID          int64         `json:"id"`
	UserID      int64         `json:"user_id"`
	FeedID      int64         `json:"feed_id"`
	Status      string        `json:"status"`
	Hash        string        `json:"hash"`
	Title       string        `json:"title"`
	URL         string        `json:"url"`
	CommentsURL string        `json:"comments_url"`
	Date        time.Time     `json:"published_at"`
	CreatedAt   time.Time     `json:"created_at"`
	ChangedAt   time.Time     `json:"changed_at"`
	Content     string        `json:"content"`
	Author      string        `json:"author"`
	ShareCode   string        `json:"share_code"`
	Starred     bool          `json:"starred"`
	ReadingTime int           `json:"reading_time"`
	Enclosures  EnclosureList `json:"enclosures"`
	Feed        *Feed         `json:"feed,omitempty"`
	Tags        []string      `json:"tags"`
}

Entry represents a feed item in the system.

func NewEntry added in v2.0.48

func NewEntry() *Entry

func (*Entry) ShouldMarkAsReadOnView added in v2.2.0

func (e *Entry) ShouldMarkAsReadOnView(user *User) bool

ShouldMarkAsReadOnView Return whether the entry should be marked as viewed considering all user settings and entry state.

type EntryUpdateRequest added in v2.0.49

type EntryUpdateRequest struct {
	Title   *string `json:"title"`
	Content *string `json:"content"`
}

EntryUpdateRequest represents a request to update an entry.

func (*EntryUpdateRequest) Patch added in v2.0.49

func (e *EntryUpdateRequest) Patch(entry *Entry)

type Feed

type Feed struct {
	ID                          int64     `json:"id"`
	UserID                      int64     `json:"user_id"`
	FeedURL                     string    `json:"feed_url"`
	SiteURL                     string    `json:"site_url"`
	Title                       string    `json:"title"`
	Description                 string    `json:"description"`
	CheckedAt                   time.Time `json:"checked_at"`
	NextCheckAt                 time.Time `json:"next_check_at"`
	EtagHeader                  string    `json:"etag_header"`
	LastModifiedHeader          string    `json:"last_modified_header"`
	ParsingErrorMsg             string    `json:"parsing_error_message"`
	ParsingErrorCount           int       `json:"parsing_error_count"`
	ScraperRules                string    `json:"scraper_rules"`
	RewriteRules                string    `json:"rewrite_rules"`
	Crawler                     bool      `json:"crawler"`
	BlocklistRules              string    `json:"blocklist_rules"`
	KeeplistRules               string    `json:"keeplist_rules"`
	UrlRewriteRules             string    `json:"urlrewrite_rules"`
	UserAgent                   string    `json:"user_agent"`
	Cookie                      string    `json:"cookie"`
	Username                    string    `json:"username"`
	Password                    string    `json:"password"`
	Disabled                    bool      `json:"disabled"`
	NoMediaPlayer               bool      `json:"no_media_player"`
	IgnoreHTTPCache             bool      `json:"ignore_http_cache"`
	AllowSelfSignedCertificates bool      `json:"allow_self_signed_certificates"`
	FetchViaProxy               bool      `json:"fetch_via_proxy"`
	HideGlobally                bool      `json:"hide_globally"`
	DisableHTTP2                bool      `json:"disable_http2"`
	AppriseServiceURLs          string    `json:"apprise_service_urls"`
	NtfyEnabled                 bool      `json:"ntfy_enabled"`
	NtfyPriority                int       `json:"ntfy_priority"`

	// Non-persisted attributes
	Category *Category `json:"category,omitempty"`
	Icon     *FeedIcon `json:"icon"`
	Entries  Entries   `json:"entries,omitempty"`

	// Internal attributes (not exposed in the API and not persisted in the database)
	TTL                    int    `json:"-"`
	IconURL                string `json:"-"`
	UnreadCount            int    `json:"-"`
	ReadCount              int    `json:"-"`
	NumberOfVisibleEntries int    `json:"-"`
}

Feed represents a feed in the application.

func (*Feed) CheckedNow

func (f *Feed) CheckedNow()

CheckedNow set attribute values when the feed is refreshed.

func (*Feed) ResetErrorCounter

func (f *Feed) ResetErrorCounter()

ResetErrorCounter removes all previous errors.

func (*Feed) ScheduleNextCheck

func (f *Feed) ScheduleNextCheck(weeklyCount int, refreshDelayInMinutes int)

ScheduleNextCheck set "next_check_at" of a feed based on the scheduler selected from the configuration.

func (*Feed) String

func (f *Feed) String() string

func (*Feed) WithCategoryID

func (f *Feed) WithCategoryID(categoryID int64)

WithCategoryID initializes the category attribute of the feed.

func (*Feed) WithTranslatedErrorMessage added in v2.0.51

func (f *Feed) WithTranslatedErrorMessage(message string)

WithTranslatedErrorMessage adds a new error message and increment the error counter.

type FeedCounters

type FeedCounters struct {
	ReadCounters   map[int64]int `json:"reads"`
	UnreadCounters map[int64]int `json:"unreads"`
}

type FeedCreationRequest

type FeedCreationRequest struct {
	FeedURL                     string `json:"feed_url"`
	CategoryID                  int64  `json:"category_id"`
	UserAgent                   string `json:"user_agent"`
	Cookie                      string `json:"cookie"`
	Username                    string `json:"username"`
	Password                    string `json:"password"`
	Crawler                     bool   `json:"crawler"`
	Disabled                    bool   `json:"disabled"`
	NoMediaPlayer               bool   `json:"no_media_player"`
	IgnoreHTTPCache             bool   `json:"ignore_http_cache"`
	AllowSelfSignedCertificates bool   `json:"allow_self_signed_certificates"`
	FetchViaProxy               bool   `json:"fetch_via_proxy"`
	ScraperRules                string `json:"scraper_rules"`
	RewriteRules                string `json:"rewrite_rules"`
	BlocklistRules              string `json:"blocklist_rules"`
	KeeplistRules               string `json:"keeplist_rules"`
	HideGlobally                bool   `json:"hide_globally"`
	UrlRewriteRules             string `json:"urlrewrite_rules"`
	DisableHTTP2                bool   `json:"disable_http2"`
}

FeedCreationRequest represents the request to create a feed.

type FeedCreationRequestFromSubscriptionDiscovery added in v2.0.51

type FeedCreationRequestFromSubscriptionDiscovery struct {
	Content      io.ReadSeeker
	ETag         string
	LastModified string

	FeedCreationRequest
}

type FeedIcon

type FeedIcon struct {
	FeedID int64 `json:"feed_id"`
	IconID int64 `json:"icon_id"`
}

FeedIcon is a junction table between feeds and icons.

type FeedModificationRequest

type FeedModificationRequest struct {
	FeedURL                     *string `json:"feed_url"`
	SiteURL                     *string `json:"site_url"`
	Title                       *string `json:"title"`
	Description                 *string `json:"description"`
	ScraperRules                *string `json:"scraper_rules"`
	RewriteRules                *string `json:"rewrite_rules"`
	BlocklistRules              *string `json:"blocklist_rules"`
	KeeplistRules               *string `json:"keeplist_rules"`
	UrlRewriteRules             *string `json:"urlrewrite_rules"`
	Crawler                     *bool   `json:"crawler"`
	UserAgent                   *string `json:"user_agent"`
	Cookie                      *string `json:"cookie"`
	Username                    *string `json:"username"`
	Password                    *string `json:"password"`
	CategoryID                  *int64  `json:"category_id"`
	Disabled                    *bool   `json:"disabled"`
	NoMediaPlayer               *bool   `json:"no_media_player"`
	IgnoreHTTPCache             *bool   `json:"ignore_http_cache"`
	AllowSelfSignedCertificates *bool   `json:"allow_self_signed_certificates"`
	FetchViaProxy               *bool   `json:"fetch_via_proxy"`
	HideGlobally                *bool   `json:"hide_globally"`
	DisableHTTP2                *bool   `json:"disable_http2"`
}

FeedModificationRequest represents the request to update a feed.

func (*FeedModificationRequest) Patch

func (f *FeedModificationRequest) Patch(feed *Feed)

Patch updates a feed with modified values.

type Feeds

type Feeds []*Feed

Feeds is a list of feed

type Icon

type Icon struct {
	ID       int64  `json:"id"`
	Hash     string `json:"hash"`
	MimeType string `json:"mime_type"`
	Content  []byte `json:"-"`
}

Icon represents a website icon (favicon)

func (*Icon) DataURL

func (i *Icon) DataURL() string

DataURL returns the data URL of the icon.

type Icons

type Icons []*Icon

Icons represents a list of icons.

type Integration

type Integration struct {
	UserID                           int64
	BetulaEnabled                    bool
	BetulaURL                        string
	BetulaToken                      string
	PinboardEnabled                  bool
	PinboardToken                    string
	PinboardTags                     string
	PinboardMarkAsUnread             bool
	InstapaperEnabled                bool
	InstapaperUsername               string
	InstapaperPassword               string
	FeverEnabled                     bool
	FeverUsername                    string
	FeverToken                       string
	GoogleReaderEnabled              bool
	GoogleReaderUsername             string
	GoogleReaderPassword             string
	WallabagEnabled                  bool
	WallabagOnlyURL                  bool
	WallabagURL                      string
	WallabagClientID                 string
	WallabagClientSecret             string
	WallabagUsername                 string
	WallabagPassword                 string
	NunuxKeeperEnabled               bool
	NunuxKeeperURL                   string
	NunuxKeeperAPIKey                string
	NotionEnabled                    bool
	NotionToken                      string
	NotionPageID                     string
	EspialEnabled                    bool
	EspialURL                        string
	EspialAPIKey                     string
	EspialTags                       string
	ReadwiseEnabled                  bool
	ReadwiseAPIKey                   string
	PocketEnabled                    bool
	PocketAccessToken                string
	PocketConsumerKey                string
	TelegramBotEnabled               bool
	TelegramBotToken                 string
	TelegramBotChatID                string
	TelegramBotTopicID               *int64
	TelegramBotDisableWebPagePreview bool
	TelegramBotDisableNotification   bool
	TelegramBotDisableButtons        bool
	LinkAceEnabled                   bool
	LinkAceURL                       string
	LinkAceAPIKey                    string
	LinkAceTags                      string
	LinkAcePrivate                   bool
	LinkAceCheckDisabled             bool
	LinkdingEnabled                  bool
	LinkdingURL                      string
	LinkdingAPIKey                   string
	LinkdingTags                     string
	LinkdingMarkAsUnread             bool
	LinkwardenEnabled                bool
	LinkwardenURL                    string
	LinkwardenAPIKey                 string
	MatrixBotEnabled                 bool
	MatrixBotUser                    string
	MatrixBotPassword                string
	MatrixBotURL                     string
	MatrixBotChatID                  string
	AppriseEnabled                   bool
	AppriseURL                       string
	AppriseServicesURL               string
	ReadeckEnabled                   bool
	ReadeckURL                       string
	ReadeckAPIKey                    string
	ReadeckLabels                    string
	ReadeckOnlyURL                   bool
	ShioriEnabled                    bool
	ShioriURL                        string
	ShioriUsername                   string
	ShioriPassword                   string
	ShaarliEnabled                   bool
	ShaarliURL                       string
	ShaarliAPISecret                 string
	WebhookEnabled                   bool
	WebhookURL                       string
	WebhookSecret                    string
	RSSBridgeEnabled                 bool
	RSSBridgeURL                     string
	OmnivoreEnabled                  bool
	OmnivoreAPIKey                   string
	OmnivoreURL                      string
	RaindropEnabled                  bool
	RaindropToken                    string
	RaindropCollectionID             string
	RaindropTags                     string
	NtfyEnabled                      bool
	NtfyTopic                        string
	NtfyURL                          string
	NtfyAPIToken                     string
	NtfyUsername                     string
	NtfyPassword                     string
	NtfyIconURL                      string
	CuboxEnabled                     bool
	CuboxAPILink                     string
}

Integration represents user integration settings.

type Job

type Job struct {
	UserID int64
	FeedID int64
}

Job represents a payload sent to the processing queue.

type JobList

type JobList []Job

JobList represents a list of jobs.

type Number added in v2.1.2

type Number interface {
	int | int64 | float64
}

type Session

type Session struct {
	ID   string
	Data *SessionData
}

Session represents a session in the system.

func (*Session) String

func (s *Session) String() string

type SessionData

type SessionData struct {
	CSRF                string          `json:"csrf"`
	OAuth2State         string          `json:"oauth2_state"`
	OAuth2CodeVerifier  string          `json:"oauth2_code_verifier"`
	FlashMessage        string          `json:"flash_message"`
	FlashErrorMessage   string          `json:"flash_error_message"`
	Language            string          `json:"language"`
	Theme               string          `json:"theme"`
	PocketRequestToken  string          `json:"pocket_request_token"`
	LastForceRefresh    string          `json:"last_force_refresh"`
	WebAuthnSessionData WebAuthnSession `json:"webauthn_session_data"`
}

SessionData represents the data attached to the session.

func (*SessionData) Scan

func (s *SessionData) Scan(src interface{}) error

Scan converts raw JSON data.

func (SessionData) String

func (s SessionData) String() string

func (SessionData) Value

func (s SessionData) Value() (driver.Value, error)

Value converts the session data to JSON.

type SubscriptionDiscoveryRequest

type SubscriptionDiscoveryRequest struct {
	URL                         string `json:"url"`
	UserAgent                   string `json:"user_agent"`
	Cookie                      string `json:"cookie"`
	Username                    string `json:"username"`
	Password                    string `json:"password"`
	FetchViaProxy               bool   `json:"fetch_via_proxy"`
	AllowSelfSignedCertificates bool   `json:"allow_self_signed_certificates"`
	DisableHTTP2                bool   `json:"disable_http2"`
}

SubscriptionDiscoveryRequest represents a request to discover subscriptions.

type User

type User struct {
	ID                              int64      `json:"id"`
	Username                        string     `json:"username"`
	Password                        string     `json:"-"`
	IsAdmin                         bool       `json:"is_admin"`
	Theme                           string     `json:"theme"`
	Language                        string     `json:"language"`
	Timezone                        string     `json:"timezone"`
	EntryDirection                  string     `json:"entry_sorting_direction"`
	EntryOrder                      string     `json:"entry_sorting_order"`
	Stylesheet                      string     `json:"stylesheet"`
	CustomJS                        string     `json:"custom_js"`
	ExternalFontHosts               string     `json:"external_font_hosts"`
	GoogleID                        string     `json:"google_id"`
	OpenIDConnectID                 string     `json:"openid_connect_id"`
	EntriesPerPage                  int        `json:"entries_per_page"`
	KeyboardShortcuts               bool       `json:"keyboard_shortcuts"`
	ShowReadingTime                 bool       `json:"show_reading_time"`
	EntrySwipe                      bool       `json:"entry_swipe"`
	GestureNav                      string     `json:"gesture_nav"`
	LastLoginAt                     *time.Time `json:"last_login_at"`
	DisplayMode                     string     `json:"display_mode"`
	DefaultReadingSpeed             int        `json:"default_reading_speed"`
	CJKReadingSpeed                 int        `json:"cjk_reading_speed"`
	DefaultHomePage                 string     `json:"default_home_page"`
	CategoriesSortingOrder          string     `json:"categories_sorting_order"`
	MarkReadOnView                  bool       `json:"mark_read_on_view"`
	MarkReadOnMediaPlayerCompletion bool       `json:"mark_read_on_media_player_completion"`
	MediaPlaybackRate               float64    `json:"media_playback_rate"`
	BlockFilterEntryRules           string     `json:"block_filter_entry_rules"`
	KeepFilterEntryRules            string     `json:"keep_filter_entry_rules"`
}

User represents a user in the system.

func (*User) UseTimezone

func (u *User) UseTimezone(tz string)

UseTimezone converts last login date to the given timezone.

type UserCreationRequest

type UserCreationRequest struct {
	Username        string `json:"username"`
	Password        string `json:"password"`
	IsAdmin         bool   `json:"is_admin"`
	GoogleID        string `json:"google_id"`
	OpenIDConnectID string `json:"openid_connect_id"`
}

UserCreationRequest represents the request to create a user.

type UserModificationRequest

type UserModificationRequest struct {
	Username                        *string  `json:"username"`
	Password                        *string  `json:"password"`
	Theme                           *string  `json:"theme"`
	Language                        *string  `json:"language"`
	Timezone                        *string  `json:"timezone"`
	EntryDirection                  *string  `json:"entry_sorting_direction"`
	EntryOrder                      *string  `json:"entry_sorting_order"`
	Stylesheet                      *string  `json:"stylesheet"`
	CustomJS                        *string  `json:"custom_js"`
	ExternalFontHosts               *string  `json:"external_font_hosts"`
	GoogleID                        *string  `json:"google_id"`
	OpenIDConnectID                 *string  `json:"openid_connect_id"`
	EntriesPerPage                  *int     `json:"entries_per_page"`
	IsAdmin                         *bool    `json:"is_admin"`
	KeyboardShortcuts               *bool    `json:"keyboard_shortcuts"`
	ShowReadingTime                 *bool    `json:"show_reading_time"`
	EntrySwipe                      *bool    `json:"entry_swipe"`
	GestureNav                      *string  `json:"gesture_nav"`
	DisplayMode                     *string  `json:"display_mode"`
	DefaultReadingSpeed             *int     `json:"default_reading_speed"`
	CJKReadingSpeed                 *int     `json:"cjk_reading_speed"`
	DefaultHomePage                 *string  `json:"default_home_page"`
	CategoriesSortingOrder          *string  `json:"categories_sorting_order"`
	MarkReadOnView                  *bool    `json:"mark_read_on_view"`
	MarkReadOnMediaPlayerCompletion *bool    `json:"mark_read_on_media_player_completion"`
	MediaPlaybackRate               *float64 `json:"media_playback_rate"`
	BlockFilterEntryRules           *string  `json:"block_filter_entry_rules"`
	KeepFilterEntryRules            *string  `json:"keep_filter_entry_rules"`
}

UserModificationRequest represents the request to update a user.

func (*UserModificationRequest) Patch

func (u *UserModificationRequest) Patch(user *User)

Patch updates the User object with the modification request.

type UserSession

type UserSession struct {
	ID        int64
	UserID    int64
	Token     string
	CreatedAt time.Time
	UserAgent string
	IP        string
}

UserSession represents a user session in the system.

func (*UserSession) String

func (u *UserSession) String() string

func (*UserSession) UseTimezone

func (u *UserSession) UseTimezone(tz string)

UseTimezone converts creation date to the given timezone.

type UserSessions

type UserSessions []*UserSession

UserSessions represents a list of sessions.

func (UserSessions) UseTimezone

func (u UserSessions) UseTimezone(tz string)

UseTimezone converts creation date of all sessions to the given timezone.

type Users

type Users []*User

Users represents a list of users.

func (Users) UseTimezone

func (u Users) UseTimezone(tz string)

UseTimezone converts last login timestamp of all users to the given timezone.

type WebAuthnCredential added in v2.0.51

type WebAuthnCredential struct {
	Credential webauthn.Credential
	Name       string
	AddedOn    *time.Time
	LastSeenOn *time.Time
	Handle     []byte
}

func (WebAuthnCredential) HandleEncoded added in v2.0.51

func (s WebAuthnCredential) HandleEncoded() string

type WebAuthnSession added in v2.0.51

type WebAuthnSession struct {
	*webauthn.SessionData
}

handle marshalling / unmarshalling session data

func (*WebAuthnSession) Scan added in v2.0.51

func (s *WebAuthnSession) Scan(value interface{}) error

func (WebAuthnSession) String added in v2.0.51

func (s WebAuthnSession) String() string

func (WebAuthnSession) Value added in v2.0.51

func (s WebAuthnSession) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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