hash = strings.Trim(string(b), "\n\r\t ") } return hash, nil } }() var templateFuncs = template.FuncMap{ "jsonblob": func(v interface{}) (template.JS, error) { b, err := json.Marshal(v) if err != nil { return "", err } return template.JS(b), nil }, "csrf_token": func() (template.JS, error) { return template.JS(dinutil.RandomString(40)), nil }, "csrf_key": func() (template.JS, error) { return template.JS(CSRFKey), nil }, "git_shorthash": func() (string, error) { return gitShortHash() }, "env": shExpose("printenv"), "id": shExpose("id"), "pwd": shExpose("pwd"), "date": shExpose("date"), } type TemplateResponse struct { *template.Template
func (r *Request) createSession() { r.s = make(Session, 5) r.newSession = true r.sessionKey = dinutil.RandomString(32) }