server

package
v0.0.0-...-282e2e6 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: Unlicense Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthOptions

type AuthOptions struct {
	// Secret Direct or Path to secret File
	Secret   string
	LoadType AuthType
	Secure   bool
	MaxAge   int
}

type AuthType

type AuthType int
const (
	Raw AuthType = iota
	File
)

type Optional

type Optional[v any] struct {
	Enabled bool
	// contains filtered or unexported fields
}

func (*Optional[v]) Apply

func (o *Optional[v]) Apply(apply func(*v))

func (*Optional[v]) Get

func (o *Optional[v]) Get() v

func (*Optional[v]) Set

func (o *Optional[v]) Set(value v)

type Options

type Options struct {
	Port           int
	Auth           Optional[AuthOptions]
	Tls            Optional[TlsOptions]
	UpdateInterval time.Duration
}

func NewDefaultOptions

func NewDefaultOptions() Options

type Server

type Server struct {
	PrevViewModel *view.ImageViewModel
	CurrViewModel *view.ImageViewModel
	NextViewModel *view.ImageViewModel

	ImageBuffers map[string][]byte
	Mutex        *sync.Mutex

	NextSubUrl string
	CurrSubUrl string
	PrevSubUrl string

	Provider provider.Provider

	IsFirst bool
	IsLast  bool

	DbMgr *database.Manager
	// contains filtered or unexported fields
}

func New

func New(provider provider.Provider, db *database.Manager, mux *http.ServeMux, options ...func(*Options)) *Server

func (*Server) AppendImagesToBuf

func (s *Server) AppendImagesToBuf(html string) ([]view.Image, error)

func (*Server) Auth

func (s *Server) Auth(next http.Handler) http.Handler

func (*Server) HandleArchive

func (s *Server) HandleArchive(w http.ResponseWriter, r *http.Request)

func (*Server) HandleCurrent

func (s *Server) HandleCurrent(w http.ResponseWriter, r *http.Request)

func (*Server) HandleDelete

func (s *Server) HandleDelete(w http.ResponseWriter, r *http.Request)

func (*Server) HandleDisable

func (s *Server) HandleDisable(w http.ResponseWriter, r *http.Request)

func (*Server) HandleExit

func (s *Server) HandleExit(w http.ResponseWriter, r *http.Request)

func (*Server) HandleFavicon

func (s *Server) HandleFavicon(w http.ResponseWriter, _ *http.Request)

func (*Server) HandleImage

func (s *Server) HandleImage(w http.ResponseWriter, r *http.Request)

func (*Server) HandleLogin

func (s *Server) HandleLogin(w http.ResponseWriter, r *http.Request)

func (*Server) HandleLoginPost

func (s *Server) HandleLoginPost(w http.ResponseWriter, r *http.Request)

func (*Server) HandleMenu

func (s *Server) HandleMenu(w http.ResponseWriter, _ *http.Request)

func (*Server) HandleNew

func (s *Server) HandleNew(w http.ResponseWriter, r *http.Request)

func (*Server) HandleNewQuery

func (s *Server) HandleNewQuery(w http.ResponseWriter, r *http.Request)

func (*Server) HandleNext

func (s *Server) HandleNext(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePrev

func (s *Server) HandlePrev(w http.ResponseWriter, r *http.Request)

func (*Server) HandleSetting

func (s *Server) HandleSetting(w http.ResponseWriter, r *http.Request)

func (*Server) HandleSettingSet

func (s *Server) HandleSettingSet(w http.ResponseWriter, r *http.Request)

func (*Server) HandleUpdate

func (s *Server) HandleUpdate(w http.ResponseWriter, r *http.Request)

func (*Server) LoadCurr

func (s *Server) LoadCurr()

func (*Server) LoadNext

func (s *Server) LoadNext()

func (*Server) LoadPrev

func (s *Server) LoadPrev()

func (*Server) LoadThumbnail

func (s *Server) LoadThumbnail(manga *database.Manga) (path string, updated bool, err error)

func (*Server) RegisterRoutes

func (s *Server) RegisterRoutes()

func (*Server) Start

func (s *Server) Start() error

func (*Server) UpdateLatestAvailableChapter

func (s *Server) UpdateLatestAvailableChapter(manga *database.Manga) (error, bool)

func (*Server) UpdateMangaList

func (s *Server) UpdateMangaList()

func (*Server) ViewMenu

func (s *Server) ViewMenu(w http.ResponseWriter, mangas []*database.Manga, settings map[string]database.Setting, archive bool)

type TlsOptions

type TlsOptions struct {
	CertPath string
	KeyPath  string
}

Jump to

Keyboard shortcuts

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