handlers

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: ISC Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TRUE string ("true")
	TRUE = "true"

	// FALSE string ("false")
	FALSE = "false"
)

Variables

View Source
var (
	// Handlers map
	Handlers = map[string]func(data HandlerData) interface{}{
		"login":           Login,
		"register":        Register,
		"lang":            Lang,
		"conf":            Conf,
		"users":           Users,
		"user":            User,
		"editusername":    EditUsername,
		"editpassword":    EditPassword,
		"deleteaccount":   DeleteAccount,
		"boards":          Boards,
		"board":           Board,
		"threads":         Threads,
		"thread":          Thread,
		"posts":           Posts,
		"newcaptcha":      NewCaptcha,
		"newthread":       NewThread,
		"deletethread":    DeleteThread,
		"newpost":         NewPost,
		"deletepost":      DeletePost,
		"lastthreads":     LastThreads,
		"lastuserthreads": LastUserThreads,
		"editthread":      EditThread,
		"editpost":        EditPost,
		"post":            Post,
		"footer":          Footer,
		"userdata":        UserData,
		"setuserdata":     SetUserData,
		"exportdata":      ExportData,
		"page":            Page,
	}
)
View Source
var (
	// Languages map
	Languages = map[string][]byte{}
)

Functions

func Board

func Board(data HandlerData) interface{}

Board handler

func Boards

func Boards(data HandlerData) interface{}

Boards handler

func Conf

func Conf(data HandlerData) interface{}

Conf handler

func Data

func Data(rw http.ResponseWriter, r *http.Request)

Data serve data files

func DeleteAccount added in v1.0.11

func DeleteAccount(data HandlerData) interface{}

DeleteAccount handler

func DeletePost

func DeletePost(data HandlerData) interface{}

DeletePost handler

func DeleteThread

func DeleteThread(data HandlerData) interface{}

DeleteThread handler

func EditPassword

func EditPassword(data HandlerData) interface{}

EditPassword handler

func EditPost

func EditPost(data HandlerData) interface{}

EditPost handler

func EditThread

func EditThread(data HandlerData) interface{}

EditThread handler

func EditUsername

func EditUsername(data HandlerData) interface{}

EditUsername handler

func ExportData added in v1.0.13

func ExportData(data HandlerData) interface{}

ExportData handler

func Footer(data HandlerData) interface{}

Footer provide HTML page

func GenerateHandler

func GenerateHandler(handler func(data HandlerData) interface{}) func(http.ResponseWriter, *http.Request)

GenerateHandler add custom variables to handler

func GetUserID

func GetUserID(username string) int

GetUserID user id from username

func GetUsername

func GetUsername(id int) string

GetUsername username from user id

func Lang

func Lang(data HandlerData) interface{}

Lang handler

func LastThreads

func LastThreads(data HandlerData) interface{}

LastThreads handler

func LastUserThreads

func LastUserThreads(data HandlerData) interface{}

LastUserThreads handler

func Login

func Login(data HandlerData) interface{}

Login handler

func NewCaptcha

func NewCaptcha(data HandlerData) interface{}

NewCaptcha handler

func NewPost

func NewPost(data HandlerData) interface{}

NewPost handler

func NewThread

func NewThread(data HandlerData) interface{}

NewThread handler

func Page added in v1.0.15

func Page(data HandlerData) interface{}

Page provide custom pages

func Post

func Post(data HandlerData) interface{}

Post handler

func Posts

func Posts(data HandlerData) interface{}

Posts handler

func Register

func Register(data HandlerData) interface{}

Register handler

func SecurityHeaders

func SecurityHeaders(w http.ResponseWriter, r *http.Request)

SecurityHeaders write CORS and CSP headers

func SetUserData added in v1.0.13

func SetUserData(data HandlerData) interface{}

SetUserData handler

func Thread

func Thread(data HandlerData) interface{}

Thread handler

func Threads

func Threads(data HandlerData) interface{}

Threads handler

func UploadAvatar

func UploadAvatar(w http.ResponseWriter, r *http.Request)

UploadAvatar http handler function

func User

func User(data HandlerData) interface{}

User handler

func UserData added in v1.0.13

func UserData(data HandlerData) interface{}

UserData handler

func Users

func Users(data HandlerData) interface{}

Users handler

func Web

func Web(rw http.ResponseWriter, r *http.Request)

Web serve web/dist/gorum files

Types

type HandlerData added in v1.0.13

type HandlerData struct {
	Request       Request
	Username      string
	Authenticated bool
}

HandlerData structure

type Request added in v1.0.13

type Request struct {
	RequestMap map[string]interface{}
}

Request structure

func (Request) GetBool added in v1.0.13

func (request Request) GetBool(name string) bool

GetBool get string or false

func (Request) GetInt added in v1.0.13

func (request Request) GetInt(name string) int

GetInt get int or 0

func (Request) GetString added in v1.0.13

func (request Request) GetString(name string) string

GetString get string or empty string

func (Request) GetStringArray added in v1.0.13

func (request Request) GetStringArray(name string) []string

GetStringArray get string array or nil

Jump to

Keyboard shortcuts

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