frontend

package
v0.0.0-...-7277db8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

nntpchan frontend allows posting to nntpchan network via various implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptchaServer

type CaptchaServer struct {
	// contains filtered or unexported fields
}

server of captchas implements frontend.Middleware

func NewCaptchaServer

func NewCaptchaServer(w, h int, prefix string, store *sessions.CookieStore) *CaptchaServer

create new captcha server using existing session store

func (*CaptchaServer) CheckSession

func (cs *CaptchaServer) CheckSession(w http.ResponseWriter, r *http.Request, solution string) (bool, error)

return true if this session has solved the last captcha given provided solution, otherwise false

func (*CaptchaServer) NewCaptcha

func (cs *CaptchaServer) NewCaptcha(w http.ResponseWriter, r *http.Request)

generate a new captcha

func (*CaptchaServer) Reload

func (cs *CaptchaServer) Reload(c *config.MiddlewareConfig)

func (*CaptchaServer) SetupRoutes

func (cs *CaptchaServer) SetupRoutes(m *mux.Router)

func (*CaptchaServer) VerifyCaptcha

func (cs *CaptchaServer) VerifyCaptcha(w http.ResponseWriter, r *http.Request)

verify a captcha

type Frontend

type Frontend interface {

	// run mainloop
	Serve()

	// do we accept this inbound post?
	AllowPost(p model.PostReference) bool

	// trigger a manual regen of indexes for a root post
	Regen(p model.PostReference)

	// implements nntp.EventHooks
	GotArticle(msgid nntp.MessageID, group nntp.Newsgroup)

	// implements nntp.EventHooks
	SentArticleVia(msgid nntp.MessageID, feedname string)

	// reload config
	Reload(c *config.FrontendConfig)

	// get frontend name
	Name() string
}

a frontend that displays nntp posts and allows posting

func NewHTTPFrontend

func NewHTTPFrontend(c *config.FrontendConfig, db database.Database, s store.Storage) (f Frontend, err error)

create a new http frontend give frontend config

type Middleware

type Middleware interface {
	// set up routes
	SetupRoutes(m *mux.Router)
	// reload with new configuration
	Reload(c *config.MiddlewareConfig)
}

http middleware

func OverchanMiddleware

func OverchanMiddleware(c *config.MiddlewareConfig, db database.Database) (m Middleware, err error)

create standard overchan middleware

Jump to

Keyboard shortcuts

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