Made some minor tweaks.

The DefaultRoute parameter in the configuration struct is now a string.
Fixed a few mismatched HTML tags.
Added the profile_comments_row template.
Added more alt attributes for images and associated title=""s in a few places.
Connections should now be closed properly.
Custom Pages no longer have a .html file extension in their URLs.
We now track route views for the default route and the custom page route.

Began work on cleaning up the profiles on Cosora.
This commit is contained in:
Azareal 2017-12-22 03:32:23 +00:00
parent 386e835b86
commit bdbd80319f
28 changed files with 634 additions and 441 deletions

View File

@ -32,10 +32,8 @@ func NewChunkedViewCounter() (*ChunkedViewCounter, error) {
func (counter *ChunkedViewCounter) Tick() (err error) {
var oldBucket = counter.currentBucket
var nextBucket int64
if counter.currentBucket == 1 {
nextBucket = 0
} else {
var nextBucket int64 // 0
if counter.currentBucket == 0 {
nextBucket = 1
}
atomic.AddInt64(&counter.buckets[oldBucket], counter.buckets[nextBucket])

View File

@ -165,7 +165,7 @@ func shortcodeToUnicode(msg string) string {
}
func PreparseMessage(msg string) string {
msg = strings.Replace(msg, "<p><br>", "<br>", -1)
msg = strings.Replace(msg, "<p><br>", "\n", -1)
msg = strings.Replace(msg, "<p>", "\n", -1)
msg = strings.Replace(msg, "</p>", "", -1)
msg = strings.Replace(msg, "<br>", "\n", -1)

View File

@ -2,7 +2,6 @@ package common
import (
"errors"
"net/http"
"strings"
)
@ -61,7 +60,7 @@ type config struct {
SMTPPort string
//SMTPEnableTLS bool
DefaultRoute func(http.ResponseWriter, *http.Request, User) RouteError
DefaultRoute string
DefaultGroup int
ActivationGroup int
StaffCSS string // ? - Move this into the settings table? Might be better to implement this as Group CSS

View File

@ -41,6 +41,7 @@ type Theme struct {
MobileFriendly bool
Disabled bool
HideFromThemes bool
BgAvatars bool // For profiles, at the moment
ForkOf string
Tag string
URL string

View File

@ -45,7 +45,7 @@ func init() {
common.Config.SMTPPort = "25"
// Misc
common.Config.DefaultRoute = routeTopics
common.Config.DefaultRoute = "routeTopics"
common.Config.DefaultGroup = 3 // Should be a setting in the database
common.Config.ActivationGroup = 5 // Should be a setting in the database
common.Config.StaffCSS = "staff_post"

View File

@ -17,6 +17,7 @@ var ErrNoRoute = errors.New("That route doesn't exist.")
var RouteMap = map[string]interface{}{
"routeAPI": routeAPI,
"routeOverview": routeOverview,
"routeCustomPage": routeCustomPage,
"routeForums": routeForums,
"routeForum": routeForum,
"routeChangeTheme": routeChangeTheme,
@ -77,118 +78,120 @@ var RouteMap = map[string]interface{}{
var routeMapEnum = map[string]int{
"routeAPI": 0,
"routeOverview": 1,
"routeForums": 2,
"routeForum": 3,
"routeChangeTheme": 4,
"routeShowAttachment": 5,
"routeReportSubmit": 6,
"routeTopicCreate": 7,
"routeTopics": 8,
"routePanelForums": 9,
"routePanelForumsCreateSubmit": 10,
"routePanelForumsDelete": 11,
"routePanelForumsDeleteSubmit": 12,
"routePanelForumsEdit": 13,
"routePanelForumsEditSubmit": 14,
"routePanelForumsEditPermsSubmit": 15,
"routePanelSettings": 16,
"routePanelSettingEdit": 17,
"routePanelSettingEditSubmit": 18,
"routePanelWordFilters": 19,
"routePanelWordFiltersCreate": 20,
"routePanelWordFiltersEdit": 21,
"routePanelWordFiltersEditSubmit": 22,
"routePanelWordFiltersDeleteSubmit": 23,
"routePanelThemes": 24,
"routePanelThemesSetDefault": 25,
"routePanelPlugins": 26,
"routePanelPluginsActivate": 27,
"routePanelPluginsDeactivate": 28,
"routePanelPluginsInstall": 29,
"routePanelUsers": 30,
"routePanelUsersEdit": 31,
"routePanelUsersEditSubmit": 32,
"routePanelGroups": 33,
"routePanelGroupsEdit": 34,
"routePanelGroupsEditPerms": 35,
"routePanelGroupsEditSubmit": 36,
"routePanelGroupsEditPermsSubmit": 37,
"routePanelGroupsCreateSubmit": 38,
"routePanelBackups": 39,
"routePanelLogsMod": 40,
"routePanelDebug": 41,
"routePanel": 42,
"routeAccountEditCritical": 43,
"routeAccountEditCriticalSubmit": 44,
"routeAccountEditAvatar": 45,
"routeAccountEditAvatarSubmit": 46,
"routeAccountEditUsername": 47,
"routeAccountEditUsernameSubmit": 48,
"routeAccountEditEmail": 49,
"routeAccountEditEmailTokenSubmit": 50,
"routeProfile": 51,
"routeBanSubmit": 52,
"routeUnban": 53,
"routeActivate": 54,
"routeIps": 55,
"routeCustomPage": 2,
"routeForums": 3,
"routeForum": 4,
"routeChangeTheme": 5,
"routeShowAttachment": 6,
"routeReportSubmit": 7,
"routeTopicCreate": 8,
"routeTopics": 9,
"routePanelForums": 10,
"routePanelForumsCreateSubmit": 11,
"routePanelForumsDelete": 12,
"routePanelForumsDeleteSubmit": 13,
"routePanelForumsEdit": 14,
"routePanelForumsEditSubmit": 15,
"routePanelForumsEditPermsSubmit": 16,
"routePanelSettings": 17,
"routePanelSettingEdit": 18,
"routePanelSettingEditSubmit": 19,
"routePanelWordFilters": 20,
"routePanelWordFiltersCreate": 21,
"routePanelWordFiltersEdit": 22,
"routePanelWordFiltersEditSubmit": 23,
"routePanelWordFiltersDeleteSubmit": 24,
"routePanelThemes": 25,
"routePanelThemesSetDefault": 26,
"routePanelPlugins": 27,
"routePanelPluginsActivate": 28,
"routePanelPluginsDeactivate": 29,
"routePanelPluginsInstall": 30,
"routePanelUsers": 31,
"routePanelUsersEdit": 32,
"routePanelUsersEditSubmit": 33,
"routePanelGroups": 34,
"routePanelGroupsEdit": 35,
"routePanelGroupsEditPerms": 36,
"routePanelGroupsEditSubmit": 37,
"routePanelGroupsEditPermsSubmit": 38,
"routePanelGroupsCreateSubmit": 39,
"routePanelBackups": 40,
"routePanelLogsMod": 41,
"routePanelDebug": 42,
"routePanel": 43,
"routeAccountEditCritical": 44,
"routeAccountEditCriticalSubmit": 45,
"routeAccountEditAvatar": 46,
"routeAccountEditAvatarSubmit": 47,
"routeAccountEditUsername": 48,
"routeAccountEditUsernameSubmit": 49,
"routeAccountEditEmail": 50,
"routeAccountEditEmailTokenSubmit": 51,
"routeProfile": 52,
"routeBanSubmit": 53,
"routeUnban": 54,
"routeActivate": 55,
"routeIps": 56,
}
var reverseRouteMapEnum = map[int]string{
0: "routeAPI",
1: "routeOverview",
2: "routeForums",
3: "routeForum",
4: "routeChangeTheme",
5: "routeShowAttachment",
6: "routeReportSubmit",
7: "routeTopicCreate",
8: "routeTopics",
9: "routePanelForums",
10: "routePanelForumsCreateSubmit",
11: "routePanelForumsDelete",
12: "routePanelForumsDeleteSubmit",
13: "routePanelForumsEdit",
14: "routePanelForumsEditSubmit",
15: "routePanelForumsEditPermsSubmit",
16: "routePanelSettings",
17: "routePanelSettingEdit",
18: "routePanelSettingEditSubmit",
19: "routePanelWordFilters",
20: "routePanelWordFiltersCreate",
21: "routePanelWordFiltersEdit",
22: "routePanelWordFiltersEditSubmit",
23: "routePanelWordFiltersDeleteSubmit",
24: "routePanelThemes",
25: "routePanelThemesSetDefault",
26: "routePanelPlugins",
27: "routePanelPluginsActivate",
28: "routePanelPluginsDeactivate",
29: "routePanelPluginsInstall",
30: "routePanelUsers",
31: "routePanelUsersEdit",
32: "routePanelUsersEditSubmit",
33: "routePanelGroups",
34: "routePanelGroupsEdit",
35: "routePanelGroupsEditPerms",
36: "routePanelGroupsEditSubmit",
37: "routePanelGroupsEditPermsSubmit",
38: "routePanelGroupsCreateSubmit",
39: "routePanelBackups",
40: "routePanelLogsMod",
41: "routePanelDebug",
42: "routePanel",
43: "routeAccountEditCritical",
44: "routeAccountEditCriticalSubmit",
45: "routeAccountEditAvatar",
46: "routeAccountEditAvatarSubmit",
47: "routeAccountEditUsername",
48: "routeAccountEditUsernameSubmit",
49: "routeAccountEditEmail",
50: "routeAccountEditEmailTokenSubmit",
51: "routeProfile",
52: "routeBanSubmit",
53: "routeUnban",
54: "routeActivate",
55: "routeIps",
2: "routeCustomPage",
3: "routeForums",
4: "routeForum",
5: "routeChangeTheme",
6: "routeShowAttachment",
7: "routeReportSubmit",
8: "routeTopicCreate",
9: "routeTopics",
10: "routePanelForums",
11: "routePanelForumsCreateSubmit",
12: "routePanelForumsDelete",
13: "routePanelForumsDeleteSubmit",
14: "routePanelForumsEdit",
15: "routePanelForumsEditSubmit",
16: "routePanelForumsEditPermsSubmit",
17: "routePanelSettings",
18: "routePanelSettingEdit",
19: "routePanelSettingEditSubmit",
20: "routePanelWordFilters",
21: "routePanelWordFiltersCreate",
22: "routePanelWordFiltersEdit",
23: "routePanelWordFiltersEditSubmit",
24: "routePanelWordFiltersDeleteSubmit",
25: "routePanelThemes",
26: "routePanelThemesSetDefault",
27: "routePanelPlugins",
28: "routePanelPluginsActivate",
29: "routePanelPluginsDeactivate",
30: "routePanelPluginsInstall",
31: "routePanelUsers",
32: "routePanelUsersEdit",
33: "routePanelUsersEditSubmit",
34: "routePanelGroups",
35: "routePanelGroupsEdit",
36: "routePanelGroupsEditPerms",
37: "routePanelGroupsEditSubmit",
38: "routePanelGroupsEditPermsSubmit",
39: "routePanelGroupsCreateSubmit",
40: "routePanelBackups",
41: "routePanelLogsMod",
42: "routePanelDebug",
43: "routePanel",
44: "routeAccountEditCritical",
45: "routeAccountEditCriticalSubmit",
46: "routeAccountEditAvatar",
47: "routeAccountEditAvatarSubmit",
48: "routeAccountEditUsername",
49: "routeAccountEditUsernameSubmit",
50: "routeAccountEditEmail",
51: "routeAccountEditEmailTokenSubmit",
52: "routeProfile",
53: "routeBanSubmit",
54: "routeUnban",
55: "routeActivate",
56: "routeIps",
}
// TODO: Stop spilling these into the package scope?
@ -243,6 +246,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)
@ -301,14 +308,20 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if err != nil {
router.handleError(err,w,req,user)
}
case "/forums":
case "/pages":
common.RouteViewCounter.Bump(2)
err = routeCustomPage(w,req,user,extraData)
if err != nil {
router.handleError(err,w,req,user)
}
case "/forums":
common.RouteViewCounter.Bump(3)
err = routeForums(w,req,user)
if err != nil {
router.handleError(err,w,req,user)
}
case "/forum":
common.RouteViewCounter.Bump(3)
common.RouteViewCounter.Bump(4)
err = routeForum(w,req,user,extraData)
if err != nil {
router.handleError(err,w,req,user)
@ -320,7 +333,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(4)
common.RouteViewCounter.Bump(5)
err = routeChangeTheme(w,req,user)
if err != nil {
router.handleError(err,w,req,user)
@ -332,7 +345,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(5)
common.RouteViewCounter.Bump(6)
err = routeShowAttachment(w,req,user,extraData)
if err != nil {
router.handleError(err,w,req,user)
@ -358,7 +371,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(6)
common.RouteViewCounter.Bump(7)
err = routeReportSubmit(w,req,user,extraData)
}
if err != nil {
@ -373,10 +386,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(7)
common.RouteViewCounter.Bump(8)
err = routeTopicCreate(w,req,user,extraData)
default:
common.RouteViewCounter.Bump(8)
common.RouteViewCounter.Bump(9)
err = routeTopics(w,req,user)
}
if err != nil {
@ -391,7 +404,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
switch(req.URL.Path) {
case "/panel/forums/":
common.RouteViewCounter.Bump(9)
common.RouteViewCounter.Bump(10)
err = routePanelForums(w,req,user)
case "/panel/forums/create/":
err = common.NoSessionMismatch(w,req,user)
@ -400,7 +413,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(10)
common.RouteViewCounter.Bump(11)
err = routePanelForumsCreateSubmit(w,req,user)
case "/panel/forums/delete/":
err = common.NoSessionMismatch(w,req,user)
@ -409,7 +422,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(11)
common.RouteViewCounter.Bump(12)
err = routePanelForumsDelete(w,req,user,extraData)
case "/panel/forums/delete/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -418,10 +431,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(12)
common.RouteViewCounter.Bump(13)
err = routePanelForumsDeleteSubmit(w,req,user,extraData)
case "/panel/forums/edit/":
common.RouteViewCounter.Bump(13)
common.RouteViewCounter.Bump(14)
err = routePanelForumsEdit(w,req,user,extraData)
case "/panel/forums/edit/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -430,7 +443,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(14)
common.RouteViewCounter.Bump(15)
err = routePanelForumsEditSubmit(w,req,user,extraData)
case "/panel/forums/edit/perms/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -439,13 +452,13 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(15)
common.RouteViewCounter.Bump(16)
err = routePanelForumsEditPermsSubmit(w,req,user,extraData)
case "/panel/settings/":
common.RouteViewCounter.Bump(16)
common.RouteViewCounter.Bump(17)
err = routePanelSettings(w,req,user)
case "/panel/settings/edit/":
common.RouteViewCounter.Bump(17)
common.RouteViewCounter.Bump(18)
err = routePanelSettingEdit(w,req,user,extraData)
case "/panel/settings/edit/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -454,10 +467,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(18)
common.RouteViewCounter.Bump(19)
err = routePanelSettingEditSubmit(w,req,user,extraData)
case "/panel/settings/word-filters/":
common.RouteViewCounter.Bump(19)
common.RouteViewCounter.Bump(20)
err = routePanelWordFilters(w,req,user)
case "/panel/settings/word-filters/create/":
err = common.NoSessionMismatch(w,req,user)
@ -466,10 +479,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(20)
common.RouteViewCounter.Bump(21)
err = routePanelWordFiltersCreate(w,req,user)
case "/panel/settings/word-filters/edit/":
common.RouteViewCounter.Bump(21)
common.RouteViewCounter.Bump(22)
err = routePanelWordFiltersEdit(w,req,user,extraData)
case "/panel/settings/word-filters/edit/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -478,7 +491,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(22)
common.RouteViewCounter.Bump(23)
err = routePanelWordFiltersEditSubmit(w,req,user,extraData)
case "/panel/settings/word-filters/delete/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -487,10 +500,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(23)
common.RouteViewCounter.Bump(24)
err = routePanelWordFiltersDeleteSubmit(w,req,user,extraData)
case "/panel/themes/":
common.RouteViewCounter.Bump(24)
common.RouteViewCounter.Bump(25)
err = routePanelThemes(w,req,user)
case "/panel/themes/default/":
err = common.NoSessionMismatch(w,req,user)
@ -499,10 +512,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(25)
common.RouteViewCounter.Bump(26)
err = routePanelThemesSetDefault(w,req,user,extraData)
case "/panel/plugins/":
common.RouteViewCounter.Bump(26)
common.RouteViewCounter.Bump(27)
err = routePanelPlugins(w,req,user)
case "/panel/plugins/activate/":
err = common.NoSessionMismatch(w,req,user)
@ -511,7 +524,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(27)
common.RouteViewCounter.Bump(28)
err = routePanelPluginsActivate(w,req,user,extraData)
case "/panel/plugins/deactivate/":
err = common.NoSessionMismatch(w,req,user)
@ -520,7 +533,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(28)
common.RouteViewCounter.Bump(29)
err = routePanelPluginsDeactivate(w,req,user,extraData)
case "/panel/plugins/install/":
err = common.NoSessionMismatch(w,req,user)
@ -529,13 +542,13 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(29)
common.RouteViewCounter.Bump(30)
err = routePanelPluginsInstall(w,req,user,extraData)
case "/panel/users/":
common.RouteViewCounter.Bump(30)
common.RouteViewCounter.Bump(31)
err = routePanelUsers(w,req,user)
case "/panel/users/edit/":
common.RouteViewCounter.Bump(31)
common.RouteViewCounter.Bump(32)
err = routePanelUsersEdit(w,req,user,extraData)
case "/panel/users/edit/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -544,16 +557,16 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(32)
common.RouteViewCounter.Bump(33)
err = routePanelUsersEditSubmit(w,req,user,extraData)
case "/panel/groups/":
common.RouteViewCounter.Bump(33)
common.RouteViewCounter.Bump(34)
err = routePanelGroups(w,req,user)
case "/panel/groups/edit/":
common.RouteViewCounter.Bump(34)
common.RouteViewCounter.Bump(35)
err = routePanelGroupsEdit(w,req,user,extraData)
case "/panel/groups/edit/perms/":
common.RouteViewCounter.Bump(35)
common.RouteViewCounter.Bump(36)
err = routePanelGroupsEditPerms(w,req,user,extraData)
case "/panel/groups/edit/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -562,7 +575,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(36)
common.RouteViewCounter.Bump(37)
err = routePanelGroupsEditSubmit(w,req,user,extraData)
case "/panel/groups/edit/perms/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -571,7 +584,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(37)
common.RouteViewCounter.Bump(38)
err = routePanelGroupsEditPermsSubmit(w,req,user,extraData)
case "/panel/groups/create/":
err = common.NoSessionMismatch(w,req,user)
@ -580,7 +593,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(38)
common.RouteViewCounter.Bump(39)
err = routePanelGroupsCreateSubmit(w,req,user)
case "/panel/backups/":
err = common.SuperAdminOnly(w,req,user)
@ -589,10 +602,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(39)
common.RouteViewCounter.Bump(40)
err = routePanelBackups(w,req,user,extraData)
case "/panel/logs/mod/":
common.RouteViewCounter.Bump(40)
common.RouteViewCounter.Bump(41)
err = routePanelLogsMod(w,req,user)
case "/panel/debug/":
err = common.AdminOnly(w,req,user)
@ -601,10 +614,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(41)
common.RouteViewCounter.Bump(42)
err = routePanelDebug(w,req,user)
default:
common.RouteViewCounter.Bump(42)
common.RouteViewCounter.Bump(43)
err = routePanel(w,req,user)
}
if err != nil {
@ -619,7 +632,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(43)
common.RouteViewCounter.Bump(44)
err = routeAccountEditCritical(w,req,user)
case "/user/edit/critical/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -634,7 +647,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(44)
common.RouteViewCounter.Bump(45)
err = routeAccountEditCriticalSubmit(w,req,user)
case "/user/edit/avatar/":
err = common.MemberOnly(w,req,user)
@ -643,7 +656,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(45)
common.RouteViewCounter.Bump(46)
err = routeAccountEditAvatar(w,req,user)
case "/user/edit/avatar/submit/":
err = common.MemberOnly(w,req,user)
@ -652,7 +665,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(46)
common.RouteViewCounter.Bump(47)
err = routeAccountEditAvatarSubmit(w,req,user)
case "/user/edit/username/":
err = common.MemberOnly(w,req,user)
@ -661,7 +674,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(47)
common.RouteViewCounter.Bump(48)
err = routeAccountEditUsername(w,req,user)
case "/user/edit/username/submit/":
err = common.NoSessionMismatch(w,req,user)
@ -676,7 +689,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(48)
common.RouteViewCounter.Bump(49)
err = routeAccountEditUsernameSubmit(w,req,user)
case "/user/edit/email/":
err = common.MemberOnly(w,req,user)
@ -685,7 +698,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(49)
common.RouteViewCounter.Bump(50)
err = routeAccountEditEmail(w,req,user)
case "/user/edit/token/":
err = common.NoSessionMismatch(w,req,user)
@ -700,11 +713,11 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(50)
common.RouteViewCounter.Bump(51)
err = routeAccountEditEmailTokenSubmit(w,req,user,extraData)
default:
req.URL.Path += extraData
common.RouteViewCounter.Bump(51)
common.RouteViewCounter.Bump(52)
err = routeProfile(w,req,user)
}
if err != nil {
@ -725,7 +738,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(52)
common.RouteViewCounter.Bump(53)
err = routeBanSubmit(w,req,user)
case "/users/unban/":
err = common.NoSessionMismatch(w,req,user)
@ -740,7 +753,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(53)
common.RouteViewCounter.Bump(54)
err = routeUnban(w,req,user)
case "/users/activate/":
err = common.NoSessionMismatch(w,req,user)
@ -755,7 +768,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(54)
common.RouteViewCounter.Bump(55)
err = routeActivate(w,req,user)
case "/users/ips/":
err = common.MemberOnly(w,req,user)
@ -764,7 +777,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
common.RouteViewCounter.Bump(55)
common.RouteViewCounter.Bump(56)
err = routeIps(w,req,user)
}
if err != nil {
@ -794,7 +807,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()

View File

@ -142,7 +142,7 @@ func init() {
common.Config.SMTPPort = "25"
// Misc
common.Config.DefaultRoute = routeTopics
common.Config.DefaultRoute = "routeTopics"
common.Config.DefaultGroup = 3 // Should be a setting in the database
common.Config.ActivationGroup = 5 // Should be a setting in the database
common.Config.StaffCSS = "staff_post"

21
main.go
View File

@ -302,9 +302,6 @@ func main() {
router.HandleFunc("/topic/unlock/submit/", routeUnlockTopic)
router.HandleFunc("/topic/like/submit/", routeLikeTopic)
// Custom Pages
router.HandleFunc("/pages/", routeCustomPage)
// Accounts
router.HandleFunc("/accounts/login/", routeLogin)
router.HandleFunc("/accounts/create/", routeRegister)
@ -335,6 +332,18 @@ func main() {
// pprof.StopCPUProfile()
//}
// We might not need the timeouts, if we're behind a reverse-proxy like Nginx
var newServer = func(addr string, handler http.Handler) *http.Server {
return &http.Server{
Addr: addr,
Handler: handler,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 120 * time.Second,
}
}
// TODO: Let users run *both* HTTP and HTTPS
log.Print("Initialising the HTTP server")
if !common.Site.EnableSsl {
@ -342,7 +351,7 @@ func main() {
common.Site.Port = "80"
}
log.Print("Listening on port " + common.Site.Port)
err = http.ListenAndServe(":"+common.Site.Port, router)
err = newServer(":"+common.Site.Port, router).ListenAndServe()
} else {
if common.Site.Port == "" {
common.Site.Port = "443"
@ -352,14 +361,14 @@ func main() {
// TODO: Redirect to port 443
go func() {
log.Print("Listening on port 80")
err = http.ListenAndServe(":80", &HTTPSRedirect{})
err = newServer(":80", &HTTPSRedirect{}).ListenAndServe()
if err != nil {
log.Fatal(err)
}
}()
}
log.Printf("Listening on port %s", common.Site.Port)
err = http.ListenAndServeTLS(":"+common.Site.Port, common.Config.SslFullchain, common.Config.SslPrivkey, router)
err = newServer(":"+common.Site.Port, router).ListenAndServeTLS(common.Config.SslFullchain, common.Config.SslPrivkey)
}
// Why did the server stop?

View File

@ -1,8 +1,8 @@
{{template "header.html" . }}
<div class="rowblock">
<div class="rowblock rowhead">
<div class="rowitem">Test Page</div>
</div>
<div class="rowblock">
<div class="rowblock parablock">
<div class="rowitem passive">Testing</div>
</div>
{{template "footer.html" . }}

View File

@ -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()

View File

@ -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/"))

View File

@ -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)
}

View File

@ -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)

View File

@ -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)

View File

@ -518,14 +518,16 @@ var profile_0 = []byte(`
<div class="topBlock">
<div class="rowitem avatarRow">
<img src="`)
var profile_1 = []byte(`" class="avatar" />
var profile_1 = []byte(`" class="avatar" alt="`)
var profile_2 = []byte(`'s Avatar" title="`)
var profile_3 = []byte(`'s Avatar" />
</div>
<div class="rowitem nameRow">
<span class="profileName">`)
var profile_2 = []byte(`</span>`)
var profile_3 = []byte(`<span class="username">`)
var profile_4 = []byte(`</span>`)
var profile_5 = []byte(`
var profile_5 = []byte(`<span class="username">`)
var profile_6 = []byte(`</span>`)
var profile_7 = []byte(`
</div>
</div>
<div class="passiveBlock">
@ -533,20 +535,20 @@ var profile_5 = []byte(`
<a class="profile_menu_item">Add Friend</a>
</div>
`)
var profile_6 = []byte(`<div class="rowitem passive">
var profile_8 = []byte(`<div class="rowitem passive">
`)
var profile_7 = []byte(`<a href="/users/unban/`)
var profile_8 = []byte(`?session=`)
var profile_9 = []byte(`" class="profile_menu_item">Unban</a>
var profile_9 = []byte(`<a href="/users/unban/`)
var profile_10 = []byte(`?session=`)
var profile_11 = []byte(`" class="profile_menu_item">Unban</a>
`)
var profile_10 = []byte(`<a href="#ban_user" class="profile_menu_item">Ban</a>`)
var profile_11 = []byte(`
var profile_12 = []byte(`<a href="#ban_user" class="profile_menu_item">Ban</a>`)
var profile_13 = []byte(`
</div>`)
var profile_12 = []byte(`
var profile_14 = []byte(`
<div class="rowitem passive">
<a href="/report/submit/`)
var profile_13 = []byte(`?session=`)
var profile_14 = []byte(`&type=user" class="profile_menu_item report_item">Report</a>
var profile_15 = []byte(`?session=`)
var profile_16 = []byte(`&type=user" class="profile_menu_item report_item">Report</a>
</div>
</div>
</div>
@ -554,16 +556,16 @@ var profile_14 = []byte(`&type=user" class="profile_menu_item report_item">Repor
<div id="profile_right_lane" class="colstack_right">
`)
var profile_15 = []byte(`
var profile_17 = []byte(`
<!-- TODO: Inline the display: none; CSS -->
<div id="ban_user_head" class="colstack_item colstack_head hash_hide ban_user_hash" style="display: none;">
<div class="rowitem"><h1>Ban User</h1></div>
</div>
<form id="ban_user_form" class="hash_hide ban_user_hash" action="/users/ban/submit/`)
var profile_16 = []byte(`?session=`)
var profile_17 = []byte(`" method="post" style="display: none;">
var profile_18 = []byte(`?session=`)
var profile_19 = []byte(`" method="post" style="display: none;">
`)
var profile_18 = []byte(`
var profile_20 = []byte(`
<div class="colline">If all the fields are left blank, the ban will be permanent.</div>
<div class="colstack_item">
<div class="formrow real_first_child">
@ -594,53 +596,91 @@ var profile_18 = []byte(`
</div>
</form>
`)
var profile_19 = []byte(`
var profile_21 = []byte(`
<div id="profile_comments_head" class="colstack_item colstack_head hash_hide">
<div class="rowitem"><h1>Comments</h1></div>
</div>
<div id="profile_comments" class="colstack_item hash_hide">`)
var profile_20 = []byte(`
<div id="profile_comments" class="colstack_item hash_hide">
`)
var profile_comments_row_0 = []byte(`
<div class="rowitem passive deletable_block editable_parent simple `)
var profile_21 = []byte(`" style="background-image: url(`)
var profile_22 = []byte(`), url(/static/post-avatar-bg.jpg);background-position: 0px `)
var profile_23 = []byte(`-1`)
var profile_24 = []byte(`0px;">
<img class="bgsub" src="`)
var profile_25 = []byte(`" />
var profile_comments_row_1 = []byte(`" style="background-image: url(`)
var profile_comments_row_2 = []byte(`), url(/static/post-avatar-bg.jpg);background-position: 0px `)
var profile_comments_row_3 = []byte(`-1`)
var profile_comments_row_4 = []byte(`0px;">
<span class="editable_block user_content simple">`)
var profile_26 = []byte(`</span>
var profile_comments_row_5 = []byte(`</span>
<span class="controls">
<a href="`)
var profile_27 = []byte(`" class="real_username username">`)
var profile_28 = []byte(`</a>&nbsp;&nbsp;
var profile_comments_row_6 = []byte(`" class="real_username username">`)
var profile_comments_row_7 = []byte(`</a>&nbsp;&nbsp;
`)
var profile_29 = []byte(`<a href="/profile/reply/edit/submit/`)
var profile_30 = []byte(`" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
var profile_comments_row_8 = []byte(`<a href="/profile/reply/edit/submit/`)
var profile_comments_row_9 = []byte(`" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/`)
var profile_31 = []byte(`" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>`)
var profile_32 = []byte(`
var profile_comments_row_10 = []byte(`" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>`)
var profile_comments_row_11 = []byte(`
<a class="mod_button" href="/report/submit/`)
var profile_33 = []byte(`?session=`)
var profile_34 = []byte(`&type=user-reply"><button class="username report_item flag_label"></button></a>
var profile_comments_row_12 = []byte(`?session=`)
var profile_comments_row_13 = []byte(`&type=user-reply"><button class="username report_item flag_label"></button></a>
`)
var profile_35 = []byte(`<a class="username hide_on_mobile user_tag" style="float: right;">`)
var profile_36 = []byte(`</a>`)
var profile_37 = []byte(`
var profile_comments_row_14 = []byte(`<a class="username hide_on_mobile user_tag" style="float: right;">`)
var profile_comments_row_15 = []byte(`</a>`)
var profile_comments_row_16 = []byte(`
</span>
</div>
`)
var profile_38 = []byte(`</div>
var profile_comments_row_17 = []byte(`
<div class="rowitem passive deletable_block editable_parent comment `)
var profile_comments_row_18 = []byte(`">
<div class="userbit">
<img src="`)
var profile_comments_row_19 = []byte(`" alt="`)
var profile_comments_row_20 = []byte(`'s Avatar" title="`)
var profile_comments_row_21 = []byte(`'s Avatar" />
<span class="nameAndTitle">
<a href="`)
var profile_comments_row_22 = []byte(`" class="real_username username">`)
var profile_comments_row_23 = []byte(`</a>
`)
var profile_comments_row_24 = []byte(`<a class="username hide_on_mobile user_tag" style="float: right;">`)
var profile_comments_row_25 = []byte(`</a>`)
var profile_comments_row_26 = []byte(`
</span>
</div>
<div class="content_column">
<span class="editable_block user_content">`)
var profile_comments_row_27 = []byte(`</span>
<span class="controls">
`)
var profile_comments_row_28 = []byte(`
<a href="/profile/reply/edit/submit/`)
var profile_comments_row_29 = []byte(`" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/`)
var profile_comments_row_30 = []byte(`" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>
`)
var profile_comments_row_31 = []byte(`
<a class="mod_button" href="/report/submit/`)
var profile_comments_row_32 = []byte(`?session=`)
var profile_comments_row_33 = []byte(`&type=user-reply"><button class="username report_item flag_label"></button></a>
</span>
</div>
</div>
`)
var profile_22 = []byte(`
</div>
`)
var profile_39 = []byte(`
var profile_23 = []byte(`
<form id="profile_comments_form" class="hash_hide" action="/profile/reply/create/" method="post">
<input name="uid" value='`)
var profile_40 = []byte(`' type="hidden" />
var profile_24 = []byte(`' type="hidden" />
<div class="colstack_item topic_reply_form" style="border-top: none;">
<div class="formrow">
<div class="formitem"><textarea name="reply-content" placeholder="Insert reply here"></textarea></div>
@ -651,13 +691,13 @@ var profile_40 = []byte(`' type="hidden" />
</div>
</form>
`)
var profile_41 = []byte(`
var profile_25 = []byte(`
</div>
</div>
`)
var profile_42 = []byte(`
var profile_26 = []byte(`
<script type="text/javascript">
function handle_profile_hashbit() {
var hash_class = ""
@ -706,24 +746,26 @@ var forums_9 = []byte(`
<span class="forum_right shift_right">
`)
var forums_10 = []byte(`<img class="extra_little_row_avatar" src="`)
var forums_11 = []byte(`" height=64 width=64 />`)
var forums_12 = []byte(`
var forums_11 = []byte(`" height=64 width=64 alt="`)
var forums_12 = []byte(`'s Avatar" title="`)
var forums_13 = []byte(`'s Avatar" />`)
var forums_14 = []byte(`
<span>
<a href="`)
var forums_13 = []byte(`">`)
var forums_14 = []byte(`None`)
var forums_15 = []byte(`</a>
var forums_15 = []byte(`">`)
var forums_16 = []byte(`None`)
var forums_17 = []byte(`</a>
`)
var forums_16 = []byte(`<br /><span class="rowsmall">`)
var forums_17 = []byte(`</span>`)
var forums_18 = []byte(`
var forums_18 = []byte(`<br /><span class="rowsmall">`)
var forums_19 = []byte(`</span>`)
var forums_20 = []byte(`
</span>
</span>
<div style="clear: both;"></div>
</div>
`)
var forums_19 = []byte(`<div class="rowitem passive">You don't have access to any forums.</div>`)
var forums_20 = []byte(`
var forums_21 = []byte(`<div class="rowitem passive">You don't have access to any forums.</div>`)
var forums_22 = []byte(`
</div>
</main>
@ -774,7 +816,7 @@ var topics_9 = []byte(`
<div class="rowblock topic_create_form quick_create_form" style="display: none;" aria-label="Quick Topic Form">
<form name="topic_create_form_form" id="topic_create_form_form" enctype="multipart/form-data" action="/topic/create/submit/" method="post"></form>
<img class="little_row_avatar" src="`)
var topics_10 = []byte(`" height="64" alt="Your Avatar" />
var topics_10 = []byte(`" height="64" alt="Your Avatar" title="Your Avatar" />
<div class="main_form">
<div class="topic_meta">
<div class="formrow topic_board_row real_first_child">
@ -827,51 +869,53 @@ var topics_24 = []byte(`">
<a href="`)
var topics_25 = []byte(`"><img src="`)
var topics_26 = []byte(`" height="64" alt="`)
var topics_27 = []byte(`'s Avatar" /></a>
var topics_27 = []byte(`'s Avatar" title="`)
var topics_28 = []byte(`'s Avatar" /></a>
<span class="topic_inner_left">
<a class="rowtopic" href="`)
var topics_28 = []byte(`"><span>`)
var topics_29 = []byte(`</span></a> `)
var topics_30 = []byte(`<a class="rowsmall parent_forum" href="`)
var topics_31 = []byte(`">`)
var topics_32 = []byte(`</a>`)
var topics_33 = []byte(`
var topics_29 = []byte(`"><span>`)
var topics_30 = []byte(`</span></a> `)
var topics_31 = []byte(`<a class="rowsmall parent_forum" href="`)
var topics_32 = []byte(`">`)
var topics_33 = []byte(`</a>`)
var topics_34 = []byte(`
<br /><a class="rowsmall starter" href="`)
var topics_34 = []byte(`">`)
var topics_35 = []byte(`</a>
var topics_35 = []byte(`">`)
var topics_36 = []byte(`</a>
`)
var topics_36 = []byte(`<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E</span>`)
var topics_37 = []byte(`<span class="rowsmall topic_status_e topic_status_sticky" title="Status: Pinned"> | &#x1F4CD;&#xFE0E</span>`)
var topics_38 = []byte(`
var topics_37 = []byte(`<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E</span>`)
var topics_38 = []byte(`<span class="rowsmall topic_status_e topic_status_sticky" title="Status: Pinned"> | &#x1F4CD;&#xFE0E</span>`)
var topics_39 = []byte(`
</span>
<span class="topic_inner_right rowsmall" style="float: right;">
<span class="replyCount">`)
var topics_39 = []byte(`</span><br />
var topics_40 = []byte(`</span><br />
<span class="likeCount">`)
var topics_40 = []byte(`</span>
var topics_41 = []byte(`</span>
</span>
</div>
<div class="rowitem topic_right passive datarow `)
var topics_41 = []byte(`topic_sticky`)
var topics_42 = []byte(`topic_closed`)
var topics_43 = []byte(`">
var topics_42 = []byte(`topic_sticky`)
var topics_43 = []byte(`topic_closed`)
var topics_44 = []byte(`">
<a href="`)
var topics_44 = []byte(`"><img src="`)
var topics_45 = []byte(`" height="64" alt="`)
var topics_46 = []byte(`'s Avatar" /></a>
var topics_45 = []byte(`"><img src="`)
var topics_46 = []byte(`" height="64" alt="`)
var topics_47 = []byte(`'s Avatar" title="`)
var topics_48 = []byte(`'s Avatar" /></a>
<span>
<a href="`)
var topics_47 = []byte(`" class="lastName" style="font-size: 14px;">`)
var topics_48 = []byte(`</a><br>
var topics_49 = []byte(`" class="lastName" style="font-size: 14px;">`)
var topics_50 = []byte(`</a><br>
<span class="rowsmall lastReplyAt">`)
var topics_49 = []byte(`</span>
var topics_51 = []byte(`</span>
</span>
</div>
</div>`)
var topics_50 = []byte(`<div class="rowitem passive">There aren't any topics yet.`)
var topics_51 = []byte(` <a href="/topics/create/">Start one?</a>`)
var topics_52 = []byte(`</div>`)
var topics_53 = []byte(`
var topics_52 = []byte(`<div class="rowitem passive">There aren't any topics yet.`)
var topics_53 = []byte(` <a href="/topics/create/">Start one?</a>`)
var topics_54 = []byte(`</div>`)
var topics_55 = []byte(`
</div>
</main>
@ -933,7 +977,7 @@ var forum_19 = []byte(`
<div id="forum_topic_create_form" class="rowblock topic_create_form quick_create_form" style="display: none;" aria-label="Quick Topic Form">
<form id="topic_create_form_form" enctype="multipart/form-data" action="/topic/create/submit/" method="post"></form>
<img class="little_row_avatar" src="`)
var forum_20 = []byte(`" height="64" alt="Your Avatar" />
var forum_20 = []byte(`" height="64" alt="Your Avatar" title="Your Avatar" />
<input form="topic_create_form_form" id="topic_board_input" name="topic-board" value="`)
var forum_21 = []byte(`" type="hidden">
<div class="main_form">
@ -977,48 +1021,50 @@ var forum_29 = []byte(`">
<a href="`)
var forum_30 = []byte(`"><img src="`)
var forum_31 = []byte(`" height="64" alt="`)
var forum_32 = []byte(`'s Avatar" /></a>
var forum_32 = []byte(`'s Avatar" title="`)
var forum_33 = []byte(`'s Avatar" /></a>
<span class="topic_inner_left">
<a class="rowtopic" href="`)
var forum_33 = []byte(`"><span>`)
var forum_34 = []byte(`</span></a>
var forum_34 = []byte(`"><span>`)
var forum_35 = []byte(`</span></a>
<br /><a class="rowsmall starter" href="`)
var forum_35 = []byte(`">`)
var forum_36 = []byte(`</a>
var forum_36 = []byte(`">`)
var forum_37 = []byte(`</a>
`)
var forum_37 = []byte(`<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E</span>`)
var forum_38 = []byte(`<span class="rowsmall topic_status_e topic_status_sticky" title="Status: Pinned"> | &#x1F4CD;&#xFE0E</span>`)
var forum_39 = []byte(`
var forum_38 = []byte(`<span class="rowsmall topic_status_e topic_status_closed" title="Status: Closed"> | &#x1F512;&#xFE0E</span>`)
var forum_39 = []byte(`<span class="rowsmall topic_status_e topic_status_sticky" title="Status: Pinned"> | &#x1F4CD;&#xFE0E</span>`)
var forum_40 = []byte(`
</span>
<span class="topic_inner_right rowsmall" style="float: right;">
<span class="replyCount">`)
var forum_40 = []byte(`</span><br />
var forum_41 = []byte(`</span><br />
<span class="likeCount">`)
var forum_41 = []byte(`</span>
var forum_42 = []byte(`</span>
</span>
</div>
<div class="rowitem topic_right passive datarow `)
var forum_42 = []byte(`topic_sticky`)
var forum_43 = []byte(`topic_closed`)
var forum_44 = []byte(`">
var forum_43 = []byte(`topic_sticky`)
var forum_44 = []byte(`topic_closed`)
var forum_45 = []byte(`">
<a href="`)
var forum_45 = []byte(`"><img src="`)
var forum_46 = []byte(`" height="64" alt="`)
var forum_47 = []byte(`'s Avatar" /></a>
var forum_46 = []byte(`"><img src="`)
var forum_47 = []byte(`" height="64" alt="`)
var forum_48 = []byte(`'s Avatar" title="`)
var forum_49 = []byte(`'s Avatar" /></a>
<span>
<a href="`)
var forum_48 = []byte(`" class="lastName" style="font-size: 14px;">`)
var forum_49 = []byte(`</a><br>
var forum_50 = []byte(`" class="lastName" style="font-size: 14px;">`)
var forum_51 = []byte(`</a><br>
<span class="rowsmall lastReplyAt">`)
var forum_50 = []byte(`</span>
var forum_52 = []byte(`</span>
</span>
</div>
</div>`)
var forum_51 = []byte(`<div class="rowitem passive">There aren't any topics in this forum yet.`)
var forum_52 = []byte(` <a href="/topics/create/`)
var forum_53 = []byte(`">Start one?</a>`)
var forum_54 = []byte(`</div>`)
var forum_55 = []byte(`
var forum_53 = []byte(`<div class="rowitem passive">There aren't any topics in this forum yet.`)
var forum_54 = []byte(` <a href="/topics/create/`)
var forum_55 = []byte(`">Start one?</a>`)
var forum_56 = []byte(`</div>`)
var forum_57 = []byte(`
</div>
</main>
`)

View File

@ -79,86 +79,128 @@ w.Write([]byte(tmpl_profile_vars.ProfileOwner.Avatar))
w.Write(profile_1)
w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name))
w.Write(profile_2)
if tmpl_profile_vars.ProfileOwner.Tag != "" {
w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name))
w.Write(profile_3)
w.Write([]byte(tmpl_profile_vars.ProfileOwner.Tag))
w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name))
w.Write(profile_4)
}
if tmpl_profile_vars.ProfileOwner.Tag != "" {
w.Write(profile_5)
if tmpl_profile_vars.CurrentUser.IsSuperMod && !tmpl_profile_vars.ProfileOwner.IsSuperMod {
w.Write([]byte(tmpl_profile_vars.ProfileOwner.Tag))
w.Write(profile_6)
if tmpl_profile_vars.ProfileOwner.IsBanned {
}
w.Write(profile_7)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
if tmpl_profile_vars.CurrentUser.IsSuperMod && !tmpl_profile_vars.ProfileOwner.IsSuperMod {
w.Write(profile_8)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
if tmpl_profile_vars.ProfileOwner.IsBanned {
w.Write(profile_9)
} else {
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_10)
}
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_11)
}
} else {
w.Write(profile_12)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_13)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_14)
if tmpl_profile_vars.CurrentUser.Perms.BanUsers {
w.Write(profile_15)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_16)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_17)
w.Write(profile_18)
}
w.Write(profile_13)
}
w.Write(profile_14)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_15)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_16)
if tmpl_profile_vars.CurrentUser.Perms.BanUsers {
w.Write(profile_17)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_18)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_19)
w.Write(profile_20)
}
w.Write(profile_21)
if tmpl_profile_vars.Header.Theme.BgAvatars {
if len(tmpl_profile_vars.ItemList) != 0 {
for _, item := range tmpl_profile_vars.ItemList {
w.Write(profile_20)
w.Write(profile_comments_row_0)
w.Write([]byte(item.ClassName))
w.Write(profile_21)
w.Write(profile_comments_row_1)
w.Write([]byte(item.Avatar))
w.Write(profile_22)
w.Write(profile_comments_row_2)
if item.ContentLines <= 5 {
w.Write(profile_23)
w.Write(profile_comments_row_3)
}
w.Write(profile_24)
w.Write([]byte(item.Avatar))
w.Write(profile_25)
w.Write(profile_comments_row_4)
w.Write([]byte(item.ContentHtml))
w.Write(profile_26)
w.Write(profile_comments_row_5)
w.Write([]byte(item.UserLink))
w.Write(profile_27)
w.Write(profile_comments_row_6)
w.Write([]byte(item.CreatedByName))
w.Write(profile_28)
w.Write(profile_comments_row_7)
if tmpl_profile_vars.CurrentUser.IsMod {
w.Write(profile_29)
w.Write(profile_comments_row_8)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_30)
w.Write(profile_comments_row_9)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_31)
w.Write(profile_comments_row_10)
}
w.Write(profile_32)
w.Write(profile_comments_row_11)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_33)
w.Write(profile_comments_row_12)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_34)
w.Write(profile_comments_row_13)
if item.Tag != "" {
w.Write(profile_35)
w.Write(profile_comments_row_14)
w.Write([]byte(item.Tag))
w.Write(profile_36)
w.Write(profile_comments_row_15)
}
w.Write(profile_37)
w.Write(profile_comments_row_16)
}
}
w.Write(profile_38)
} else {
if len(tmpl_profile_vars.ItemList) != 0 {
for _, item := range tmpl_profile_vars.ItemList {
w.Write(profile_comments_row_17)
w.Write([]byte(item.ClassName))
w.Write(profile_comments_row_18)
w.Write([]byte(item.Avatar))
w.Write(profile_comments_row_19)
w.Write([]byte(item.CreatedByName))
w.Write(profile_comments_row_20)
w.Write([]byte(item.CreatedByName))
w.Write(profile_comments_row_21)
w.Write([]byte(item.UserLink))
w.Write(profile_comments_row_22)
w.Write([]byte(item.CreatedByName))
w.Write(profile_comments_row_23)
if item.Tag != "" {
w.Write(profile_comments_row_24)
w.Write([]byte(item.Tag))
w.Write(profile_comments_row_25)
}
w.Write(profile_comments_row_26)
w.Write([]byte(item.ContentHtml))
w.Write(profile_comments_row_27)
if tmpl_profile_vars.CurrentUser.IsMod {
w.Write(profile_comments_row_28)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_comments_row_29)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_comments_row_30)
}
w.Write(profile_comments_row_31)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(profile_comments_row_32)
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
w.Write(profile_comments_row_33)
}
}
}
w.Write(profile_22)
if !tmpl_profile_vars.CurrentUser.IsBanned {
w.Write(profile_39)
w.Write(profile_23)
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
w.Write(profile_40)
w.Write(profile_24)
}
w.Write(profile_41)
w.Write(profile_42)
w.Write(profile_25)
w.Write(profile_26)
w.Write(footer_0)
w.Write([]byte(common.BuildWidget("footer",tmpl_profile_vars.Header)))
w.Write(footer_1)

View File

@ -135,62 +135,66 @@ w.Write([]byte(item.Creator.Avatar))
w.Write(topics_26)
w.Write([]byte(item.Creator.Name))
w.Write(topics_27)
w.Write([]byte(item.Link))
w.Write(topics_28)
w.Write([]byte(item.Title))
w.Write(topics_29)
if item.ForumName != "" {
w.Write(topics_30)
w.Write([]byte(item.ForumLink))
w.Write(topics_31)
w.Write([]byte(item.ForumName))
w.Write(topics_32)
}
w.Write(topics_33)
w.Write([]byte(item.Creator.Link))
w.Write(topics_34)
w.Write([]byte(item.Creator.Name))
w.Write(topics_35)
if item.IsClosed {
w.Write(topics_36)
w.Write(topics_28)
w.Write([]byte(item.Link))
w.Write(topics_29)
w.Write([]byte(item.Title))
w.Write(topics_30)
if item.ForumName != "" {
w.Write(topics_31)
w.Write([]byte(item.ForumLink))
w.Write(topics_32)
w.Write([]byte(item.ForumName))
w.Write(topics_33)
}
if item.Sticky {
w.Write(topics_34)
w.Write([]byte(item.Creator.Link))
w.Write(topics_35)
w.Write([]byte(item.Creator.Name))
w.Write(topics_36)
if item.IsClosed {
w.Write(topics_37)
}
w.Write(topics_38)
w.Write([]byte(strconv.Itoa(item.PostCount)))
w.Write(topics_39)
w.Write([]byte(strconv.Itoa(item.LikeCount)))
w.Write(topics_40)
if item.Sticky {
w.Write(topics_38)
}
w.Write(topics_39)
w.Write([]byte(strconv.Itoa(item.PostCount)))
w.Write(topics_40)
w.Write([]byte(strconv.Itoa(item.LikeCount)))
w.Write(topics_41)
if item.Sticky {
w.Write(topics_42)
} else {
if item.IsClosed {
w.Write(topics_42)
}
}
w.Write(topics_43)
w.Write([]byte(item.LastUser.Link))
}
}
w.Write(topics_44)
w.Write([]byte(item.LastUser.Avatar))
w.Write(topics_45)
w.Write([]byte(item.LastUser.Name))
w.Write(topics_46)
w.Write([]byte(item.LastUser.Link))
w.Write(topics_45)
w.Write([]byte(item.LastUser.Avatar))
w.Write(topics_46)
w.Write([]byte(item.LastUser.Name))
w.Write(topics_47)
w.Write([]byte(item.LastUser.Name))
w.Write(topics_48)
w.Write([]byte(item.RelativeLastReplyAt))
w.Write([]byte(item.LastUser.Link))
w.Write(topics_49)
}
} else {
w.Write([]byte(item.LastUser.Name))
w.Write(topics_50)
if tmpl_topics_vars.CurrentUser.Perms.CreateTopic {
w.Write([]byte(item.RelativeLastReplyAt))
w.Write(topics_51)
}
} else {
w.Write(topics_52)
}
if tmpl_topics_vars.CurrentUser.Perms.CreateTopic {
w.Write(topics_53)
}
w.Write(topics_54)
}
w.Write(topics_55)
w.Write(footer_0)
w.Write([]byte(common.BuildWidget("footer",tmpl_topics_vars.Header)))
w.Write(footer_1)

View File

@ -39,7 +39,7 @@
{{if .CurrentUser.Perms.CreateTopic}}
<div id="forum_topic_create_form" class="rowblock topic_create_form quick_create_form" style="display: none;" aria-label="Quick Topic Form">
<form id="topic_create_form_form" enctype="multipart/form-data" action="/topic/create/submit/" method="post"></form>
<img class="little_row_avatar" src="{{.CurrentUser.Avatar}}" height="64" alt="Your Avatar" />
<img class="little_row_avatar" src="{{.CurrentUser.Avatar}}" height="64" alt="Your Avatar" title="Your Avatar" />
<input form="topic_create_form_form" id="topic_board_input" name="topic-board" value="{{.Forum.ID}}" type="hidden">
<div class="main_form">
<div class="topic_meta">
@ -72,7 +72,7 @@
{{range .ItemList}}<div class="topic_row" data-tid="{{.ID}}">
<div class="rowitem topic_left passive datarow {{if .Sticky}}topic_sticky{{else if .IsClosed}}topic_closed{{end}}">
<span class="selector"></span>
<a href="{{.Creator.Link}}"><img src="{{.Creator.Avatar}}" height="64" alt="{{.Creator.Avatar}}'s Avatar" /></a>
<a href="{{.Creator.Link}}"><img src="{{.Creator.Avatar}}" height="64" alt="{{.Creator.Name}}'s Avatar" title="{{.Creator.Name}}'s Avatar" /></a>
<span class="topic_inner_left">
<a class="rowtopic" href="{{.Link}}"><span>{{.Title}}</span></a>
<br /><a class="rowsmall starter" href="{{.Creator.Link}}">{{.Creator.Name}}</a>
@ -86,7 +86,7 @@
</span>
</div>
<div class="rowitem topic_right passive datarow {{if .Sticky}}topic_sticky{{else if .IsClosed}}topic_closed{{end}}">
<a href="{{.LastUser.Link}}"><img src="{{.LastUser.Avatar}}" height="64" alt="{{.LastUser.Name}}'s Avatar" /></a>
<a href="{{.LastUser.Link}}"><img src="{{.LastUser.Avatar}}" height="64" alt="{{.LastUser.Name}}'s Avatar" title="{{.LastUser.Name}}'s Avatar" /></a>
<span>
<a href="{{.LastUser.Link}}" class="lastName" style="font-size: 14px;">{{.LastUser.Name}}</a><br>
<span class="rowsmall lastReplyAt">{{.RelativeLastReplyAt}}</span>

View File

@ -16,7 +16,7 @@
</span>
<span class="forum_right shift_right">
{{if .LastReplyer.Avatar}}<img class="extra_little_row_avatar" src="{{.LastReplyer.Avatar}}" height=64 width=64 />{{end}}
{{if .LastReplyer.Avatar}}<img class="extra_little_row_avatar" src="{{.LastReplyer.Avatar}}" height=64 width=64 alt="{{.LastReplyer.Name}}'s Avatar" title="{{.LastReplyer.Name}}'s Avatar" />{{end}}
<span>
<a href="{{.LastTopic.Link}}">{{if .LastTopic.Title}}{{.LastTopic.Title}}{{else}}None{{end}}</a>
{{if .LastTopicTime}}<br /><span class="rowsmall">{{.LastTopicTime}}</span>{{end}}

View File

@ -14,7 +14,7 @@
<div class="formitem"><input name="password" type="password" autocomplete="current-password" placeholder="*****" required /></div>
</div>
<div class="formrow">
<div class="formitem"><button name="login-button" class="formbutton">Login</div>
<div class="formitem"><button name="login-button" class="formbutton">Login</button></div>
<div class="formitem" style="color: #505050; font-size: 12px; font-weight: normal; float: right;">Don't have an account?</div>
</div>
</form>

View File

@ -6,7 +6,7 @@
<div id="profile_left_pane" class="rowmenu">
<div class="topBlock">
<div class="rowitem avatarRow">
<img src="{{.ProfileOwner.Avatar}}" class="avatar" />
<img src="{{.ProfileOwner.Avatar}}" class="avatar" alt="{{.ProfileOwner.Name}}'s Avatar" title="{{.ProfileOwner.Name}}'s Avatar" />
</div>
<div class="rowitem nameRow">
<span class="profileName">{{.ProfileOwner.Name}}</span>{{if .ProfileOwner.Tag}}<span class="username">{{.ProfileOwner.Tag}}</span>{{end}}
@ -69,23 +69,9 @@
<div id="profile_comments_head" class="colstack_item colstack_head hash_hide">
<div class="rowitem"><h1>Comments</h1></div>
</div>
<div id="profile_comments" class="colstack_item hash_hide">{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent simple {{.ClassName}}" style="background-image: url({{.Avatar}}), url(/static/post-avatar-bg.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;">
<img class="bgsub" src="{{.Avatar}}" />
<span class="editable_block user_content simple">{{.ContentHtml}}</span>
<span class="controls">
<a href="{{.UserLink}}" class="real_username username">{{.CreatedByName}}</a>&nbsp;&nbsp;
{{if $.CurrentUser.IsMod}}<a href="/profile/reply/edit/submit/{{.ID}}" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/{{.ID}}" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>{{end}}
<a class="mod_button" href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=user-reply"><button class="username report_item flag_label"></button></a>
{{if .Tag}}<a class="username hide_on_mobile user_tag" style="float: right;">{{.Tag}}</a>{{end}}
</span>
</div>
{{end}}</div>
<div id="profile_comments" class="colstack_item hash_hide">
{{template "profile_comments_row.html" . }}
</div>
{{if not .CurrentUser.IsBanned}}
<form id="profile_comments_form" class="hash_hide" action="/profile/reply/create/" method="post">

View File

@ -0,0 +1,42 @@
{{/** TODO: Temporary hack until we find a more granular way of doing this. Perhaps, a custom include function? **/}}
{{if .Header.Theme.BgAvatars}}
{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent simple {{.ClassName}}" style="background-image: url({{.Avatar}}), url(/static/post-avatar-bg.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;">
<span class="editable_block user_content simple">{{.ContentHtml}}</span>
<span class="controls">
<a href="{{.UserLink}}" class="real_username username">{{.CreatedByName}}</a>&nbsp;&nbsp;
{{if $.CurrentUser.IsMod}}<a href="/profile/reply/edit/submit/{{.ID}}" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/{{.ID}}" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>{{end}}
<a class="mod_button" href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=user-reply"><button class="username report_item flag_label"></button></a>
{{if .Tag}}<a class="username hide_on_mobile user_tag" style="float: right;">{{.Tag}}</a>{{end}}
</span>
</div>
{{end}}
{{else}}
{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent comment {{.ClassName}}">
<div class="userbit">
<img src="{{.Avatar}}" alt="{{.CreatedByName}}'s Avatar" title="{{.CreatedByName}}'s Avatar" />
<span class="nameAndTitle">
<a href="{{.UserLink}}" class="real_username username">{{.CreatedByName}}</a>
{{if .Tag}}<a class="username hide_on_mobile user_tag" style="float: right;">{{.Tag}}</a>{{end}}
</span>
</div>
<div class="content_column">
<span class="editable_block user_content">{{.ContentHtml}}</span>
<span class="controls">
{{if $.CurrentUser.IsMod}}
<a href="/profile/reply/edit/submit/{{.ID}}" class="mod_button" title="Edit Item"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/{{.ID}}" class="mod_button" title="Delete Item"><button class="username delete_item trash_label"></button></a>
{{end}}
<a class="mod_button" href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=user-reply"><button class="username report_item flag_label"></button></a>
</span>
</div>
</div>
{{end}}
{{end}}

View File

@ -22,7 +22,7 @@
<div class="formitem"><input name="confirm_password" type="password" placeholder="*****" aria-labelledby="confirm_password_label" required /></div>
</div>
<div class="formrow">
<div class="formitem"><button name="register-button" class="formbutton">Create Account</div></div>
<div class="formitem"><button name="register-button" class="formbutton">Create Account</button></div>
</div>
</form>
</div>

View File

@ -35,7 +35,7 @@
{{if .ForumList}}
<div class="rowblock topic_create_form quick_create_form" style="display: none;" aria-label="Quick Topic Form">
<form name="topic_create_form_form" id="topic_create_form_form" enctype="multipart/form-data" action="/topic/create/submit/" method="post"></form>
<img class="little_row_avatar" src="{{.CurrentUser.Avatar}}" height="64" alt="Your Avatar" />
<img class="little_row_avatar" src="{{.CurrentUser.Avatar}}" height="64" alt="Your Avatar" title="Your Avatar" />
<div class="main_form">
<div class="topic_meta">
<div class="formrow topic_board_row real_first_child">
@ -72,7 +72,7 @@
{{range .TopicList}}<div class="topic_row" data-tid="{{.ID}}">
<div class="rowitem topic_left passive datarow {{if .Sticky}}topic_sticky{{else if .IsClosed}}topic_closed{{end}}">
<span class="selector"></span>
<a href="{{.Creator.Link}}"><img src="{{.Creator.Avatar}}" height="64" alt="{{.Creator.Name}}'s Avatar" /></a>
<a href="{{.Creator.Link}}"><img src="{{.Creator.Avatar}}" height="64" alt="{{.Creator.Name}}'s Avatar" title="{{.Creator.Name}}'s Avatar" /></a>
<span class="topic_inner_left">
<a class="rowtopic" href="{{.Link}}"><span>{{.Title}}</span></a> {{if .ForumName}}<a class="rowsmall parent_forum" href="{{.ForumLink}}">{{.ForumName}}</a>{{end}}
<br /><a class="rowsmall starter" href="{{.Creator.Link}}">{{.Creator.Name}}</a>
@ -86,7 +86,7 @@
</span>
</div>
<div class="rowitem topic_right passive datarow {{if .Sticky}}topic_sticky{{else if .IsClosed}}topic_closed{{end}}">
<a href="{{.LastUser.Link}}"><img src="{{.LastUser.Avatar}}" height="64" alt="{{.LastUser.Name}}'s Avatar" /></a>
<a href="{{.LastUser.Link}}"><img src="{{.LastUser.Avatar}}" height="64" alt="{{.LastUser.Name}}'s Avatar" title="{{.LastUser.Name}}'s Avatar" /></a>
<span>
<a href="{{.LastUser.Link}}" class="lastName" style="font-size: 14px;">{{.LastUser.Name}}</a><br>
<span class="rowsmall lastReplyAt">{{.RelativeLastReplyAt}}</span>

View File

@ -929,6 +929,22 @@ select, input, textarea, button {
#profile_comments .rowitem {
background-image: none !important;
}
#profile_comments .comment .userbit {
display: flex;
margin-left: 14px;
margin-top: 14px;
margin-bottom: 8px;
}
#profile_comments .comment img {
width: 40px;
height: 40px;
border-radius: 62px;
margin-right: 8px;
}
#profile_comments .comment .nameAndTitle {
display: flex;
flex-direction: column;
}
.colstack_item .formrow {
display: flex;

View File

@ -5,6 +5,7 @@
"Creator": "Azareal",
"FullImage": "shadow.png",
"URL": "github.com/Azareal/Gosora",
"BgAvatars":true,
"Resources": [
{
"Name":"shadow/misc.js",

View File

@ -7,6 +7,7 @@
"ForkOf": "tempra-simple",
"MobileFriendly": true,
"HideFromThemes": true,
"BgAvatars":true,
"URL": "github.com/Azareal/Gosora",
"Docks":["rightSidebar"]
}

View File

@ -6,6 +6,7 @@
"FullImage": "tempra-simple.png",
"MobileFriendly": true,
"URL": "github.com/Azareal/Gosora",
"BgAvatars":true,
"Docks":["rightSidebar"],
"Resources": [
{