libreread

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: AGPL-3.0 Imports: 26 Imported by: 0

README

LibreRead Build Status PRs Welcome Chat PayPal Donate Become a Patron

Self-hosted Free(Libre) Ebook Reader. https://libreread.org

Alt text

Features
  • Easy installation
  • Built using Golang
  • Browser-based
  • Responsive design
  • Full-text search
  • Highlight & Annotate
  • Supports PDF & EPUB
Production setup

Please check this guide

Development setup

Install go 1.9, redis 4 (default settings on port 6379) and optionally elasticsearch 5 (default settings on port 9200). If you want to use elasticsearch, do export LIBREREAD_ELASTICSEARCH=1 and run the following commands.

  • go get -d github.com/LibreRead/server/cmd/libreread
  • cd $GOPATH/src/github.com/LibreRead/server
  • go run ./cmd/libreread/main.go

This will run the app on localhost:8080

Supported by
Supported by Digital Ocean

If you find LibreRead useful, you could support our development by either making an one-time donation or by becoming a patron. Thank you! 😍

Documentation

Index

Constants

View Source
const (
	PORT_DEFAULT           = "8080"
	PORT_ENV               = "LIBREREAD_PORT"
	DBPATH_ENV             = "LIBREREAD_DB_PATH"
	DBPATH_DEFAULT         = "."
	ENABLE_ES_ENV          = "LIBREREAD_ELASTICSEARCH"
	ENABLE_ES_DEFAULT      = "0"
	ESPATH_ENV             = "LIBREREAD_ES_PATH"
	ESPATH_DEFAULT         = "http://localhost:9200"
	REDISPATH_ENV          = "LIBREREAD_REDIS_PATH"
	REDISPATH_DEFAULT      = "localhost:6379"
	REDIS_PASSWORD_ENV     = "LIBREREAD_REDIS_PASSWORD"
	REDIS_PASSWORD_DEFAULT = ""
	ASSETPATH_ENV          = "LIBREREAD_ASSET_PATH"
	ASSETPATH_DEFAULT      = "."
	DOMAIN_ADDRESS_ENV     = "LIBREREAD_DOMAIN_ADDRESS"
	DOMAIN_ADDRESS_DEFAULT = ""
	SMTP_SERVER_ENV        = "LIBREREAD_SMTP_SERVER"
	SMTP_SERVER_DEFAULT    = ""
	SMTP_PORT_ENV          = "LIBREREAD_SMTP_PORT"
	SMTP_PORT_DEFAULT      = ""
	SMTP_ADDRESS_ENV       = "LIBREREAD_SMTP_ADDRESS"
	SMTP_ADDRESS_DEFAULT   = ""
	SMTP_PASSWORD_ENV      = "LIBREREAD_SMTP_PASSWORD"
	SMTP_PASSWORD_DEFAULT  = ""
)

Variables

View Source
var (
	DBPath        = DBPATH_DEFAULT
	EnableES      = ENABLE_ES_DEFAULT
	ESPath        = ESPATH_DEFAULT
	RedisPath     = REDISPATH_DEFAULT
	RedisPassword = REDIS_PASSWORD_DEFAULT
	ServerPort    = PORT_DEFAULT
	AssetPath     = ASSETPATH_DEFAULT
	DomainAddress = DOMAIN_ADDRESS_DEFAULT
	SMTPServer    = SMTP_SERVER_DEFAULT
	SMTPPort      = SMTP_PORT_DEFAULT
	SMTPAddress   = SMTP_ADDRESS_DEFAULT
	SMTPPassword  = SMTP_PASSWORD_DEFAULT
)

Functions

func CheckError

func CheckError(err error)

func DeleteHTTPRequest

func DeleteHTTPRequest(url string)

func FeedPDFContent

func FeedPDFContent(filePath string, userId int64, bookId int64, title string, author string, url string, cover string, pagesInt int64)

func GetForgotPassword

func GetForgotPassword(c *gin.Context)

func GetJSON

func GetJSON(url string, target interface{}) error

func GetJSONPassPayload

func GetJSONPassPayload(url string, payload []byte) []byte

func GetSignOut

func GetSignOut(c *gin.Context)

func PostJSON

func PostJSON(url string, message []byte)

func PutJSON

func PutJSON(url string, message []byte)

func RandSeq

func RandSeq(n int64) string

func SendBookCover

func SendBookCover(c *gin.Context)

func StartServer added in v1.1.0

func StartServer()

Types

type BMESDoc

type BMESDoc struct {
	Title  string `json:"title"`
	Author string `json:"author"`
	Cover  string `json:"cover"`
}

type BookDataStruct

type BookDataStruct struct {
	TheData string `json:"thedata"`
	Title   string `json:"title"`
	Author  string `json:"author"`
	URL     string `json:"url"`
	SeURL   string `json:"se_url"`
	Cover   string `json:"cover"`
	Page    int64  `json:"page"`
	Format  string `json:"format"`
}

type BookDetailHighlight

type BookDetailHighlight struct {
	Fields BookDetailHighlightFields `json:"fields"`
}

type BookDetailHighlightAttachmentContent

type BookDetailHighlightAttachmentContent struct {
	FragmentSize      int64 `json:"fragment_size"`
	NumberOfFragments int64 `json:"number_of_fragments"`
	NoMatchSize       int64 `json:"no_match_size"`
}

type BookDetailHighlightFields

type BookDetailHighlightFields struct {
	AttachmentContent BookDetailHighlightAttachmentContent `json:"attachment.content"`
}

type BookDetailHighlightResult

type BookDetailHighlightResult struct {
	AttachmentContent []string `json:"attachment.content"`
}

type BookDetailHits

type BookDetailHits struct {
	Hits []BookDetailHitsHits `json:"hits"`
}

type BookDetailHitsHits

type BookDetailHitsHits struct {
	Source    BookDetailSource          `json:"_source"`
	Highlight BookDetailHighlightResult `json:"highlight"`
}

type BookDetailMatchPhrase

type BookDetailMatchPhrase struct {
	AttachmentContent string `json:"attachment.content"`
}

type BookDetailPayloadStruct

type BookDetailPayloadStruct struct {
	Source    []string            `json:"_source"`
	Query     BookDetailQuery     `json:"query"`
	Highlight BookDetailHighlight `json:"highlight"`
}

type BookDetailQuery

type BookDetailQuery struct {
	MatchPhrase BookDetailMatchPhrase `json:"match_phrase"`
}

type BookDetailResultStruct

type BookDetailResultStruct struct {
	Hits BookDetailHits `json:"hits"`
}

type BookDetailSource

type BookDetailSource struct {
	Title  string `json:"title"`
	Author string `json:"author"`
	URL    string `json:"url"`
	SeURL  string `json:"se_url"`
	Cover  string `json:"cover"`
	Page   int64  `json:"page"`
	Format string `json:"format"`
}

type BookInfoHits

type BookInfoHits struct {
	Hits []BookInfoHitsHits `json:"hits"`
}

type BookInfoHitsHits

type BookInfoHitsHits struct {
	Source BookInfoStruct `json:"_source"`
}

type BookInfoPayloadStruct

type BookInfoPayloadStruct struct {
	Source []string      `json:"_source"`
	Query  BookInfoQuery `json:"query"`
}

type BookInfoQuery

type BookInfoQuery struct {
	MultiMatch MultiMatchQuery `json:"multi_match"`
}

type BookInfoResultStruct

type BookInfoResultStruct struct {
	Hits BookInfoHits `json:"hits"`
}

type BookInfoStruct

type BookInfoStruct struct {
	Title  string `json:"title"`
	Author string `json:"author"`
	URL    string `json:"url"`
	Cover  string `json:"cover"`
}

type BookMetadataEditStruct

type BookMetadataEditStruct struct {
	Doc BMESDoc `json:"doc"`
}

type BookSearchResult

type BookSearchResult struct {
	BookInfo   []BookInfoStruct     `json:"book_info"`
	BookDetail []BookDetailHitsHits `json:"book_detail"`
}

struct for wrapping book search result

type BookStruct

type BookStruct struct {
	Title string
	URL   string
	Cover string
}

type BookStructList

type BookStructList []BookStruct

type BooksList

type BooksList struct {
	BookId int64
	Cover  string
}

type CollectionBooks

type CollectionBooks struct {
	Id          int64
	Title       string
	Description string
	Cover       string
}

type CurrentPageDataStruct

type CurrentPageDataStruct struct {
	CurrentPage int64 `json:"current_page"`
	LeftNone    bool  `json:"left_none"`
	RightNone   bool  `json:"right_none"`
}

type DeleteHighlightIdStruct

type DeleteHighlightIdStruct struct {
	Id string `json:"id"`
}

type EPUBHighlightStruct

type EPUBHighlightStruct struct {
	FileName string `json:"fileName"`
	Href     string `json:"href"`
	HTML     string `json:"html"`
}

type Env

type Env struct {
	RedisClient *redis.Client
	// contains filtered or unexported fields
}

func (*Env) ConfirmEmail

func (e *Env) ConfirmEmail(c *gin.Context)

func (*Env) DeleteBook

func (e *Env) DeleteBook(c *gin.Context)

func (*Env) DeleteCollection

func (e *Env) DeleteCollection(c *gin.Context)

func (*Env) DeletePDFHighlight

func (e *Env) DeletePDFHighlight(c *gin.Context)

func (*Env) EditBook

func (e *Env) EditBook(c *gin.Context)

func (*Env) GetAddCollection

func (e *Env) GetAddCollection(c *gin.Context)

func (*Env) GetAutocomplete

func (e *Env) GetAutocomplete(c *gin.Context)

func (*Env) GetBookMetaData

func (e *Env) GetBookMetaData(c *gin.Context)

func (*Env) GetCollection

func (e *Env) GetCollection(c *gin.Context)

func (*Env) GetCollections

func (e *Env) GetCollections(c *gin.Context)

func (*Env) GetEPUBCurrentPage

func (e *Env) GetEPUBCurrentPage(c *gin.Context)

func (*Env) GetHomePage

func (e *Env) GetHomePage(c *gin.Context)

func (*Env) GetPDFHighlights

func (e *Env) GetPDFHighlights(c *gin.Context)

func (*Env) GetPagination

func (e *Env) GetPagination(c *gin.Context)

func (*Env) GetResetPassword

func (e *Env) GetResetPassword(c *gin.Context)

func (*Env) GetSettings

func (e *Env) GetSettings(c *gin.Context)

func (*Env) GetSignIn

func (e *Env) GetSignIn(c *gin.Context)

func (*Env) GetSignUp

func (e *Env) GetSignUp(c *gin.Context)

func (*Env) PostForgotPassword

func (e *Env) PostForgotPassword(c *gin.Context)

func (*Env) PostNewCollection

func (e *Env) PostNewCollection(c *gin.Context)

func (*Env) PostPDFHighlight

func (e *Env) PostPDFHighlight(c *gin.Context)

func (*Env) PostPDFHighlightColor

func (e *Env) PostPDFHighlightColor(c *gin.Context)

func (*Env) PostPDFHighlightComment

func (e *Env) PostPDFHighlightComment(c *gin.Context)

func (*Env) PostResetPassword

func (e *Env) PostResetPassword(c *gin.Context)

func (*Env) PostSettings

func (e *Env) PostSettings(c *gin.Context)

func (*Env) PostSignIn

func (e *Env) PostSignIn(c *gin.Context)

func (*Env) PostSignUp

func (e *Env) PostSignUp(c *gin.Context)

func (*Env) SaveEPUBHighlight

func (e *Env) SaveEPUBHighlight(c *gin.Context)

func (*Env) SendBook

func (e *Env) SendBook(c *gin.Context)

func (*Env) SendEPUBFragment

func (e *Env) SendEPUBFragment(c *gin.Context)

func (*Env) SendEPUBFragmentFromId

func (e *Env) SendEPUBFragmentFromId(c *gin.Context)

func (*Env) SendNewToken

func (e *Env) SendNewToken(c *gin.Context)

func (*Env) UploadBook

func (e *Env) UploadBook(c *gin.Context)

type GetBookMetadataStruct

type GetBookMetadataStruct struct {
	Title  string `json:"title"`
	Author string `json:"author"`
	Cover  string `json:"cover"`
}

type GetPDFHighlightColorComment

type GetPDFHighlightColorComment struct {
	Id               int64  `json:"id"`
	HighlightColor   string `json:"highlight_color"`
	HighlightTop     string `json:"highlight_top"`
	HighlightComment string `json:"highlight_comment"`
}

type GetPDFHighlightDetail

type GetPDFHighlightDetail struct {
	HId         int64  `json:"hid"`
	PageIndex   string `json:"page_index"`
	DivIndex    string `json:"div_index"`
	HTMLContent string `json:"html_content"`
}

type HrefDataStruct

type HrefDataStruct struct {
	CurrentPage int64  `json:"current_page"`
	HrefPath    string `json:"href_path"`
	LeftNone    bool   `json:"left_none"`
	RightNone   bool   `json:"right_none"`
}

type MultiMatchQuery

type MultiMatchQuery struct {
	Query  string   `json:"query"`
	Fields []string `json:"fields"`
}

type OPFItem

type OPFItem struct {
	Id        []string `xml:"id,attr"`
	Href      []string `xml:"href,attr"`
	MediaType []string `xml:"media-type,attr"`
}

type OPFItemRef

type OPFItemRef struct {
	IdRef []string `xml:"idref,attr"`
}

type OPFManifest

type OPFManifest struct {
	Item OPFItem `xml:"item"`
}

type OPFMetadata

type OPFMetadata struct {
	Title  string `xml:"title"`
	Author string `xml:"creator"`
}

type OPFMetadataStruct

type OPFMetadataStruct struct {
	Metadata OPFMetadata `xml:"metadata"`
	Spine    OPFSpine    `xml:"spine"`
	Manifest OPFManifest `xml:"manifest"`
}

type OPFSpine

type OPFSpine struct {
	ItemRef OPFItemRef `xml:"itemref"`
}

type PDFHighlightColor

type PDFHighlightColor struct {
	HighlightColor string `json:"highlightColor" binding:"required"`
	Id             string `json:"id" binding:"required"`
}

type PDFHighlightComment

type PDFHighlightComment struct {
	Id      string `json:"id"`
	Top     string `json:"top"`
	Comment string `json:"comment"`
}

type PDFHighlightStruct

type PDFHighlightStruct struct {
	PageIndex      []string `json:"pageIndex" binding:"required"`
	DivIndex       []string `json:"divIndex" binding:"required"`
	HTMLContent    []string `json:"htmlContent" binding:"required"`
	FileName       string   `json:"fileName" binding:"required"`
	HighlightColor string   `json:"highlightColor" binding:"required"`
}

type PDFHighlightsStruct

type PDFHighlightsStruct struct {
	Color  []GetPDFHighlightColorComment `json:"color"`
	Detail []GetPDFHighlightDetail       `json:"detail"`
}

type PostCollection

type PostCollection struct {
	Title       string  `json:"title"`
	Description string  `json:"description"`
	Books       []int64 `json:"id"`
}

type PostSettingsStruct

type PostSettingsStruct struct {
	Email          string `json:"email"`
	ChangePassword bool   `json:"change_password"`
	Password       string `json:"password"`
}

type QuoteStruct

type QuoteStruct struct {
	Author      string `json:"author" binding:"required"`
	AuthorURL   string `json:"authorURL" binding:"required"`
	FromBook    string `json:"fromBook" binding:"required"`
	FromBookURL string `json:"fromBookURL" binding:"required"`
	Image       string `json:"image" binding:"required"`
	Quote       string `json:"quote" binding:"required"`
}

type XMLContainerStruct

type XMLContainerStruct struct {
	RootFiles XMLRootFiles `xml:"rootfiles"`
}

type XMLRootFile

type XMLRootFile struct {
	FullPath string `xml:"full-path,attr"`
}

type XMLRootFiles

type XMLRootFiles struct {
	RootFile XMLRootFile `xml:"rootfile"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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