webobj

package module
v0.0.0-...-c730986 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 17 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	NODE_SCRIPT = "/usr/bin/node"
	MAX_ARG_LEN = 100000
)

Variables

This section is empty.

Functions

func Init

func Init(o InitObj) chan bool

Types

type AnswerObj

type AnswerObj struct {
	Path     []string
	Redirect string
	Cookie   string
	Data     interface{}
	Exited   bool
	Code     int
	Meta     AnswerObjMeta
}

type AnswerObjMeta

type AnswerObjMeta struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type InitObj

type InitObj struct {
	YateScript    string
	Domain        string
	CookieName    string
	CookieTime    int
	CookieSecure  bool
	FontsEnabled  bool
	Fonts         []string
	FontsWaitTime int64
	CspEnabled    bool
	Csp           string
	CheckSession  func(string) interface{}
	CheckCsrf     func(interface{}, string, string) bool
	InlineCss     bool
}

type RqObj

type RqObj struct {
	W             http.ResponseWriter
	R             *http.Request
	Ans           AnswerObj
	TimeStart     time.Time
	User          interface{}
	FontChan      chan string
	Cache         map[string]interface{}
	AppendFunc    func(*RqObj, map[string]interface{}) map[string]interface{}
	StopInlineCss bool
}

func (*RqObj) CheckCsrf

func (ro *RqObj) CheckCsrf() (ok bool)

Проверка запроса

func (*RqObj) CheckSession

func (ro *RqObj) CheckSession() (ok bool)

Проверка сессии

func (*RqObj) GetFonts

func (ro *RqObj) GetFonts(r *http.Request)

Получаем шрифты

func (*RqObj) MakeCache

func (ro *RqObj) MakeCache()

Создаем объет кэша если его еще нет

func (*RqObj) ObjToHtml

func (ro *RqObj) ObjToHtml(js []byte) (str string, err error)

Преобразуем объект в html

func (*RqObj) SendAnswer

func (ro *RqObj) SendAnswer()

Отправляем ответ

func (*RqObj) SendCode

func (ro *RqObj) SendCode()

Отправляем ответ

func (*RqObj) Tmpl

func (ro *RqObj) Tmpl() (str string, err error)

Преобразуем объект в json и шаблонизируем

Jump to

Keyboard shortcuts

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