+
{{template "footer.html" . }}
\ No newline at end of file
diff --git a/router_gen/main.go b/router_gen/main.go
index 7c732ce5..83c80876 100644
--- a/router_gen/main.go
+++ b/router_gen/main.go
@@ -233,6 +233,10 @@ func (router *GenRouter) RemoveFunc(pattern string) error {
return nil
}
+// TODO: Pass the default route or config struct to the router rather than accessing it via a package global
+// TODO: SetDefaultRoute
+// TODO: GetDefaultRoute
+
func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if len(req.URL.Path) == 0 || req.URL.Path[0] != '/' {
w.WriteHeader(405)
@@ -303,7 +307,17 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
common.NotFound(w,req)
return
}
- common.Config.DefaultRoute(w,req,user) // TODO: Count these views
+
+ handle, ok := RouteMap[common.Config.DefaultRoute]
+ if !ok {
+ // TODO: Make this a startup error not a runtime one
+ log.Print("Unable to find the default route")
+ common.NotFound(w,req)
+ return
+ }
+ common.RouteViewCounter.Bump(routeMapEnum[common.Config.DefaultRoute])
+
+ handle.(func(http.ResponseWriter, *http.Request, common.User) common.RouteError)(w,req,user)
default:
// A fallback for the routes which haven't been converted to the new router yet or plugins
router.RLock()
diff --git a/router_gen/routes.go b/router_gen/routes.go
index e29d3b4e..3cac9066 100644
--- a/router_gen/routes.go
+++ b/router_gen/routes.go
@@ -4,7 +4,7 @@ package main
func routes() {
addRoute(View("routeAPI", "/api/"))
addRoute(View("routeOverview", "/overview/"))
- //addRoute("routeCustomPage","/pages/",""/*,"&extraData"*/)
+ addRoute(View("routeCustomPage", "/pages/", "extraData"))
addRoute(View("routeForums", "/forums/" /*,"&forums"*/))
addRoute(View("routeForum", "/forum/", "extraData"))
addRoute(AnonAction("routeChangeTheme", "/theme/"))
diff --git a/routes.go b/routes.go
index cc017e43..d14ee323 100644
--- a/routes.go
+++ b/routes.go
@@ -33,6 +33,7 @@ type HTTPSRedirect struct {
}
func (red *HTTPSRedirect) ServeHTTP(w http.ResponseWriter, req *http.Request) {
+ w.Header().Set("Connection", "close")
dest := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
dest += "?" + req.URL.RawQuery
@@ -107,26 +108,27 @@ func routeOverview(w http.ResponseWriter, r *http.Request, user common.User) com
return nil
}
-func routeCustomPage(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
+func routeCustomPage(w http.ResponseWriter, r *http.Request, user common.User, name string) common.RouteError {
headerVars, ferr := common.UserCheck(w, r, &user)
if ferr != nil {
return ferr
}
- name := r.URL.Path[len("/pages/"):]
- if common.Templates.Lookup("page_"+name) == nil {
+ // ! Is this safe?
+ if common.Templates.Lookup("page_"+name+".html") == nil {
return common.NotFound(w, r)
}
headerVars.Zone = "custom_page"
pi := common.Page{common.GetTitlePhrase("page"), user, headerVars, tList, nil}
+ // TODO: Pass the page name to the pre-render hook?
if common.PreRenderHooks["pre_render_custom_page"] != nil {
if common.RunPreRenderHook("pre_render_custom_page", w, r, &user, &pi) {
return nil
}
}
- err := common.Templates.ExecuteTemplate(w, "page_"+name, pi)
+ err := common.Templates.ExecuteTemplate(w, "page_"+name+".html", pi)
if err != nil {
return common.InternalError(err, w, r)
}
diff --git a/template_forum.go b/template_forum.go
index b0551377..e03a0aea 100644
--- a/template_forum.go
+++ b/template_forum.go
@@ -143,58 +143,62 @@ w.Write([]byte(item.Creator.Link))
w.Write(forum_30)
w.Write([]byte(item.Creator.Avatar))
w.Write(forum_31)
-w.Write([]byte(item.Creator.Avatar))
-w.Write(forum_32)
-w.Write([]byte(item.Link))
-w.Write(forum_33)
-w.Write([]byte(item.Title))
-w.Write(forum_34)
-w.Write([]byte(item.Creator.Link))
-w.Write(forum_35)
w.Write([]byte(item.Creator.Name))
+w.Write(forum_32)
+w.Write([]byte(item.Creator.Name))
+w.Write(forum_33)
+w.Write([]byte(item.Link))
+w.Write(forum_34)
+w.Write([]byte(item.Title))
+w.Write(forum_35)
+w.Write([]byte(item.Creator.Link))
w.Write(forum_36)
-if item.IsClosed {
+w.Write([]byte(item.Creator.Name))
w.Write(forum_37)
-}
-if item.Sticky {
+if item.IsClosed {
w.Write(forum_38)
}
-w.Write(forum_39)
-w.Write([]byte(strconv.Itoa(item.PostCount)))
-w.Write(forum_40)
-w.Write([]byte(strconv.Itoa(item.LikeCount)))
-w.Write(forum_41)
if item.Sticky {
+w.Write(forum_39)
+}
+w.Write(forum_40)
+w.Write([]byte(strconv.Itoa(item.PostCount)))
+w.Write(forum_41)
+w.Write([]byte(strconv.Itoa(item.LikeCount)))
w.Write(forum_42)
+if item.Sticky {
+w.Write(forum_43)
} else {
if item.IsClosed {
-w.Write(forum_43)
-}
-}
w.Write(forum_44)
-w.Write([]byte(item.LastUser.Link))
+}
+}
w.Write(forum_45)
-w.Write([]byte(item.LastUser.Avatar))
-w.Write(forum_46)
-w.Write([]byte(item.LastUser.Name))
-w.Write(forum_47)
w.Write([]byte(item.LastUser.Link))
+w.Write(forum_46)
+w.Write([]byte(item.LastUser.Avatar))
+w.Write(forum_47)
+w.Write([]byte(item.LastUser.Name))
w.Write(forum_48)
w.Write([]byte(item.LastUser.Name))
w.Write(forum_49)
-w.Write([]byte(item.RelativeLastReplyAt))
+w.Write([]byte(item.LastUser.Link))
w.Write(forum_50)
+w.Write([]byte(item.LastUser.Name))
+w.Write(forum_51)
+w.Write([]byte(item.RelativeLastReplyAt))
+w.Write(forum_52)
}
} else {
-w.Write(forum_51)
-if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
-w.Write(forum_52)
-w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
w.Write(forum_53)
-}
+if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
w.Write(forum_54)
-}
+w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
w.Write(forum_55)
+}
+w.Write(forum_56)
+}
+w.Write(forum_57)
w.Write(footer_0)
w.Write([]byte(common.BuildWidget("footer",tmpl_forum_vars.Header)))
w.Write(footer_1)
diff --git a/template_forums.go b/template_forums.go
index 113bf2e3..02914019 100644
--- a/template_forums.go
+++ b/template_forums.go
@@ -97,27 +97,31 @@ if item.LastReplyer.Avatar != "" {
w.Write(forums_10)
w.Write([]byte(item.LastReplyer.Avatar))
w.Write(forums_11)
-}
+w.Write([]byte(item.LastReplyer.Name))
w.Write(forums_12)
-w.Write([]byte(item.LastTopic.Link))
+w.Write([]byte(item.LastReplyer.Name))
w.Write(forums_13)
+}
+w.Write(forums_14)
+w.Write([]byte(item.LastTopic.Link))
+w.Write(forums_15)
if item.LastTopic.Title != "" {
w.Write([]byte(item.LastTopic.Title))
} else {
-w.Write(forums_14)
-}
-w.Write(forums_15)
-if item.LastTopicTime != "" {
w.Write(forums_16)
-w.Write([]byte(item.LastTopicTime))
+}
w.Write(forums_17)
-}
+if item.LastTopicTime != "" {
w.Write(forums_18)
-}
-} else {
+w.Write([]byte(item.LastTopicTime))
w.Write(forums_19)
}
w.Write(forums_20)
+}
+} else {
+w.Write(forums_21)
+}
+w.Write(forums_22)
w.Write(footer_0)
w.Write([]byte(common.BuildWidget("footer",tmpl_forums_vars.Header)))
w.Write(footer_1)
diff --git a/template_list.go b/template_list.go
index 7599f2fe..a5997f9c 100644
--- a/template_list.go
+++ b/template_list.go
@@ -518,14 +518,16 @@ var profile_0 = []byte(`
+var profile_1 = []byte(`" class="avatar" alt="`)
+var profile_2 = []byte(`'s Avatar" title="`)
+var profile_3 = []byte(`'s Avatar" />
`)
-var profile_2 = []byte(``)
-var profile_3 = []byte(``)
var profile_4 = []byte(``)
-var profile_5 = []byte(`
+var profile_5 = []byte(``)
+var profile_6 = []byte(``)
+var profile_7 = []byte(`
@@ -533,20 +535,20 @@ var profile_5 = []byte(`
`)
-var profile_6 = []byte(`
+var profile_8 = []byte(`
`)
-var profile_7 = []byte(`
+var profile_9 = []byte(`
`)
-var profile_10 = []byte(``)
-var profile_11 = []byte(`
+var profile_12 = []byte(``)
+var profile_13 = []byte(`
`)
-var profile_12 = []byte(`
+var profile_14 = []byte(`
+var profile_15 = []byte(`?session=`)
+var profile_16 = []byte(`&type=user" class="profile_menu_item report_item">Report
@@ -554,16 +556,16 @@ var profile_14 = []byte(`&type=user" class="profile_menu_item report_item">Repor