resources

package
v0.0.0-...-22d4692 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServeCaptcha = captcha.Server(captcha.StdWidth, captcha.StdHeight)

Functions

func CalcTripCode

func CalcTripCode(trip string) string

func CaptchaPass

func CaptchaPass(spamScore float64) bool

func CaptchaProb

func CaptchaProb(spamScore float64) float64

func CreateHost

func CreateHost(db *buntdb.DB, hostname string) error

func DateFromId

func DateFromId(id int) time.Time

func DelAdmin

func DelAdmin(tx *buntdb.Tx, id string) error

func DelBoard

func DelBoard(tx *buntdb.Tx, hostname, shortname string) error

func DelMod

func DelMod(tx *buntdb.Tx, host, id string) error

func DelReply

func DelReply(tx *buntdb.Tx, host, board string, thread, id int) error

func DelThread

func DelThread(tx *buntdb.Tx, host, board string, id int) error

func FillReplies

func FillReplies(tx *buntdb.Tx, host string, thread *Thread) (err error)

func GetHostnameFromKey

func GetHostnameFromKey(key string) (string, error)

func InitialSetup

func InitialSetup(db *buntdb.DB) error

func MakeCaptcha

func MakeCaptcha() string

func NewAdmin

func NewAdmin(tx *buntdb.Tx, in *AdminPass) error

func NewBoard

func NewBoard(tx *buntdb.Tx, hostname string, in *Board) error

func NewMod

func NewMod(tx *buntdb.Tx, host string, in *ModPass) error

func NewReply

func NewReply(tx *buntdb.Tx, host, board string, thread *Thread, in *Reply, noId bool) error

func NewThread

func NewThread(tx *buntdb.Tx, host, board string, in *Thread, in2 *Reply) error

func OperateReplyText

func OperateReplyText(unsafe string) template.HTML

func SpamScore

func SpamScore(spam string) (float64, error)

func TestBoard

func TestBoard(tx *buntdb.Tx, hostname, shortname string) error

func TestThread

func TestThread(tx *buntdb.Tx, host, board string, id int) error

func UpdateBoard

func UpdateBoard(tx *buntdb.Tx, hostname string, b *Board) error

func UpdateReply

func UpdateReply(tx *buntdb.Tx, host, board string, r *Reply) error

func VerifyCaptcha

func VerifyCaptcha(r *http.Request) bool

Types

type AdminPass

type AdminPass struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

func GetAdmin

func GetAdmin(tx *buntdb.Tx, id string) (*AdminPass, error)

func (*AdminPass) HashLogin

func (a *AdminPass) HashLogin(pass string) error

func (*AdminPass) VerifyLogin

func (a *AdminPass) VerifyLogin(pass string) (err error)

type Board

type Board struct {
	ShortName string   `json:"short"`
	LongName  string   `json:"long"`
	Metadata  Metadata `json:"meta"`
}

func GetBoard

func GetBoard(tx *buntdb.Tx, hostname, shortname string) (*Board, error)

func ListBoards

func ListBoards(tx *buntdb.Tx, hostname string) ([]*Board, error)

type Metadata

type Metadata map[string]string

type ModPass

type ModPass struct {
	ID       string `json:"id"`
	Password string `json:"password"`
	Board    string `json:"board"`
}

func GetMod

func GetMod(tx *buntdb.Tx, host, id string) (*ModPass, error)

func (*ModPass) HashLogin

func (m *ModPass) HashLogin(pass string) error

func (*ModPass) VerifyLogin

func (m *ModPass) VerifyLogin(pass string) error

type Reply

type Reply struct {
	ID        int      `json:"id"`
	Text      string   `json:"text"`
	Image     []byte   `json:"image"`
	Thumbnail []byte   `json:"thumb"`
	Thread    int      `json:"thread"`
	Board     string   `json:"board"`
	Metadata  Metadata `json:"meta"`
}

func GetReply

func GetReply(tx *buntdb.Tx, host, board string, thread, id int) (*Reply, error)

func ListReplies

func ListReplies(tx *buntdb.Tx, host, board string, thread int) ([]*Reply, error)

type Thread

type Thread struct {
	ID         int      `json:"id"`
	StartReply int      `json:"start"`
	Board      string   `json:"board"`
	Metadata   Metadata `json:"-"`
	// contains filtered or unexported fields
}

func GetThread

func GetThread(tx *buntdb.Tx, host, board string, id int) (*Thread, error)

func ListThreads

func ListThreads(tx *buntdb.Tx, host, board string) ([]*Thread, error)

func (*Thread) GetReplies

func (t *Thread) GetReplies() []*Reply

func (*Thread) GetReply

func (t *Thread) GetReply() *Reply

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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