Documentation ¶
Index ¶
- Constants
- Variables
- func GetArchivePath(bookmark *BookmarkDTO) string
- func GetEbookPath(bookmark *BookmarkDTO) string
- func GetThumbnailPath(bookmark *BookmarkDTO) string
- type Account
- type AccountDTO
- type AccountsDomain
- type ArchiverDomain
- type BookmarkDTO
- type BookmarksDomain
- type DBID
- type LegacyLoginHandler
- type Routes
- type StorageDomain
- type Tag
- type UserConfig
Constants ¶
const ( // ContextAccountKey is the key used to store the account model in the gin context. ContextAccountKey = "account" // AuthorizationHeader is the name of the header used to send the token. AuthorizationHeader = "Authorization" // AuthorizationTokenType is the type of token used in the Authorization header. AuthorizationTokenType = "Bearer" )
const DataDirPerm = 0744
DataDirPerm the default filesystem permissions for the data directory/archives
const DatabaseDateFormat = "2006-01-02 15:04:05"
DatabaseDateFormat the string formatting of datetimes for the database
const (
// ShioriNamespace
ShioriURLNamespace = "https://github.com/go-shiori/shiori"
)
Variables ¶
var ( ErrBookmarkNotFound = errors.New("bookmark not found") ErrBookmarkInvalidID = errors.New("invalid bookmark ID") )
var ( BuildVersion = "dev" BuildCommit = "none" BuildDate = "unknown" )
Variables set my the main package coming from ldflags
Functions ¶
func GetArchivePath ¶ added in v1.6.0
func GetArchivePath(bookmark *BookmarkDTO) string
GetArchivePath returns the relative path to the archive of a bookmark in the filesystem
func GetEbookPath ¶ added in v1.6.0
func GetEbookPath(bookmark *BookmarkDTO) string
GetEbookPath returns the relative path to the ebook of a bookmark in the filesystem
func GetThumbnailPath ¶ added in v1.6.0
func GetThumbnailPath(bookmark *BookmarkDTO) string
GetTumnbailPath returns the relative path to the thumbnail of a bookmark in the filesystem
Types ¶
type Account ¶
type Account struct { ID int `db:"id" json:"id"` Username string `db:"username" json:"username"` Password string `db:"password" json:"password,omitempty"` Owner bool `db:"owner" json:"owner"` Config UserConfig `db:"config" json:"config"` }
Account is the database model for account.
func (Account) ToDTO ¶ added in v1.6.0
func (a Account) ToDTO() AccountDTO
ToDTO converts Account to AccountDTO.
type AccountDTO ¶ added in v1.6.0
type AccountDTO struct { ID int `json:"id"` Username string `json:"username"` Owner bool `json:"owner"` Config UserConfig `json:"config"` }
AccountDTO is data transfer object for Account.
type AccountsDomain ¶ added in v1.6.0
type ArchiverDomain ¶ added in v1.6.0
type ArchiverDomain interface { DownloadBookmarkArchive(book BookmarkDTO) (*BookmarkDTO, error) GetBookmarkArchive(book *BookmarkDTO) (*warc.Archive, error) }
type BookmarkDTO ¶ added in v1.6.0
type BookmarkDTO struct { ID int `db:"id" json:"id"` URL string `db:"url" json:"url"` Title string `db:"title" json:"title"` Excerpt string `db:"excerpt" json:"excerpt"` Author string `db:"author" json:"author"` Public int `db:"public" json:"public"` Modified string `db:"modified" json:"modified"` Content string `db:"content" json:"-"` HTML string `db:"html" json:"html,omitempty"` ImageURL string `db:"image_url" json:"imageURL"` HasContent bool `db:"has_content" json:"hasContent"` Tags []Tag `json:"tags"` HasArchive bool `json:"hasArchive"` HasEbook bool `json:"hasEbook"` CreateArchive bool `json:"create_archive"` // TODO: migrate outside the DTO CreateEbook bool `json:"create_ebook"` // TODO: migrate outside the DTO }
BookmarkDTO is the bookmark object representation in database and the data transfer object at the same time, pending a refactor to two separate object to represent each role.
type BookmarksDomain ¶ added in v1.6.0
type BookmarksDomain interface { HasEbook(b *BookmarkDTO) bool HasArchive(b *BookmarkDTO) bool HasThumbnail(b *BookmarkDTO) bool GetBookmark(ctx context.Context, id DBID) (*BookmarkDTO, error) }
type LegacyLoginHandler ¶ added in v1.6.0
type Routes ¶ added in v1.6.0
type Routes interface {
Setup(group *gin.RouterGroup) Routes
}
type StorageDomain ¶ added in v1.6.0
type Tag ¶
type Tag struct { ID int `db:"id" json:"id"` Name string `db:"name" json:"name"` NBookmarks int `db:"n_bookmarks" json:"nBookmarks,omitempty"` Deleted bool `json:"-"` }
Tag is the tag for a bookmark.
type UserConfig ¶ added in v1.6.0
type UserConfig struct { ShowId bool `json:"ShowId"` ListMode bool `json:"ListMode"` HideThumbnail bool `json:"HideThumbnail"` HideExcerpt bool `json:"HideExcerpt"` NightMode bool `json:"NightMode"` KeepMetadata bool `json:"KeepMetadata"` UseArchive bool `json:"UseArchive"` CreateEbook bool `json:"CreateEbook"` MakePublic bool `json:"MakePublic"` }
func (*UserConfig) Scan ¶ added in v1.6.0
func (c *UserConfig) Scan(value interface{}) error