mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 18:17:03 +00:00
Added partial templates
mailbox/list now renders
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/sessions"
|
||||
"github.com/jhillyerd/inbucket"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Context struct {
|
||||
Session *sessions.Session
|
||||
Vars map[string]string
|
||||
Session *sessions.Session
|
||||
DataStore *inbucket.DataStore
|
||||
}
|
||||
|
||||
func (c *Context) Close() {
|
||||
@@ -14,9 +18,13 @@ func (c *Context) Close() {
|
||||
}
|
||||
|
||||
func NewContext(req *http.Request) (*Context, error) {
|
||||
vars := mux.Vars(req)
|
||||
sess, err := sessionStore.Get(req, "inbucket")
|
||||
ds := inbucket.NewDataStore()
|
||||
ctx := &Context{
|
||||
Session: sess,
|
||||
Vars: vars,
|
||||
Session: sess,
|
||||
DataStore: ds,
|
||||
}
|
||||
if err != nil {
|
||||
return ctx, err
|
||||
|
||||
Reference in New Issue
Block a user