diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e16e851..74d7fff7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,8 @@ Other uses may arise in the future, e.g. commercial licensing, although that's c Try to prefix commits which introduce a lot of bugs or otherwise has a large impact on the usability of Gosora with UNSTABLE. +If anything seems suspect, then feel free to bring up an alternative, although I'd rather not get hung up on the little details, if it's something which is purely a matter of opinion. + # Coding Standards All code must be unit tested where ever possible with the exception of JavaScript which is untestable with our current technologies, tread with caution there. @@ -32,6 +34,8 @@ Always use strict mode. Don't worry about ES5, we're targetting modern browsers. If we decide to backport code to older browsers, then we'll transpile the files. +Please don't use await. It incurs too much of a cognitive overhead as to where and when you can use it. + To keep consistency with Go code, variables must be camelCase. # JSON diff --git a/README.md b/README.md index 741288f7..8d6a10fe 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Other modern features like alerts, likes, advanced dashboard with live stats (CP Go 1.10 or newer - You will need to install this. Pick the .msi, if you want everything sorted out for you rather than having to go around updating the environment settings. https://golang.org/doc/install -Git - You may need this for downloading updates via the updater. More to come on this here. https://git-scm.com/downloads +Git - You may need this for downloading updates via the updater. You might already have this installed on your server. More to come on this here. https://git-scm.com/downloads MySQL Database - You will need to setup a MySQL Database somewhere. A MariaDB Database works equally well and is much faster than MySQL. You could use something like WNMP / XAMPP which have a little PHP script called PhpMyAdmin for managing MySQL databases or you could install MariaDB directly. diff --git a/common/utils.go b/common/utils.go index 04f44261..e9f523dd 100644 --- a/common/utils.go +++ b/common/utils.go @@ -247,7 +247,7 @@ func NameToSlug(name string) (slug string) { func HasSuspiciousEmail(email string) bool { lowEmail := strings.ToLower(email) // TODO: Use a more flexible blacklist, perhaps with a similar mechanism to the HTML tag registration system in PreparseMessage() - if strings.Contains(lowEmail, "casino") || strings.Contains(lowEmail, "viagra") { + if strings.Contains(lowEmail, "casino") || strings.Contains(lowEmail, "viagra") || strings.Contains(lowEmail, "pharma") || strings.Contains(lowEmail, "pill") { return true } diff --git a/gen_router.go b/gen_router.go index 1a9d1434..f44292f2 100644 --- a/gen_router.go +++ b/gen_router.go @@ -28,6 +28,7 @@ var RouteMap = map[string]interface{}{ "routes.ShowAttachment": routes.ShowAttachment, "common.RouteWebsockets": common.RouteWebsockets, "routeAPIPhrases": routeAPIPhrases, + "routeJSAntispam": routeJSAntispam, "routeAPI": routeAPI, "routes.ReportSubmit": routes.ReportSubmit, "routes.CreateTopic": routes.CreateTopic, @@ -156,122 +157,123 @@ var routeMapEnum = map[string]int{ "routes.ShowAttachment": 5, "common.RouteWebsockets": 6, "routeAPIPhrases": 7, - "routeAPI": 8, - "routes.ReportSubmit": 9, - "routes.CreateTopic": 10, - "routes.TopicList": 11, - "panel.Forums": 12, - "panel.ForumsCreateSubmit": 13, - "panel.ForumsDelete": 14, - "panel.ForumsDeleteSubmit": 15, - "panel.ForumsEdit": 16, - "panel.ForumsEditSubmit": 17, - "panel.ForumsEditPermsSubmit": 18, - "panel.ForumsEditPermsAdvance": 19, - "panel.ForumsEditPermsAdvanceSubmit": 20, - "panel.Settings": 21, - "panel.SettingEdit": 22, - "panel.SettingEditSubmit": 23, - "routePanelWordFilters": 24, - "routePanelWordFiltersCreateSubmit": 25, - "routePanelWordFiltersEdit": 26, - "routePanelWordFiltersEditSubmit": 27, - "routePanelWordFiltersDeleteSubmit": 28, - "panel.Pages": 29, - "panel.PagesCreateSubmit": 30, - "panel.PagesEdit": 31, - "panel.PagesEditSubmit": 32, - "panel.PagesDeleteSubmit": 33, - "routePanelThemes": 34, - "routePanelThemesSetDefault": 35, - "routePanelThemesMenus": 36, - "routePanelThemesMenusEdit": 37, - "routePanelThemesMenuItemEdit": 38, - "routePanelThemesMenuItemEditSubmit": 39, - "routePanelThemesMenuItemCreateSubmit": 40, - "routePanelThemesMenuItemDeleteSubmit": 41, - "routePanelThemesMenuItemOrderSubmit": 42, - "routePanelPlugins": 43, - "routePanelPluginsActivate": 44, - "routePanelPluginsDeactivate": 45, - "routePanelPluginsInstall": 46, - "panel.Users": 47, - "panel.UsersEdit": 48, - "panel.UsersEditSubmit": 49, - "panel.AnalyticsViews": 50, - "panel.AnalyticsRoutes": 51, - "panel.AnalyticsAgents": 52, - "panel.AnalyticsSystems": 53, - "panel.AnalyticsLanguages": 54, - "panel.AnalyticsReferrers": 55, - "panel.AnalyticsRouteViews": 56, - "panel.AnalyticsAgentViews": 57, - "panel.AnalyticsForumViews": 58, - "panel.AnalyticsSystemViews": 59, - "panel.AnalyticsLanguageViews": 60, - "panel.AnalyticsReferrerViews": 61, - "panel.AnalyticsPosts": 62, - "panel.AnalyticsTopics": 63, - "panel.AnalyticsForums": 64, - "routePanelGroups": 65, - "routePanelGroupsEdit": 66, - "routePanelGroupsEditPerms": 67, - "routePanelGroupsEditSubmit": 68, - "routePanelGroupsEditPermsSubmit": 69, - "routePanelGroupsCreateSubmit": 70, - "panel.Backups": 71, - "panel.LogsRegs": 72, - "panel.LogsMod": 73, - "panel.Debug": 74, - "routePanelDashboard": 75, - "routes.AccountEdit": 76, - "routes.AccountEditPassword": 77, - "routes.AccountEditPasswordSubmit": 78, - "routes.AccountEditAvatarSubmit": 79, - "routes.AccountEditUsernameSubmit": 80, - "routes.AccountEditMFA": 81, - "routes.AccountEditMFASetup": 82, - "routes.AccountEditMFASetupSubmit": 83, - "routes.AccountEditMFADisableSubmit": 84, - "routes.AccountEditEmail": 85, - "routes.AccountEditEmailTokenSubmit": 86, - "routes.ViewProfile": 87, - "routes.BanUserSubmit": 88, - "routes.UnbanUser": 89, - "routes.ActivateUser": 90, - "routes.IPSearch": 91, - "routes.CreateTopicSubmit": 92, - "routes.EditTopicSubmit": 93, - "routes.DeleteTopicSubmit": 94, - "routes.StickTopicSubmit": 95, - "routes.UnstickTopicSubmit": 96, - "routes.LockTopicSubmit": 97, - "routes.UnlockTopicSubmit": 98, - "routes.MoveTopicSubmit": 99, - "routes.LikeTopicSubmit": 100, - "routes.ViewTopic": 101, - "routes.CreateReplySubmit": 102, - "routes.ReplyEditSubmit": 103, - "routes.ReplyDeleteSubmit": 104, - "routes.ReplyLikeSubmit": 105, - "routes.ProfileReplyCreateSubmit": 106, - "routes.ProfileReplyEditSubmit": 107, - "routes.ProfileReplyDeleteSubmit": 108, - "routes.PollVote": 109, - "routes.PollResults": 110, - "routes.AccountLogin": 111, - "routes.AccountRegister": 112, - "routes.AccountLogout": 113, - "routes.AccountLoginSubmit": 114, - "routes.AccountLoginMFAVerify": 115, - "routes.AccountLoginMFAVerifySubmit": 116, - "routes.AccountRegisterSubmit": 117, - "routes.DynamicRoute": 118, - "routes.UploadedFile": 119, - "routes.StaticFile": 120, - "routes.RobotsTxt": 121, - "routes.SitemapXml": 122, - "routes.BadRoute": 123, + "routeJSAntispam": 8, + "routeAPI": 9, + "routes.ReportSubmit": 10, + "routes.CreateTopic": 11, + "routes.TopicList": 12, + "panel.Forums": 13, + "panel.ForumsCreateSubmit": 14, + "panel.ForumsDelete": 15, + "panel.ForumsDeleteSubmit": 16, + "panel.ForumsEdit": 17, + "panel.ForumsEditSubmit": 18, + "panel.ForumsEditPermsSubmit": 19, + "panel.ForumsEditPermsAdvance": 20, + "panel.ForumsEditPermsAdvanceSubmit": 21, + "panel.Settings": 22, + "panel.SettingEdit": 23, + "panel.SettingEditSubmit": 24, + "routePanelWordFilters": 25, + "routePanelWordFiltersCreateSubmit": 26, + "routePanelWordFiltersEdit": 27, + "routePanelWordFiltersEditSubmit": 28, + "routePanelWordFiltersDeleteSubmit": 29, + "panel.Pages": 30, + "panel.PagesCreateSubmit": 31, + "panel.PagesEdit": 32, + "panel.PagesEditSubmit": 33, + "panel.PagesDeleteSubmit": 34, + "routePanelThemes": 35, + "routePanelThemesSetDefault": 36, + "routePanelThemesMenus": 37, + "routePanelThemesMenusEdit": 38, + "routePanelThemesMenuItemEdit": 39, + "routePanelThemesMenuItemEditSubmit": 40, + "routePanelThemesMenuItemCreateSubmit": 41, + "routePanelThemesMenuItemDeleteSubmit": 42, + "routePanelThemesMenuItemOrderSubmit": 43, + "routePanelPlugins": 44, + "routePanelPluginsActivate": 45, + "routePanelPluginsDeactivate": 46, + "routePanelPluginsInstall": 47, + "panel.Users": 48, + "panel.UsersEdit": 49, + "panel.UsersEditSubmit": 50, + "panel.AnalyticsViews": 51, + "panel.AnalyticsRoutes": 52, + "panel.AnalyticsAgents": 53, + "panel.AnalyticsSystems": 54, + "panel.AnalyticsLanguages": 55, + "panel.AnalyticsReferrers": 56, + "panel.AnalyticsRouteViews": 57, + "panel.AnalyticsAgentViews": 58, + "panel.AnalyticsForumViews": 59, + "panel.AnalyticsSystemViews": 60, + "panel.AnalyticsLanguageViews": 61, + "panel.AnalyticsReferrerViews": 62, + "panel.AnalyticsPosts": 63, + "panel.AnalyticsTopics": 64, + "panel.AnalyticsForums": 65, + "routePanelGroups": 66, + "routePanelGroupsEdit": 67, + "routePanelGroupsEditPerms": 68, + "routePanelGroupsEditSubmit": 69, + "routePanelGroupsEditPermsSubmit": 70, + "routePanelGroupsCreateSubmit": 71, + "panel.Backups": 72, + "panel.LogsRegs": 73, + "panel.LogsMod": 74, + "panel.Debug": 75, + "routePanelDashboard": 76, + "routes.AccountEdit": 77, + "routes.AccountEditPassword": 78, + "routes.AccountEditPasswordSubmit": 79, + "routes.AccountEditAvatarSubmit": 80, + "routes.AccountEditUsernameSubmit": 81, + "routes.AccountEditMFA": 82, + "routes.AccountEditMFASetup": 83, + "routes.AccountEditMFASetupSubmit": 84, + "routes.AccountEditMFADisableSubmit": 85, + "routes.AccountEditEmail": 86, + "routes.AccountEditEmailTokenSubmit": 87, + "routes.ViewProfile": 88, + "routes.BanUserSubmit": 89, + "routes.UnbanUser": 90, + "routes.ActivateUser": 91, + "routes.IPSearch": 92, + "routes.CreateTopicSubmit": 93, + "routes.EditTopicSubmit": 94, + "routes.DeleteTopicSubmit": 95, + "routes.StickTopicSubmit": 96, + "routes.UnstickTopicSubmit": 97, + "routes.LockTopicSubmit": 98, + "routes.UnlockTopicSubmit": 99, + "routes.MoveTopicSubmit": 100, + "routes.LikeTopicSubmit": 101, + "routes.ViewTopic": 102, + "routes.CreateReplySubmit": 103, + "routes.ReplyEditSubmit": 104, + "routes.ReplyDeleteSubmit": 105, + "routes.ReplyLikeSubmit": 106, + "routes.ProfileReplyCreateSubmit": 107, + "routes.ProfileReplyEditSubmit": 108, + "routes.ProfileReplyDeleteSubmit": 109, + "routes.PollVote": 110, + "routes.PollResults": 111, + "routes.AccountLogin": 112, + "routes.AccountRegister": 113, + "routes.AccountLogout": 114, + "routes.AccountLoginSubmit": 115, + "routes.AccountLoginMFAVerify": 116, + "routes.AccountLoginMFAVerifySubmit": 117, + "routes.AccountRegisterSubmit": 118, + "routes.DynamicRoute": 119, + "routes.UploadedFile": 120, + "routes.StaticFile": 121, + "routes.RobotsTxt": 122, + "routes.SitemapXml": 123, + "routes.BadRoute": 124, } var reverseRouteMapEnum = map[int]string{ 0: "routes.Overview", @@ -282,122 +284,123 @@ var reverseRouteMapEnum = map[int]string{ 5: "routes.ShowAttachment", 6: "common.RouteWebsockets", 7: "routeAPIPhrases", - 8: "routeAPI", - 9: "routes.ReportSubmit", - 10: "routes.CreateTopic", - 11: "routes.TopicList", - 12: "panel.Forums", - 13: "panel.ForumsCreateSubmit", - 14: "panel.ForumsDelete", - 15: "panel.ForumsDeleteSubmit", - 16: "panel.ForumsEdit", - 17: "panel.ForumsEditSubmit", - 18: "panel.ForumsEditPermsSubmit", - 19: "panel.ForumsEditPermsAdvance", - 20: "panel.ForumsEditPermsAdvanceSubmit", - 21: "panel.Settings", - 22: "panel.SettingEdit", - 23: "panel.SettingEditSubmit", - 24: "routePanelWordFilters", - 25: "routePanelWordFiltersCreateSubmit", - 26: "routePanelWordFiltersEdit", - 27: "routePanelWordFiltersEditSubmit", - 28: "routePanelWordFiltersDeleteSubmit", - 29: "panel.Pages", - 30: "panel.PagesCreateSubmit", - 31: "panel.PagesEdit", - 32: "panel.PagesEditSubmit", - 33: "panel.PagesDeleteSubmit", - 34: "routePanelThemes", - 35: "routePanelThemesSetDefault", - 36: "routePanelThemesMenus", - 37: "routePanelThemesMenusEdit", - 38: "routePanelThemesMenuItemEdit", - 39: "routePanelThemesMenuItemEditSubmit", - 40: "routePanelThemesMenuItemCreateSubmit", - 41: "routePanelThemesMenuItemDeleteSubmit", - 42: "routePanelThemesMenuItemOrderSubmit", - 43: "routePanelPlugins", - 44: "routePanelPluginsActivate", - 45: "routePanelPluginsDeactivate", - 46: "routePanelPluginsInstall", - 47: "panel.Users", - 48: "panel.UsersEdit", - 49: "panel.UsersEditSubmit", - 50: "panel.AnalyticsViews", - 51: "panel.AnalyticsRoutes", - 52: "panel.AnalyticsAgents", - 53: "panel.AnalyticsSystems", - 54: "panel.AnalyticsLanguages", - 55: "panel.AnalyticsReferrers", - 56: "panel.AnalyticsRouteViews", - 57: "panel.AnalyticsAgentViews", - 58: "panel.AnalyticsForumViews", - 59: "panel.AnalyticsSystemViews", - 60: "panel.AnalyticsLanguageViews", - 61: "panel.AnalyticsReferrerViews", - 62: "panel.AnalyticsPosts", - 63: "panel.AnalyticsTopics", - 64: "panel.AnalyticsForums", - 65: "routePanelGroups", - 66: "routePanelGroupsEdit", - 67: "routePanelGroupsEditPerms", - 68: "routePanelGroupsEditSubmit", - 69: "routePanelGroupsEditPermsSubmit", - 70: "routePanelGroupsCreateSubmit", - 71: "panel.Backups", - 72: "panel.LogsRegs", - 73: "panel.LogsMod", - 74: "panel.Debug", - 75: "routePanelDashboard", - 76: "routes.AccountEdit", - 77: "routes.AccountEditPassword", - 78: "routes.AccountEditPasswordSubmit", - 79: "routes.AccountEditAvatarSubmit", - 80: "routes.AccountEditUsernameSubmit", - 81: "routes.AccountEditMFA", - 82: "routes.AccountEditMFASetup", - 83: "routes.AccountEditMFASetupSubmit", - 84: "routes.AccountEditMFADisableSubmit", - 85: "routes.AccountEditEmail", - 86: "routes.AccountEditEmailTokenSubmit", - 87: "routes.ViewProfile", - 88: "routes.BanUserSubmit", - 89: "routes.UnbanUser", - 90: "routes.ActivateUser", - 91: "routes.IPSearch", - 92: "routes.CreateTopicSubmit", - 93: "routes.EditTopicSubmit", - 94: "routes.DeleteTopicSubmit", - 95: "routes.StickTopicSubmit", - 96: "routes.UnstickTopicSubmit", - 97: "routes.LockTopicSubmit", - 98: "routes.UnlockTopicSubmit", - 99: "routes.MoveTopicSubmit", - 100: "routes.LikeTopicSubmit", - 101: "routes.ViewTopic", - 102: "routes.CreateReplySubmit", - 103: "routes.ReplyEditSubmit", - 104: "routes.ReplyDeleteSubmit", - 105: "routes.ReplyLikeSubmit", - 106: "routes.ProfileReplyCreateSubmit", - 107: "routes.ProfileReplyEditSubmit", - 108: "routes.ProfileReplyDeleteSubmit", - 109: "routes.PollVote", - 110: "routes.PollResults", - 111: "routes.AccountLogin", - 112: "routes.AccountRegister", - 113: "routes.AccountLogout", - 114: "routes.AccountLoginSubmit", - 115: "routes.AccountLoginMFAVerify", - 116: "routes.AccountLoginMFAVerifySubmit", - 117: "routes.AccountRegisterSubmit", - 118: "routes.DynamicRoute", - 119: "routes.UploadedFile", - 120: "routes.StaticFile", - 121: "routes.RobotsTxt", - 122: "routes.SitemapXml", - 123: "routes.BadRoute", + 8: "routeJSAntispam", + 9: "routeAPI", + 10: "routes.ReportSubmit", + 11: "routes.CreateTopic", + 12: "routes.TopicList", + 13: "panel.Forums", + 14: "panel.ForumsCreateSubmit", + 15: "panel.ForumsDelete", + 16: "panel.ForumsDeleteSubmit", + 17: "panel.ForumsEdit", + 18: "panel.ForumsEditSubmit", + 19: "panel.ForumsEditPermsSubmit", + 20: "panel.ForumsEditPermsAdvance", + 21: "panel.ForumsEditPermsAdvanceSubmit", + 22: "panel.Settings", + 23: "panel.SettingEdit", + 24: "panel.SettingEditSubmit", + 25: "routePanelWordFilters", + 26: "routePanelWordFiltersCreateSubmit", + 27: "routePanelWordFiltersEdit", + 28: "routePanelWordFiltersEditSubmit", + 29: "routePanelWordFiltersDeleteSubmit", + 30: "panel.Pages", + 31: "panel.PagesCreateSubmit", + 32: "panel.PagesEdit", + 33: "panel.PagesEditSubmit", + 34: "panel.PagesDeleteSubmit", + 35: "routePanelThemes", + 36: "routePanelThemesSetDefault", + 37: "routePanelThemesMenus", + 38: "routePanelThemesMenusEdit", + 39: "routePanelThemesMenuItemEdit", + 40: "routePanelThemesMenuItemEditSubmit", + 41: "routePanelThemesMenuItemCreateSubmit", + 42: "routePanelThemesMenuItemDeleteSubmit", + 43: "routePanelThemesMenuItemOrderSubmit", + 44: "routePanelPlugins", + 45: "routePanelPluginsActivate", + 46: "routePanelPluginsDeactivate", + 47: "routePanelPluginsInstall", + 48: "panel.Users", + 49: "panel.UsersEdit", + 50: "panel.UsersEditSubmit", + 51: "panel.AnalyticsViews", + 52: "panel.AnalyticsRoutes", + 53: "panel.AnalyticsAgents", + 54: "panel.AnalyticsSystems", + 55: "panel.AnalyticsLanguages", + 56: "panel.AnalyticsReferrers", + 57: "panel.AnalyticsRouteViews", + 58: "panel.AnalyticsAgentViews", + 59: "panel.AnalyticsForumViews", + 60: "panel.AnalyticsSystemViews", + 61: "panel.AnalyticsLanguageViews", + 62: "panel.AnalyticsReferrerViews", + 63: "panel.AnalyticsPosts", + 64: "panel.AnalyticsTopics", + 65: "panel.AnalyticsForums", + 66: "routePanelGroups", + 67: "routePanelGroupsEdit", + 68: "routePanelGroupsEditPerms", + 69: "routePanelGroupsEditSubmit", + 70: "routePanelGroupsEditPermsSubmit", + 71: "routePanelGroupsCreateSubmit", + 72: "panel.Backups", + 73: "panel.LogsRegs", + 74: "panel.LogsMod", + 75: "panel.Debug", + 76: "routePanelDashboard", + 77: "routes.AccountEdit", + 78: "routes.AccountEditPassword", + 79: "routes.AccountEditPasswordSubmit", + 80: "routes.AccountEditAvatarSubmit", + 81: "routes.AccountEditUsernameSubmit", + 82: "routes.AccountEditMFA", + 83: "routes.AccountEditMFASetup", + 84: "routes.AccountEditMFASetupSubmit", + 85: "routes.AccountEditMFADisableSubmit", + 86: "routes.AccountEditEmail", + 87: "routes.AccountEditEmailTokenSubmit", + 88: "routes.ViewProfile", + 89: "routes.BanUserSubmit", + 90: "routes.UnbanUser", + 91: "routes.ActivateUser", + 92: "routes.IPSearch", + 93: "routes.CreateTopicSubmit", + 94: "routes.EditTopicSubmit", + 95: "routes.DeleteTopicSubmit", + 96: "routes.StickTopicSubmit", + 97: "routes.UnstickTopicSubmit", + 98: "routes.LockTopicSubmit", + 99: "routes.UnlockTopicSubmit", + 100: "routes.MoveTopicSubmit", + 101: "routes.LikeTopicSubmit", + 102: "routes.ViewTopic", + 103: "routes.CreateReplySubmit", + 104: "routes.ReplyEditSubmit", + 105: "routes.ReplyDeleteSubmit", + 106: "routes.ReplyLikeSubmit", + 107: "routes.ProfileReplyCreateSubmit", + 108: "routes.ProfileReplyEditSubmit", + 109: "routes.ProfileReplyDeleteSubmit", + 110: "routes.PollVote", + 111: "routes.PollResults", + 112: "routes.AccountLogin", + 113: "routes.AccountRegister", + 114: "routes.AccountLogout", + 115: "routes.AccountLoginSubmit", + 116: "routes.AccountLoginMFAVerify", + 117: "routes.AccountLoginMFAVerifySubmit", + 118: "routes.AccountRegisterSubmit", + 119: "routes.DynamicRoute", + 120: "routes.UploadedFile", + 121: "routes.StaticFile", + 122: "routes.RobotsTxt", + 123: "routes.SitemapXml", + 124: "routes.BadRoute", } var osMapEnum = map[string]int{ "unknown": 0, @@ -693,7 +696,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { counters.GlobalViewCounter.Bump() if prefix == "/static" { - counters.RouteViewCounter.Bump(120) + counters.RouteViewCounter.Bump(121) req.URL.Path += extraData routes.StaticFile(w, req) return @@ -919,8 +922,11 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { case "/api/phrases/": counters.RouteViewCounter.Bump(7) err = routeAPIPhrases(w,req,user) - default: + case "/api/watches/": counters.RouteViewCounter.Bump(8) + err = routeJSAntispam(w,req,user) + default: + counters.RouteViewCounter.Bump(9) err = routeAPI(w,req,user) } if err != nil { @@ -947,7 +953,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(9) + counters.RouteViewCounter.Bump(10) err = routes.ReportSubmit(w,req,user,extraData) } if err != nil { @@ -962,10 +968,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(10) + counters.RouteViewCounter.Bump(11) err = routes.CreateTopic(w,req,user,extraData) default: - counters.RouteViewCounter.Bump(11) + counters.RouteViewCounter.Bump(12) err = routes.TopicList(w,req,user) } if err != nil { @@ -980,7 +986,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { switch(req.URL.Path) { case "/panel/forums/": - counters.RouteViewCounter.Bump(12) + counters.RouteViewCounter.Bump(13) err = panel.Forums(w,req,user) case "/panel/forums/create/": err = common.NoSessionMismatch(w,req,user) @@ -989,7 +995,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(13) + counters.RouteViewCounter.Bump(14) err = panel.ForumsCreateSubmit(w,req,user) case "/panel/forums/delete/": err = common.NoSessionMismatch(w,req,user) @@ -998,7 +1004,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(14) + counters.RouteViewCounter.Bump(15) err = panel.ForumsDelete(w,req,user,extraData) case "/panel/forums/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1007,10 +1013,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(15) + counters.RouteViewCounter.Bump(16) err = panel.ForumsDeleteSubmit(w,req,user,extraData) case "/panel/forums/edit/": - counters.RouteViewCounter.Bump(16) + counters.RouteViewCounter.Bump(17) err = panel.ForumsEdit(w,req,user,extraData) case "/panel/forums/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1019,7 +1025,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(17) + counters.RouteViewCounter.Bump(18) err = panel.ForumsEditSubmit(w,req,user,extraData) case "/panel/forums/edit/perms/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1028,10 +1034,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(18) + counters.RouteViewCounter.Bump(19) err = panel.ForumsEditPermsSubmit(w,req,user,extraData) case "/panel/forums/edit/perms/": - counters.RouteViewCounter.Bump(19) + counters.RouteViewCounter.Bump(20) err = panel.ForumsEditPermsAdvance(w,req,user,extraData) case "/panel/forums/edit/perms/adv/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1040,13 +1046,13 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(20) + counters.RouteViewCounter.Bump(21) err = panel.ForumsEditPermsAdvanceSubmit(w,req,user,extraData) case "/panel/settings/": - counters.RouteViewCounter.Bump(21) + counters.RouteViewCounter.Bump(22) err = panel.Settings(w,req,user) case "/panel/settings/edit/": - counters.RouteViewCounter.Bump(22) + counters.RouteViewCounter.Bump(23) err = panel.SettingEdit(w,req,user,extraData) case "/panel/settings/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1055,10 +1061,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(23) + counters.RouteViewCounter.Bump(24) err = panel.SettingEditSubmit(w,req,user,extraData) case "/panel/settings/word-filters/": - counters.RouteViewCounter.Bump(24) + counters.RouteViewCounter.Bump(25) err = routePanelWordFilters(w,req,user) case "/panel/settings/word-filters/create/": err = common.NoSessionMismatch(w,req,user) @@ -1067,10 +1073,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(25) + counters.RouteViewCounter.Bump(26) err = routePanelWordFiltersCreateSubmit(w,req,user) case "/panel/settings/word-filters/edit/": - counters.RouteViewCounter.Bump(26) + counters.RouteViewCounter.Bump(27) err = routePanelWordFiltersEdit(w,req,user,extraData) case "/panel/settings/word-filters/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1079,7 +1085,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(27) + counters.RouteViewCounter.Bump(28) err = routePanelWordFiltersEditSubmit(w,req,user,extraData) case "/panel/settings/word-filters/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1088,7 +1094,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(28) + counters.RouteViewCounter.Bump(29) err = routePanelWordFiltersDeleteSubmit(w,req,user,extraData) case "/panel/pages/": err = common.AdminOnly(w,req,user) @@ -1097,7 +1103,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(29) + counters.RouteViewCounter.Bump(30) err = panel.Pages(w,req,user) case "/panel/pages/create/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1112,7 +1118,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(30) + counters.RouteViewCounter.Bump(31) err = panel.PagesCreateSubmit(w,req,user) case "/panel/pages/edit/": err = common.AdminOnly(w,req,user) @@ -1121,7 +1127,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(31) + counters.RouteViewCounter.Bump(32) err = panel.PagesEdit(w,req,user,extraData) case "/panel/pages/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1136,7 +1142,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(32) + counters.RouteViewCounter.Bump(33) err = panel.PagesEditSubmit(w,req,user,extraData) case "/panel/pages/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1151,10 +1157,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(33) + counters.RouteViewCounter.Bump(34) err = panel.PagesDeleteSubmit(w,req,user,extraData) case "/panel/themes/": - counters.RouteViewCounter.Bump(34) + counters.RouteViewCounter.Bump(35) err = routePanelThemes(w,req,user) case "/panel/themes/default/": err = common.NoSessionMismatch(w,req,user) @@ -1163,16 +1169,16 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(35) + counters.RouteViewCounter.Bump(36) err = routePanelThemesSetDefault(w,req,user,extraData) case "/panel/themes/menus/": - counters.RouteViewCounter.Bump(36) + counters.RouteViewCounter.Bump(37) err = routePanelThemesMenus(w,req,user) case "/panel/themes/menus/edit/": - counters.RouteViewCounter.Bump(37) + counters.RouteViewCounter.Bump(38) err = routePanelThemesMenusEdit(w,req,user,extraData) case "/panel/themes/menus/item/edit/": - counters.RouteViewCounter.Bump(38) + counters.RouteViewCounter.Bump(39) err = routePanelThemesMenuItemEdit(w,req,user,extraData) case "/panel/themes/menus/item/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1181,7 +1187,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(39) + counters.RouteViewCounter.Bump(40) err = routePanelThemesMenuItemEditSubmit(w,req,user,extraData) case "/panel/themes/menus/item/create/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1190,7 +1196,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(40) + counters.RouteViewCounter.Bump(41) err = routePanelThemesMenuItemCreateSubmit(w,req,user) case "/panel/themes/menus/item/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1199,7 +1205,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(41) + counters.RouteViewCounter.Bump(42) err = routePanelThemesMenuItemDeleteSubmit(w,req,user,extraData) case "/panel/themes/menus/item/order/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1208,10 +1214,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(42) + counters.RouteViewCounter.Bump(43) err = routePanelThemesMenuItemOrderSubmit(w,req,user,extraData) case "/panel/plugins/": - counters.RouteViewCounter.Bump(43) + counters.RouteViewCounter.Bump(44) err = routePanelPlugins(w,req,user) case "/panel/plugins/activate/": err = common.NoSessionMismatch(w,req,user) @@ -1220,7 +1226,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(44) + counters.RouteViewCounter.Bump(45) err = routePanelPluginsActivate(w,req,user,extraData) case "/panel/plugins/deactivate/": err = common.NoSessionMismatch(w,req,user) @@ -1229,7 +1235,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(45) + counters.RouteViewCounter.Bump(46) err = routePanelPluginsDeactivate(w,req,user,extraData) case "/panel/plugins/install/": err = common.NoSessionMismatch(w,req,user) @@ -1238,13 +1244,13 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(46) + counters.RouteViewCounter.Bump(47) err = routePanelPluginsInstall(w,req,user,extraData) case "/panel/users/": - counters.RouteViewCounter.Bump(47) + counters.RouteViewCounter.Bump(48) err = panel.Users(w,req,user) case "/panel/users/edit/": - counters.RouteViewCounter.Bump(48) + counters.RouteViewCounter.Bump(49) err = panel.UsersEdit(w,req,user,extraData) case "/panel/users/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1253,7 +1259,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(49) + counters.RouteViewCounter.Bump(50) err = panel.UsersEditSubmit(w,req,user,extraData) case "/panel/analytics/views/": err = common.ParseForm(w,req,user) @@ -1262,7 +1268,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(50) + counters.RouteViewCounter.Bump(51) err = panel.AnalyticsViews(w,req,user) case "/panel/analytics/routes/": err = common.ParseForm(w,req,user) @@ -1271,7 +1277,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(51) + counters.RouteViewCounter.Bump(52) err = panel.AnalyticsRoutes(w,req,user) case "/panel/analytics/agents/": err = common.ParseForm(w,req,user) @@ -1280,7 +1286,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(52) + counters.RouteViewCounter.Bump(53) err = panel.AnalyticsAgents(w,req,user) case "/panel/analytics/systems/": err = common.ParseForm(w,req,user) @@ -1289,7 +1295,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(53) + counters.RouteViewCounter.Bump(54) err = panel.AnalyticsSystems(w,req,user) case "/panel/analytics/langs/": err = common.ParseForm(w,req,user) @@ -1298,7 +1304,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(54) + counters.RouteViewCounter.Bump(55) err = panel.AnalyticsLanguages(w,req,user) case "/panel/analytics/referrers/": err = common.ParseForm(w,req,user) @@ -1307,25 +1313,25 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(55) + counters.RouteViewCounter.Bump(56) err = panel.AnalyticsReferrers(w,req,user) case "/panel/analytics/route/": - counters.RouteViewCounter.Bump(56) + counters.RouteViewCounter.Bump(57) err = panel.AnalyticsRouteViews(w,req,user,extraData) case "/panel/analytics/agent/": - counters.RouteViewCounter.Bump(57) + counters.RouteViewCounter.Bump(58) err = panel.AnalyticsAgentViews(w,req,user,extraData) case "/panel/analytics/forum/": - counters.RouteViewCounter.Bump(58) + counters.RouteViewCounter.Bump(59) err = panel.AnalyticsForumViews(w,req,user,extraData) case "/panel/analytics/system/": - counters.RouteViewCounter.Bump(59) + counters.RouteViewCounter.Bump(60) err = panel.AnalyticsSystemViews(w,req,user,extraData) case "/panel/analytics/lang/": - counters.RouteViewCounter.Bump(60) + counters.RouteViewCounter.Bump(61) err = panel.AnalyticsLanguageViews(w,req,user,extraData) case "/panel/analytics/referrer/": - counters.RouteViewCounter.Bump(61) + counters.RouteViewCounter.Bump(62) err = panel.AnalyticsReferrerViews(w,req,user,extraData) case "/panel/analytics/posts/": err = common.ParseForm(w,req,user) @@ -1334,7 +1340,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(62) + counters.RouteViewCounter.Bump(63) err = panel.AnalyticsPosts(w,req,user) case "/panel/analytics/topics/": err = common.ParseForm(w,req,user) @@ -1343,7 +1349,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(63) + counters.RouteViewCounter.Bump(64) err = panel.AnalyticsTopics(w,req,user) case "/panel/analytics/forums/": err = common.ParseForm(w,req,user) @@ -1352,16 +1358,16 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(64) + counters.RouteViewCounter.Bump(65) err = panel.AnalyticsForums(w,req,user) case "/panel/groups/": - counters.RouteViewCounter.Bump(65) + counters.RouteViewCounter.Bump(66) err = routePanelGroups(w,req,user) case "/panel/groups/edit/": - counters.RouteViewCounter.Bump(66) + counters.RouteViewCounter.Bump(67) err = routePanelGroupsEdit(w,req,user,extraData) case "/panel/groups/edit/perms/": - counters.RouteViewCounter.Bump(67) + counters.RouteViewCounter.Bump(68) err = routePanelGroupsEditPerms(w,req,user,extraData) case "/panel/groups/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1370,7 +1376,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(68) + counters.RouteViewCounter.Bump(69) err = routePanelGroupsEditSubmit(w,req,user,extraData) case "/panel/groups/edit/perms/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1379,7 +1385,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(69) + counters.RouteViewCounter.Bump(70) err = routePanelGroupsEditPermsSubmit(w,req,user,extraData) case "/panel/groups/create/": err = common.NoSessionMismatch(w,req,user) @@ -1388,7 +1394,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(70) + counters.RouteViewCounter.Bump(71) err = routePanelGroupsCreateSubmit(w,req,user) case "/panel/backups/": err = common.SuperAdminOnly(w,req,user) @@ -1397,13 +1403,13 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(71) + counters.RouteViewCounter.Bump(72) err = panel.Backups(w,req,user,extraData) case "/panel/logs/regs/": - counters.RouteViewCounter.Bump(72) + counters.RouteViewCounter.Bump(73) err = panel.LogsRegs(w,req,user) case "/panel/logs/mod/": - counters.RouteViewCounter.Bump(73) + counters.RouteViewCounter.Bump(74) err = panel.LogsMod(w,req,user) case "/panel/debug/": err = common.AdminOnly(w,req,user) @@ -1412,10 +1418,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(74) + counters.RouteViewCounter.Bump(75) err = panel.Debug(w,req,user) default: - counters.RouteViewCounter.Bump(75) + counters.RouteViewCounter.Bump(76) err = routePanelDashboard(w,req,user) } if err != nil { @@ -1430,7 +1436,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(76) + counters.RouteViewCounter.Bump(77) err = routes.AccountEdit(w,req,user) case "/user/edit/password/": err = common.MemberOnly(w,req,user) @@ -1439,7 +1445,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(77) + counters.RouteViewCounter.Bump(78) err = routes.AccountEditPassword(w,req,user) case "/user/edit/password/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1454,7 +1460,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(78) + counters.RouteViewCounter.Bump(79) err = routes.AccountEditPasswordSubmit(w,req,user) case "/user/edit/avatar/submit/": err = common.MemberOnly(w,req,user) @@ -1474,7 +1480,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(79) + counters.RouteViewCounter.Bump(80) err = routes.AccountEditAvatarSubmit(w,req,user) case "/user/edit/username/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1489,7 +1495,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(80) + counters.RouteViewCounter.Bump(81) err = routes.AccountEditUsernameSubmit(w,req,user) case "/user/edit/mfa/": err = common.MemberOnly(w,req,user) @@ -1498,7 +1504,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(81) + counters.RouteViewCounter.Bump(82) err = routes.AccountEditMFA(w,req,user) case "/user/edit/mfa/setup/": err = common.MemberOnly(w,req,user) @@ -1507,7 +1513,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(82) + counters.RouteViewCounter.Bump(83) err = routes.AccountEditMFASetup(w,req,user) case "/user/edit/mfa/setup/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1522,7 +1528,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(83) + counters.RouteViewCounter.Bump(84) err = routes.AccountEditMFASetupSubmit(w,req,user) case "/user/edit/mfa/disable/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1537,7 +1543,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(84) + counters.RouteViewCounter.Bump(85) err = routes.AccountEditMFADisableSubmit(w,req,user) case "/user/edit/email/": err = common.MemberOnly(w,req,user) @@ -1546,7 +1552,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(85) + counters.RouteViewCounter.Bump(86) err = routes.AccountEditEmail(w,req,user) case "/user/edit/token/": err = common.NoSessionMismatch(w,req,user) @@ -1561,11 +1567,11 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(86) + counters.RouteViewCounter.Bump(87) err = routes.AccountEditEmailTokenSubmit(w,req,user,extraData) default: req.URL.Path += extraData - counters.RouteViewCounter.Bump(87) + counters.RouteViewCounter.Bump(88) err = routes.ViewProfile(w,req,user) } if err != nil { @@ -1586,7 +1592,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(88) + counters.RouteViewCounter.Bump(89) err = routes.BanUserSubmit(w,req,user,extraData) case "/users/unban/": err = common.NoSessionMismatch(w,req,user) @@ -1601,7 +1607,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(89) + counters.RouteViewCounter.Bump(90) err = routes.UnbanUser(w,req,user,extraData) case "/users/activate/": err = common.NoSessionMismatch(w,req,user) @@ -1616,7 +1622,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(90) + counters.RouteViewCounter.Bump(91) err = routes.ActivateUser(w,req,user,extraData) case "/users/ips/": err = common.MemberOnly(w,req,user) @@ -1625,7 +1631,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(91) + counters.RouteViewCounter.Bump(92) err = routes.IPSearch(w,req,user) } if err != nil { @@ -1651,7 +1657,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(92) + counters.RouteViewCounter.Bump(93) err = routes.CreateTopicSubmit(w,req,user) case "/topic/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1666,7 +1672,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(93) + counters.RouteViewCounter.Bump(94) err = routes.EditTopicSubmit(w,req,user,extraData) case "/topic/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1682,7 +1688,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } req.URL.Path += extraData - counters.RouteViewCounter.Bump(94) + counters.RouteViewCounter.Bump(95) err = routes.DeleteTopicSubmit(w,req,user) case "/topic/stick/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1697,7 +1703,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(95) + counters.RouteViewCounter.Bump(96) err = routes.StickTopicSubmit(w,req,user,extraData) case "/topic/unstick/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1712,7 +1718,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(96) + counters.RouteViewCounter.Bump(97) err = routes.UnstickTopicSubmit(w,req,user,extraData) case "/topic/lock/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1728,7 +1734,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } req.URL.Path += extraData - counters.RouteViewCounter.Bump(97) + counters.RouteViewCounter.Bump(98) err = routes.LockTopicSubmit(w,req,user) case "/topic/unlock/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1743,7 +1749,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(98) + counters.RouteViewCounter.Bump(99) err = routes.UnlockTopicSubmit(w,req,user,extraData) case "/topic/move/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1758,7 +1764,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(99) + counters.RouteViewCounter.Bump(100) err = routes.MoveTopicSubmit(w,req,user,extraData) case "/topic/like/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1779,10 +1785,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(100) + counters.RouteViewCounter.Bump(101) err = routes.LikeTopicSubmit(w,req,user,extraData) default: - counters.RouteViewCounter.Bump(101) + counters.RouteViewCounter.Bump(102) err = routes.ViewTopic(w,req,user, extraData) } if err != nil { @@ -1808,7 +1814,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(102) + counters.RouteViewCounter.Bump(103) err = routes.CreateReplySubmit(w,req,user) case "/reply/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1823,7 +1829,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(103) + counters.RouteViewCounter.Bump(104) err = routes.ReplyEditSubmit(w,req,user,extraData) case "/reply/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1838,7 +1844,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(104) + counters.RouteViewCounter.Bump(105) err = routes.ReplyDeleteSubmit(w,req,user,extraData) case "/reply/like/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1859,7 +1865,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(105) + counters.RouteViewCounter.Bump(106) err = routes.ReplyLikeSubmit(w,req,user,extraData) } if err != nil { @@ -1880,7 +1886,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(106) + counters.RouteViewCounter.Bump(107) err = routes.ProfileReplyCreateSubmit(w,req,user) case "/profile/reply/edit/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1895,7 +1901,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(107) + counters.RouteViewCounter.Bump(108) err = routes.ProfileReplyEditSubmit(w,req,user,extraData) case "/profile/reply/delete/submit/": err = common.NoSessionMismatch(w,req,user) @@ -1910,7 +1916,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(108) + counters.RouteViewCounter.Bump(109) err = routes.ProfileReplyDeleteSubmit(w,req,user,extraData) } if err != nil { @@ -1931,10 +1937,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(109) + counters.RouteViewCounter.Bump(110) err = routes.PollVote(w,req,user,extraData) case "/poll/results/": - counters.RouteViewCounter.Bump(110) + counters.RouteViewCounter.Bump(111) err = routes.PollResults(w,req,user,extraData) } if err != nil { @@ -1943,10 +1949,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { case "/accounts": switch(req.URL.Path) { case "/accounts/login/": - counters.RouteViewCounter.Bump(111) + counters.RouteViewCounter.Bump(112) err = routes.AccountLogin(w,req,user) case "/accounts/create/": - counters.RouteViewCounter.Bump(112) + counters.RouteViewCounter.Bump(113) err = routes.AccountRegister(w,req,user) case "/accounts/logout/": err = common.NoSessionMismatch(w,req,user) @@ -1961,7 +1967,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(113) + counters.RouteViewCounter.Bump(114) err = routes.AccountLogout(w,req,user) case "/accounts/login/submit/": err = common.ParseForm(w,req,user) @@ -1970,10 +1976,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(114) + counters.RouteViewCounter.Bump(115) err = routes.AccountLoginSubmit(w,req,user) case "/accounts/mfa_verify/": - counters.RouteViewCounter.Bump(115) + counters.RouteViewCounter.Bump(116) err = routes.AccountLoginMFAVerify(w,req,user) case "/accounts/mfa_verify/submit/": err = common.ParseForm(w,req,user) @@ -1982,7 +1988,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(116) + counters.RouteViewCounter.Bump(117) err = routes.AccountLoginMFAVerifySubmit(w,req,user) case "/accounts/create/submit/": err = common.ParseForm(w,req,user) @@ -1991,7 +1997,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - counters.RouteViewCounter.Bump(117) + counters.RouteViewCounter.Bump(118) err = routes.AccountRegisterSubmit(w,req,user) } if err != nil { @@ -2008,7 +2014,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { common.NotFound(w,req,nil) return } - counters.RouteViewCounter.Bump(119) + counters.RouteViewCounter.Bump(120) req.URL.Path += extraData // TODO: Find a way to propagate errors up from this? router.UploadHandler(w,req) // TODO: Count these views @@ -2017,14 +2023,14 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { // TODO: Add support for favicons and robots.txt files switch(extraData) { case "robots.txt": - counters.RouteViewCounter.Bump(121) + counters.RouteViewCounter.Bump(122) err = routes.RobotsTxt(w,req) if err != nil { router.handleError(err,w,req,user) } return /*case "sitemap.xml": - counters.RouteViewCounter.Bump(122) + counters.RouteViewCounter.Bump(123) err = routes.SitemapXml(w,req) if err != nil { router.handleError(err,w,req,user) @@ -2040,7 +2046,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { router.RUnlock() if ok { - counters.RouteViewCounter.Bump(118) // TODO: Be more specific about *which* dynamic route it is + counters.RouteViewCounter.Bump(119) // TODO: Be more specific about *which* dynamic route it is req.URL.Path += extraData err = handle(w,req,user) if err != nil { @@ -2055,7 +2061,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } else { router.DumpRequest(req,"Bad Route") } - counters.RouteViewCounter.Bump(123) + counters.RouteViewCounter.Bump(124) common.NotFound(w,req,nil) } } diff --git a/langs/english.json b/langs/english.json index 689cacd0..2ddd2a69 100644 --- a/langs/english.json +++ b/langs/english.json @@ -361,7 +361,7 @@ "register_account_email":"Email", "register_account_password":"Password", "register_account_confirm_password":"Confirm Password", - "register_account_anti_spam":"Are you a spambot?", + "register_account_anti_spam":"Ar​e y​ou a sp​am​bo​t?", "register_submit_button":"Create Account", "account_menu_head":"My Account", diff --git a/query_gen/tables.go b/query_gen/tables.go index 6eedd79d..0ca59026 100644 --- a/query_gen/tables.go +++ b/query_gen/tables.go @@ -137,6 +137,19 @@ func createTables(adapter qgen.Adapter) error { []qgen.DBTableKey{}, ) + // TODO: Allow for patterns in domains, if the bots try to shake things up there? + /* + qgen.Install.CreateTable("email_domain_blacklist", "", "", + []qgen.DBTableColumn{ + qgen.DBTableColumn{"domain", "varchar", 200, false, false, ""}, + qgen.DBTableColumn{"gtld", "boolean", 0, false, false, "0"}, + }, + []qgen.DBTableKey{ + qgen.DBTableKey{"domain", "primary"}, + }, + ) + */ + qgen.Install.CreateTable("forums", "utf8mb4", "utf8mb4_general_ci", []qgen.DBTableColumn{ qgen.DBTableColumn{"fid", "int", 0, false, true, ""}, diff --git a/router_gen/routes.go b/router_gen/routes.go index e6831cbc..7c7f63d9 100644 --- a/router_gen/routes.go +++ b/router_gen/routes.go @@ -14,6 +14,7 @@ func routes() { apiGroup := newRouteGroup("/api/", View("routeAPI", "/api/"), View("routeAPIPhrases", "/api/phrases/"), // TODO: Be careful with exposing the panel phrases here + View("routeJSAntispam", "/api/watches/"), ) addRouteGroup(apiGroup) diff --git a/routes.go b/routes.go index 6e371c24..07bb8951 100644 --- a/routes.go +++ b/routes.go @@ -7,6 +7,8 @@ package main import ( + "crypto/sha256" + "encoding/hex" "encoding/json" "net/http" "strconv" @@ -186,3 +188,19 @@ func routeAPIPhrases(w http.ResponseWriter, r *http.Request, user common.User) c return nil } + +// A dedicated function so we can shake things up every now and then to make the token harder to parse +// TODO: Are we sure we want to do this by ID, just in case we reuse this and have multiple antispams on the page? +func routeJSAntispam(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError { + h := sha256.New() + h.Write([]byte(common.JSTokenBox.Load().(string))) + h.Write([]byte(user.LastIP)) + jsToken := hex.EncodeToString(h.Sum(nil)) + + var innerCode = "`document.getElementByld('golden-watch').value = '" + jsToken + "';`" + w.Write([]byte(`let hihi = ` + innerCode + `; +hihi = hihi.replace('ld','Id'); +eval(hihi);`)) + + return nil +} diff --git a/routes/account.go b/routes/account.go index 602a980e..43b86835 100644 --- a/routes/account.go +++ b/routes/account.go @@ -201,11 +201,7 @@ func AccountRegister(w http.ResponseWriter, r *http.Request, user common.User) c } header.Title = common.GetTitlePhrase("register") - h := sha256.New() - h.Write([]byte(common.JSTokenBox.Load().(string))) - h.Write([]byte(user.LastIP)) - jsToken := hex.EncodeToString(h.Sum(nil)) - pi := common.Page{header, tList, jsToken} + pi := common.Page{header, tList, nil} if common.RunPreRenderHook("pre_render_register", w, r, &user, &pi) { return nil } @@ -237,7 +233,7 @@ func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.U h := sha256.New() h.Write([]byte(common.JSTokenBox.Load().(string))) h.Write([]byte(user.LastIP)) - if r.PostFormValue("antispam") != hex.EncodeToString(h.Sum(nil)) { + if r.PostFormValue("golden-watch") != hex.EncodeToString(h.Sum(nil)) { regError("You might be a machine", "js-antispam") } diff --git a/templates/login.html b/templates/login.html index acdfdb60..dad71a47 100644 --- a/templates/login.html +++ b/templates/login.html @@ -3,7 +3,7 @@

{{lang "login_head"}}

-
+