2018-07-13 11:27:58 +00:00
// Code generated by Gosora's Router Generator. DO NOT EDIT.
2017-04-12 13:39:03 +00:00
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
package main
2017-11-11 04:06:16 +00:00
import (
"log"
"strings"
2020-03-22 23:14:08 +00:00
//"bytes"
2018-03-08 03:59:47 +00:00
"strconv"
2018-08-21 08:00:35 +00:00
"compress/gzip"
2017-11-11 04:06:16 +00:00
"sync"
2018-07-15 10:29:31 +00:00
"sync/atomic"
2017-11-11 04:06:16 +00:00
"errors"
2018-04-03 04:34:07 +00:00
"os"
2017-11-11 04:06:16 +00:00
"net/http"
2020-02-28 23:11:07 +00:00
"time"
2017-11-11 04:06:16 +00:00
2019-04-19 07:16:09 +00:00
c "github.com/Azareal/Gosora/common"
2019-10-29 07:13:04 +00:00
co "github.com/Azareal/Gosora/common/counters"
2020-02-28 23:11:07 +00:00
"github.com/Azareal/Gosora/uutils"
2018-10-27 03:21:02 +00:00
"github.com/Azareal/Gosora/routes"
"github.com/Azareal/Gosora/routes/panel"
2020-05-26 21:08:13 +00:00
//"github.com/andybalholm/brotli"
2017-11-11 04:06:16 +00:00
)
2017-04-12 13:39:03 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
var ErrNoRoute = errors . New ( "That route doesn't exist." )
2017-12-19 03:53:13 +00:00
// TODO: What about the /uploads/ route? x.x
var RouteMap = map [ string ] interface { } {
2020-02-26 10:34:38 +00:00
"routes.Error" : routes . Error ,
2018-02-03 05:47:14 +00:00
"routes.Overview" : routes . Overview ,
"routes.CustomPage" : routes . CustomPage ,
2018-03-17 08:16:43 +00:00
"routes.ForumList" : routes . ForumList ,
2018-02-22 02:27:17 +00:00
"routes.ViewForum" : routes . ViewForum ,
2018-05-15 05:59:52 +00:00
"routes.ChangeTheme" : routes . ChangeTheme ,
"routes.ShowAttachment" : routes . ShowAttachment ,
2019-04-19 07:16:09 +00:00
"common.RouteWebsockets" : c . RouteWebsockets ,
2018-06-24 13:49:29 +00:00
"routeAPIPhrases" : routeAPIPhrases ,
2018-08-11 15:53:42 +00:00
"routes.APIMe" : routes . APIMe ,
2018-07-05 09:54:01 +00:00
"routeJSAntispam" : routeJSAntispam ,
2018-06-24 13:49:29 +00:00
"routeAPI" : routeAPI ,
2018-05-27 09:36:35 +00:00
"routes.ReportSubmit" : routes . ReportSubmit ,
2018-09-26 07:46:30 +00:00
"routes.TopicListMostViewed" : routes . TopicListMostViewed ,
2018-01-21 11:17:43 +00:00
"routes.CreateTopic" : routes . CreateTopic ,
2018-02-10 15:07:21 +00:00
"routes.TopicList" : routes . TopicList ,
2018-05-27 09:36:35 +00:00
"panel.Forums" : panel . Forums ,
"panel.ForumsCreateSubmit" : panel . ForumsCreateSubmit ,
"panel.ForumsDelete" : panel . ForumsDelete ,
"panel.ForumsDeleteSubmit" : panel . ForumsDeleteSubmit ,
2019-04-27 06:32:26 +00:00
"panel.ForumsOrderSubmit" : panel . ForumsOrderSubmit ,
2018-05-27 09:36:35 +00:00
"panel.ForumsEdit" : panel . ForumsEdit ,
"panel.ForumsEditSubmit" : panel . ForumsEditSubmit ,
"panel.ForumsEditPermsSubmit" : panel . ForumsEditPermsSubmit ,
"panel.ForumsEditPermsAdvance" : panel . ForumsEditPermsAdvance ,
"panel.ForumsEditPermsAdvanceSubmit" : panel . ForumsEditPermsAdvanceSubmit ,
"panel.Settings" : panel . Settings ,
"panel.SettingEdit" : panel . SettingEdit ,
"panel.SettingEditSubmit" : panel . SettingEditSubmit ,
2018-08-04 11:46:36 +00:00
"panel.WordFilters" : panel . WordFilters ,
"panel.WordFiltersCreateSubmit" : panel . WordFiltersCreateSubmit ,
"panel.WordFiltersEdit" : panel . WordFiltersEdit ,
"panel.WordFiltersEditSubmit" : panel . WordFiltersEditSubmit ,
"panel.WordFiltersDeleteSubmit" : panel . WordFiltersDeleteSubmit ,
2018-06-06 00:21:22 +00:00
"panel.Pages" : panel . Pages ,
"panel.PagesCreateSubmit" : panel . PagesCreateSubmit ,
"panel.PagesEdit" : panel . PagesEdit ,
"panel.PagesEditSubmit" : panel . PagesEditSubmit ,
"panel.PagesDeleteSubmit" : panel . PagesDeleteSubmit ,
2018-09-30 14:43:46 +00:00
"panel.Themes" : panel . Themes ,
2018-10-02 04:09:17 +00:00
"panel.ThemesSetDefault" : panel . ThemesSetDefault ,
2018-09-30 14:43:46 +00:00
"panel.ThemesMenus" : panel . ThemesMenus ,
"panel.ThemesMenusEdit" : panel . ThemesMenusEdit ,
"panel.ThemesMenuItemEdit" : panel . ThemesMenuItemEdit ,
"panel.ThemesMenuItemEditSubmit" : panel . ThemesMenuItemEditSubmit ,
"panel.ThemesMenuItemCreateSubmit" : panel . ThemesMenuItemCreateSubmit ,
"panel.ThemesMenuItemDeleteSubmit" : panel . ThemesMenuItemDeleteSubmit ,
"panel.ThemesMenuItemOrderSubmit" : panel . ThemesMenuItemOrderSubmit ,
2019-01-21 12:27:59 +00:00
"panel.ThemesWidgets" : panel . ThemesWidgets ,
"panel.ThemesWidgetsEditSubmit" : panel . ThemesWidgetsEditSubmit ,
"panel.ThemesWidgetsCreateSubmit" : panel . ThemesWidgetsCreateSubmit ,
"panel.ThemesWidgetsDeleteSubmit" : panel . ThemesWidgetsDeleteSubmit ,
2018-07-29 10:54:12 +00:00
"panel.Plugins" : panel . Plugins ,
"panel.PluginsActivate" : panel . PluginsActivate ,
"panel.PluginsDeactivate" : panel . PluginsDeactivate ,
"panel.PluginsInstall" : panel . PluginsInstall ,
2018-06-17 07:28:18 +00:00
"panel.Users" : panel . Users ,
"panel.UsersEdit" : panel . UsersEdit ,
"panel.UsersEditSubmit" : panel . UsersEditSubmit ,
2019-06-10 22:00:57 +00:00
"panel.UsersAvatarSubmit" : panel . UsersAvatarSubmit ,
"panel.UsersAvatarRemoveSubmit" : panel . UsersAvatarRemoveSubmit ,
2018-05-27 09:36:35 +00:00
"panel.AnalyticsViews" : panel . AnalyticsViews ,
"panel.AnalyticsRoutes" : panel . AnalyticsRoutes ,
2020-02-28 04:52:45 +00:00
"panel.AnalyticsRoutesPerf" : panel . AnalyticsRoutesPerf ,
2018-05-27 09:36:35 +00:00
"panel.AnalyticsAgents" : panel . AnalyticsAgents ,
"panel.AnalyticsSystems" : panel . AnalyticsSystems ,
"panel.AnalyticsLanguages" : panel . AnalyticsLanguages ,
"panel.AnalyticsReferrers" : panel . AnalyticsReferrers ,
"panel.AnalyticsRouteViews" : panel . AnalyticsRouteViews ,
"panel.AnalyticsAgentViews" : panel . AnalyticsAgentViews ,
"panel.AnalyticsForumViews" : panel . AnalyticsForumViews ,
"panel.AnalyticsSystemViews" : panel . AnalyticsSystemViews ,
"panel.AnalyticsLanguageViews" : panel . AnalyticsLanguageViews ,
"panel.AnalyticsReferrerViews" : panel . AnalyticsReferrerViews ,
"panel.AnalyticsPosts" : panel . AnalyticsPosts ,
2019-05-01 06:59:51 +00:00
"panel.AnalyticsMemory" : panel . AnalyticsMemory ,
2019-05-09 06:58:55 +00:00
"panel.AnalyticsActiveMemory" : panel . AnalyticsActiveMemory ,
2018-05-27 09:36:35 +00:00
"panel.AnalyticsTopics" : panel . AnalyticsTopics ,
"panel.AnalyticsForums" : panel . AnalyticsForums ,
2020-02-23 09:08:47 +00:00
"panel.AnalyticsPerf" : panel . AnalyticsPerf ,
2018-09-30 00:08:27 +00:00
"panel.Groups" : panel . Groups ,
"panel.GroupsEdit" : panel . GroupsEdit ,
2019-09-29 04:56:39 +00:00
"panel.GroupsEditPromotions" : panel . GroupsEditPromotions ,
"panel.GroupsPromotionsCreateSubmit" : panel . GroupsPromotionsCreateSubmit ,
"panel.GroupsPromotionsDeleteSubmit" : panel . GroupsPromotionsDeleteSubmit ,
2018-09-30 00:08:27 +00:00
"panel.GroupsEditPerms" : panel . GroupsEditPerms ,
"panel.GroupsEditSubmit" : panel . GroupsEditSubmit ,
"panel.GroupsEditPermsSubmit" : panel . GroupsEditPermsSubmit ,
"panel.GroupsCreateSubmit" : panel . GroupsCreateSubmit ,
2018-05-27 09:36:35 +00:00
"panel.Backups" : panel . Backups ,
"panel.LogsRegs" : panel . LogsRegs ,
"panel.LogsMod" : panel . LogsMod ,
2019-11-06 02:00:44 +00:00
"panel.LogsAdmin" : panel . LogsAdmin ,
2018-05-27 09:36:35 +00:00
"panel.Debug" : panel . Debug ,
2018-10-02 05:03:20 +00:00
"panel.Dashboard" : panel . Dashboard ,
2018-06-17 07:28:18 +00:00
"routes.AccountEdit" : routes . AccountEdit ,
"routes.AccountEditPassword" : routes . AccountEditPassword ,
"routes.AccountEditPasswordSubmit" : routes . AccountEditPasswordSubmit ,
2018-05-14 08:56:56 +00:00
"routes.AccountEditAvatarSubmit" : routes . AccountEditAvatarSubmit ,
2019-06-09 03:21:48 +00:00
"routes.AccountEditRevokeAvatarSubmit" : routes . AccountEditRevokeAvatarSubmit ,
2018-05-14 08:56:56 +00:00
"routes.AccountEditUsernameSubmit" : routes . AccountEditUsernameSubmit ,
2019-12-08 03:40:56 +00:00
"routes.AccountEditPrivacy" : routes . AccountEditPrivacy ,
"routes.AccountEditPrivacySubmit" : routes . AccountEditPrivacySubmit ,
2018-06-17 07:28:18 +00:00
"routes.AccountEditMFA" : routes . AccountEditMFA ,
"routes.AccountEditMFASetup" : routes . AccountEditMFASetup ,
"routes.AccountEditMFASetupSubmit" : routes . AccountEditMFASetupSubmit ,
"routes.AccountEditMFADisableSubmit" : routes . AccountEditMFADisableSubmit ,
2018-05-27 09:36:35 +00:00
"routes.AccountEditEmail" : routes . AccountEditEmail ,
"routes.AccountEditEmailTokenSubmit" : routes . AccountEditEmailTokenSubmit ,
2018-12-17 04:58:55 +00:00
"routes.AccountLogins" : routes . AccountLogins ,
2019-11-12 06:17:46 +00:00
"routes.AccountBlocked" : routes . AccountBlocked ,
2018-10-10 07:33:51 +00:00
"routes.LevelList" : routes . LevelList ,
2019-08-14 10:39:04 +00:00
"routes.Convos" : routes . Convos ,
"routes.ConvosCreate" : routes . ConvosCreate ,
"routes.Convo" : routes . Convo ,
"routes.ConvosCreateSubmit" : routes . ConvosCreateSubmit ,
"routes.ConvosCreateReplySubmit" : routes . ConvosCreateReplySubmit ,
"routes.ConvosDeleteReplySubmit" : routes . ConvosDeleteReplySubmit ,
"routes.ConvosEditReplySubmit" : routes . ConvosEditReplySubmit ,
2019-10-18 00:35:13 +00:00
"routes.RelationsBlockCreate" : routes . RelationsBlockCreate ,
"routes.RelationsBlockCreateSubmit" : routes . RelationsBlockCreateSubmit ,
"routes.RelationsBlockRemove" : routes . RelationsBlockRemove ,
"routes.RelationsBlockRemoveSubmit" : routes . RelationsBlockRemoveSubmit ,
2018-02-26 09:07:00 +00:00
"routes.ViewProfile" : routes . ViewProfile ,
2018-01-21 11:17:43 +00:00
"routes.BanUserSubmit" : routes . BanUserSubmit ,
"routes.UnbanUser" : routes . UnbanUser ,
"routes.ActivateUser" : routes . ActivateUser ,
"routes.IPSearch" : routes . IPSearch ,
2020-01-14 05:07:00 +00:00
"routes.DeletePostsSubmit" : routes . DeletePostsSubmit ,
2018-01-22 08:15:45 +00:00
"routes.CreateTopicSubmit" : routes . CreateTopicSubmit ,
2018-01-18 12:31:25 +00:00
"routes.EditTopicSubmit" : routes . EditTopicSubmit ,
2018-01-20 06:50:29 +00:00
"routes.DeleteTopicSubmit" : routes . DeleteTopicSubmit ,
"routes.StickTopicSubmit" : routes . StickTopicSubmit ,
"routes.UnstickTopicSubmit" : routes . UnstickTopicSubmit ,
"routes.LockTopicSubmit" : routes . LockTopicSubmit ,
"routes.UnlockTopicSubmit" : routes . UnlockTopicSubmit ,
"routes.MoveTopicSubmit" : routes . MoveTopicSubmit ,
2018-05-15 05:59:52 +00:00
"routes.LikeTopicSubmit" : routes . LikeTopicSubmit ,
Cascade delete attachments properly.
Cascade delete replied to topic events for replies properly.
Cascade delete likes on topic posts properly.
Cascade delete replies and their children properly.
Recalculate user stats properly when items are deleted.
Users can now unlike topic opening posts.
Add a recalculator to fix abnormalities across upgrades.
Try fixing a last_ip daily update bug.
Add Existable interface.
Add Delete method to LikeStore.
Add Each, Exists, Create, CountUser, CountMegaUser and CountBigUser methods to ReplyStore.
Add CountUser, CountMegaUser, CountBigUser methods to TopicStore.
Add Each method to UserStore.
Add Add, Delete and DeleteResource methods to SubscriptionStore.
Add Delete, DeleteByParams, DeleteByParamsExtra and AidsByParamsExtra methods to ActivityStream.
Add Exists method to ProfileReplyStore.
Add DropColumn, RenameColumn and ChangeColumn to the database adapters.
Shorten ipaddress column names to ip.
- topics table.
- replies table
- users_replies table.
- polls_votes table.
Add extra column to activity_stream table.
Fix an issue upgrading sites to MariaDB 10.3 from older versions of Gosora. Please report any other issues you find.
You need to run the updater / patcher for this commit.
2020-01-31 07:22:08 +00:00
"routes.UnlikeTopicSubmit" : routes . UnlikeTopicSubmit ,
2018-12-27 05:42:41 +00:00
"routes.AddAttachToTopicSubmit" : routes . AddAttachToTopicSubmit ,
"routes.RemoveAttachFromTopicSubmit" : routes . RemoveAttachFromTopicSubmit ,
2018-02-03 05:47:14 +00:00
"routes.ViewTopic" : routes . ViewTopic ,
2018-03-08 03:59:47 +00:00
"routes.CreateReplySubmit" : routes . CreateReplySubmit ,
2018-01-20 06:50:29 +00:00
"routes.ReplyEditSubmit" : routes . ReplyEditSubmit ,
"routes.ReplyDeleteSubmit" : routes . ReplyDeleteSubmit ,
2018-05-15 05:59:52 +00:00
"routes.ReplyLikeSubmit" : routes . ReplyLikeSubmit ,
2020-01-31 10:48:55 +00:00
"routes.ReplyUnlikeSubmit" : routes . ReplyUnlikeSubmit ,
2018-12-31 09:03:49 +00:00
"routes.AddAttachToReplySubmit" : routes . AddAttachToReplySubmit ,
"routes.RemoveAttachFromReplySubmit" : routes . RemoveAttachFromReplySubmit ,
2018-05-15 05:59:52 +00:00
"routes.ProfileReplyCreateSubmit" : routes . ProfileReplyCreateSubmit ,
2018-01-20 06:50:29 +00:00
"routes.ProfileReplyEditSubmit" : routes . ProfileReplyEditSubmit ,
"routes.ProfileReplyDeleteSubmit" : routes . ProfileReplyDeleteSubmit ,
2018-01-27 07:30:44 +00:00
"routes.PollVote" : routes . PollVote ,
2018-01-28 14:30:24 +00:00
"routes.PollResults" : routes . PollResults ,
2018-02-03 05:47:14 +00:00
"routes.AccountLogin" : routes . AccountLogin ,
"routes.AccountRegister" : routes . AccountRegister ,
2018-05-15 05:59:52 +00:00
"routes.AccountLogout" : routes . AccountLogout ,
2018-02-03 05:47:14 +00:00
"routes.AccountLoginSubmit" : routes . AccountLoginSubmit ,
2018-06-17 07:28:18 +00:00
"routes.AccountLoginMFAVerify" : routes . AccountLoginMFAVerify ,
"routes.AccountLoginMFAVerifySubmit" : routes . AccountLoginMFAVerifySubmit ,
2018-02-03 05:47:14 +00:00
"routes.AccountRegisterSubmit" : routes . AccountRegisterSubmit ,
2019-03-11 08:47:45 +00:00
"routes.AccountPasswordReset" : routes . AccountPasswordReset ,
"routes.AccountPasswordResetSubmit" : routes . AccountPasswordResetSubmit ,
"routes.AccountPasswordResetToken" : routes . AccountPasswordResetToken ,
"routes.AccountPasswordResetTokenSubmit" : routes . AccountPasswordResetTokenSubmit ,
2018-05-15 05:59:52 +00:00
"routes.DynamicRoute" : routes . DynamicRoute ,
"routes.UploadedFile" : routes . UploadedFile ,
2018-02-19 04:26:01 +00:00
"routes.StaticFile" : routes . StaticFile ,
2018-03-17 08:16:43 +00:00
"routes.RobotsTxt" : routes . RobotsTxt ,
"routes.SitemapXml" : routes . SitemapXml ,
2019-05-08 05:26:38 +00:00
"routes.OpenSearchXml" : routes . OpenSearchXml ,
2020-02-26 10:34:38 +00:00
"routes.Favicon" : routes . Favicon ,
2018-05-15 05:59:52 +00:00
"routes.BadRoute" : routes . BadRoute ,
2019-03-21 22:59:41 +00:00
"routes.HTTPSRedirect" : routes . HTTPSRedirect ,
2017-12-10 03:43:30 +00:00
}
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
2017-12-19 03:53:13 +00:00
// ! NEVER RELY ON THESE REMAINING THE SAME BETWEEN COMMITS
var routeMapEnum = map [ string ] int {
2020-02-26 10:34:38 +00:00
"routes.Error" : 0 ,
"routes.Overview" : 1 ,
"routes.CustomPage" : 2 ,
"routes.ForumList" : 3 ,
"routes.ViewForum" : 4 ,
"routes.ChangeTheme" : 5 ,
"routes.ShowAttachment" : 6 ,
"common.RouteWebsockets" : 7 ,
"routeAPIPhrases" : 8 ,
"routes.APIMe" : 9 ,
"routeJSAntispam" : 10 ,
"routeAPI" : 11 ,
"routes.ReportSubmit" : 12 ,
"routes.TopicListMostViewed" : 13 ,
"routes.CreateTopic" : 14 ,
"routes.TopicList" : 15 ,
"panel.Forums" : 16 ,
"panel.ForumsCreateSubmit" : 17 ,
"panel.ForumsDelete" : 18 ,
"panel.ForumsDeleteSubmit" : 19 ,
"panel.ForumsOrderSubmit" : 20 ,
"panel.ForumsEdit" : 21 ,
"panel.ForumsEditSubmit" : 22 ,
"panel.ForumsEditPermsSubmit" : 23 ,
"panel.ForumsEditPermsAdvance" : 24 ,
"panel.ForumsEditPermsAdvanceSubmit" : 25 ,
"panel.Settings" : 26 ,
"panel.SettingEdit" : 27 ,
"panel.SettingEditSubmit" : 28 ,
"panel.WordFilters" : 29 ,
"panel.WordFiltersCreateSubmit" : 30 ,
"panel.WordFiltersEdit" : 31 ,
"panel.WordFiltersEditSubmit" : 32 ,
"panel.WordFiltersDeleteSubmit" : 33 ,
"panel.Pages" : 34 ,
"panel.PagesCreateSubmit" : 35 ,
"panel.PagesEdit" : 36 ,
"panel.PagesEditSubmit" : 37 ,
"panel.PagesDeleteSubmit" : 38 ,
"panel.Themes" : 39 ,
"panel.ThemesSetDefault" : 40 ,
"panel.ThemesMenus" : 41 ,
"panel.ThemesMenusEdit" : 42 ,
"panel.ThemesMenuItemEdit" : 43 ,
"panel.ThemesMenuItemEditSubmit" : 44 ,
"panel.ThemesMenuItemCreateSubmit" : 45 ,
"panel.ThemesMenuItemDeleteSubmit" : 46 ,
"panel.ThemesMenuItemOrderSubmit" : 47 ,
"panel.ThemesWidgets" : 48 ,
"panel.ThemesWidgetsEditSubmit" : 49 ,
"panel.ThemesWidgetsCreateSubmit" : 50 ,
"panel.ThemesWidgetsDeleteSubmit" : 51 ,
"panel.Plugins" : 52 ,
"panel.PluginsActivate" : 53 ,
"panel.PluginsDeactivate" : 54 ,
"panel.PluginsInstall" : 55 ,
"panel.Users" : 56 ,
"panel.UsersEdit" : 57 ,
"panel.UsersEditSubmit" : 58 ,
"panel.UsersAvatarSubmit" : 59 ,
"panel.UsersAvatarRemoveSubmit" : 60 ,
"panel.AnalyticsViews" : 61 ,
"panel.AnalyticsRoutes" : 62 ,
2020-02-28 04:52:45 +00:00
"panel.AnalyticsRoutesPerf" : 63 ,
"panel.AnalyticsAgents" : 64 ,
"panel.AnalyticsSystems" : 65 ,
"panel.AnalyticsLanguages" : 66 ,
"panel.AnalyticsReferrers" : 67 ,
"panel.AnalyticsRouteViews" : 68 ,
"panel.AnalyticsAgentViews" : 69 ,
"panel.AnalyticsForumViews" : 70 ,
"panel.AnalyticsSystemViews" : 71 ,
"panel.AnalyticsLanguageViews" : 72 ,
"panel.AnalyticsReferrerViews" : 73 ,
"panel.AnalyticsPosts" : 74 ,
"panel.AnalyticsMemory" : 75 ,
"panel.AnalyticsActiveMemory" : 76 ,
"panel.AnalyticsTopics" : 77 ,
"panel.AnalyticsForums" : 78 ,
"panel.AnalyticsPerf" : 79 ,
"panel.Groups" : 80 ,
"panel.GroupsEdit" : 81 ,
"panel.GroupsEditPromotions" : 82 ,
"panel.GroupsPromotionsCreateSubmit" : 83 ,
"panel.GroupsPromotionsDeleteSubmit" : 84 ,
"panel.GroupsEditPerms" : 85 ,
"panel.GroupsEditSubmit" : 86 ,
"panel.GroupsEditPermsSubmit" : 87 ,
"panel.GroupsCreateSubmit" : 88 ,
"panel.Backups" : 89 ,
"panel.LogsRegs" : 90 ,
"panel.LogsMod" : 91 ,
"panel.LogsAdmin" : 92 ,
"panel.Debug" : 93 ,
"panel.Dashboard" : 94 ,
"routes.AccountEdit" : 95 ,
"routes.AccountEditPassword" : 96 ,
"routes.AccountEditPasswordSubmit" : 97 ,
"routes.AccountEditAvatarSubmit" : 98 ,
"routes.AccountEditRevokeAvatarSubmit" : 99 ,
"routes.AccountEditUsernameSubmit" : 100 ,
"routes.AccountEditPrivacy" : 101 ,
"routes.AccountEditPrivacySubmit" : 102 ,
"routes.AccountEditMFA" : 103 ,
"routes.AccountEditMFASetup" : 104 ,
"routes.AccountEditMFASetupSubmit" : 105 ,
"routes.AccountEditMFADisableSubmit" : 106 ,
"routes.AccountEditEmail" : 107 ,
"routes.AccountEditEmailTokenSubmit" : 108 ,
"routes.AccountLogins" : 109 ,
"routes.AccountBlocked" : 110 ,
"routes.LevelList" : 111 ,
"routes.Convos" : 112 ,
"routes.ConvosCreate" : 113 ,
"routes.Convo" : 114 ,
"routes.ConvosCreateSubmit" : 115 ,
"routes.ConvosCreateReplySubmit" : 116 ,
"routes.ConvosDeleteReplySubmit" : 117 ,
"routes.ConvosEditReplySubmit" : 118 ,
"routes.RelationsBlockCreate" : 119 ,
"routes.RelationsBlockCreateSubmit" : 120 ,
"routes.RelationsBlockRemove" : 121 ,
"routes.RelationsBlockRemoveSubmit" : 122 ,
"routes.ViewProfile" : 123 ,
"routes.BanUserSubmit" : 124 ,
"routes.UnbanUser" : 125 ,
"routes.ActivateUser" : 126 ,
"routes.IPSearch" : 127 ,
"routes.DeletePostsSubmit" : 128 ,
"routes.CreateTopicSubmit" : 129 ,
"routes.EditTopicSubmit" : 130 ,
"routes.DeleteTopicSubmit" : 131 ,
"routes.StickTopicSubmit" : 132 ,
"routes.UnstickTopicSubmit" : 133 ,
"routes.LockTopicSubmit" : 134 ,
"routes.UnlockTopicSubmit" : 135 ,
"routes.MoveTopicSubmit" : 136 ,
"routes.LikeTopicSubmit" : 137 ,
"routes.UnlikeTopicSubmit" : 138 ,
"routes.AddAttachToTopicSubmit" : 139 ,
"routes.RemoveAttachFromTopicSubmit" : 140 ,
"routes.ViewTopic" : 141 ,
"routes.CreateReplySubmit" : 142 ,
"routes.ReplyEditSubmit" : 143 ,
"routes.ReplyDeleteSubmit" : 144 ,
"routes.ReplyLikeSubmit" : 145 ,
"routes.ReplyUnlikeSubmit" : 146 ,
"routes.AddAttachToReplySubmit" : 147 ,
"routes.RemoveAttachFromReplySubmit" : 148 ,
"routes.ProfileReplyCreateSubmit" : 149 ,
"routes.ProfileReplyEditSubmit" : 150 ,
"routes.ProfileReplyDeleteSubmit" : 151 ,
"routes.PollVote" : 152 ,
"routes.PollResults" : 153 ,
"routes.AccountLogin" : 154 ,
"routes.AccountRegister" : 155 ,
"routes.AccountLogout" : 156 ,
"routes.AccountLoginSubmit" : 157 ,
"routes.AccountLoginMFAVerify" : 158 ,
"routes.AccountLoginMFAVerifySubmit" : 159 ,
"routes.AccountRegisterSubmit" : 160 ,
"routes.AccountPasswordReset" : 161 ,
"routes.AccountPasswordResetSubmit" : 162 ,
"routes.AccountPasswordResetToken" : 163 ,
"routes.AccountPasswordResetTokenSubmit" : 164 ,
"routes.DynamicRoute" : 165 ,
"routes.UploadedFile" : 166 ,
"routes.StaticFile" : 167 ,
"routes.RobotsTxt" : 168 ,
"routes.SitemapXml" : 169 ,
"routes.OpenSearchXml" : 170 ,
"routes.Favicon" : 171 ,
"routes.BadRoute" : 172 ,
"routes.HTTPSRedirect" : 173 ,
2017-12-19 03:53:13 +00:00
}
var reverseRouteMapEnum = map [ int ] string {
2020-02-26 10:34:38 +00:00
0 : "routes.Error" ,
1 : "routes.Overview" ,
2 : "routes.CustomPage" ,
3 : "routes.ForumList" ,
4 : "routes.ViewForum" ,
5 : "routes.ChangeTheme" ,
6 : "routes.ShowAttachment" ,
7 : "common.RouteWebsockets" ,
8 : "routeAPIPhrases" ,
9 : "routes.APIMe" ,
10 : "routeJSAntispam" ,
11 : "routeAPI" ,
12 : "routes.ReportSubmit" ,
13 : "routes.TopicListMostViewed" ,
14 : "routes.CreateTopic" ,
15 : "routes.TopicList" ,
16 : "panel.Forums" ,
17 : "panel.ForumsCreateSubmit" ,
18 : "panel.ForumsDelete" ,
19 : "panel.ForumsDeleteSubmit" ,
20 : "panel.ForumsOrderSubmit" ,
21 : "panel.ForumsEdit" ,
22 : "panel.ForumsEditSubmit" ,
23 : "panel.ForumsEditPermsSubmit" ,
24 : "panel.ForumsEditPermsAdvance" ,
25 : "panel.ForumsEditPermsAdvanceSubmit" ,
26 : "panel.Settings" ,
27 : "panel.SettingEdit" ,
28 : "panel.SettingEditSubmit" ,
29 : "panel.WordFilters" ,
30 : "panel.WordFiltersCreateSubmit" ,
31 : "panel.WordFiltersEdit" ,
32 : "panel.WordFiltersEditSubmit" ,
33 : "panel.WordFiltersDeleteSubmit" ,
34 : "panel.Pages" ,
35 : "panel.PagesCreateSubmit" ,
36 : "panel.PagesEdit" ,
37 : "panel.PagesEditSubmit" ,
38 : "panel.PagesDeleteSubmit" ,
39 : "panel.Themes" ,
40 : "panel.ThemesSetDefault" ,
41 : "panel.ThemesMenus" ,
42 : "panel.ThemesMenusEdit" ,
43 : "panel.ThemesMenuItemEdit" ,
44 : "panel.ThemesMenuItemEditSubmit" ,
45 : "panel.ThemesMenuItemCreateSubmit" ,
46 : "panel.ThemesMenuItemDeleteSubmit" ,
47 : "panel.ThemesMenuItemOrderSubmit" ,
48 : "panel.ThemesWidgets" ,
49 : "panel.ThemesWidgetsEditSubmit" ,
50 : "panel.ThemesWidgetsCreateSubmit" ,
51 : "panel.ThemesWidgetsDeleteSubmit" ,
52 : "panel.Plugins" ,
53 : "panel.PluginsActivate" ,
54 : "panel.PluginsDeactivate" ,
55 : "panel.PluginsInstall" ,
56 : "panel.Users" ,
57 : "panel.UsersEdit" ,
58 : "panel.UsersEditSubmit" ,
59 : "panel.UsersAvatarSubmit" ,
60 : "panel.UsersAvatarRemoveSubmit" ,
61 : "panel.AnalyticsViews" ,
62 : "panel.AnalyticsRoutes" ,
2020-02-28 04:52:45 +00:00
63 : "panel.AnalyticsRoutesPerf" ,
64 : "panel.AnalyticsAgents" ,
65 : "panel.AnalyticsSystems" ,
66 : "panel.AnalyticsLanguages" ,
67 : "panel.AnalyticsReferrers" ,
68 : "panel.AnalyticsRouteViews" ,
69 : "panel.AnalyticsAgentViews" ,
70 : "panel.AnalyticsForumViews" ,
71 : "panel.AnalyticsSystemViews" ,
72 : "panel.AnalyticsLanguageViews" ,
73 : "panel.AnalyticsReferrerViews" ,
74 : "panel.AnalyticsPosts" ,
75 : "panel.AnalyticsMemory" ,
76 : "panel.AnalyticsActiveMemory" ,
77 : "panel.AnalyticsTopics" ,
78 : "panel.AnalyticsForums" ,
79 : "panel.AnalyticsPerf" ,
80 : "panel.Groups" ,
81 : "panel.GroupsEdit" ,
82 : "panel.GroupsEditPromotions" ,
83 : "panel.GroupsPromotionsCreateSubmit" ,
84 : "panel.GroupsPromotionsDeleteSubmit" ,
85 : "panel.GroupsEditPerms" ,
86 : "panel.GroupsEditSubmit" ,
87 : "panel.GroupsEditPermsSubmit" ,
88 : "panel.GroupsCreateSubmit" ,
89 : "panel.Backups" ,
90 : "panel.LogsRegs" ,
91 : "panel.LogsMod" ,
92 : "panel.LogsAdmin" ,
93 : "panel.Debug" ,
94 : "panel.Dashboard" ,
95 : "routes.AccountEdit" ,
96 : "routes.AccountEditPassword" ,
97 : "routes.AccountEditPasswordSubmit" ,
98 : "routes.AccountEditAvatarSubmit" ,
99 : "routes.AccountEditRevokeAvatarSubmit" ,
100 : "routes.AccountEditUsernameSubmit" ,
101 : "routes.AccountEditPrivacy" ,
102 : "routes.AccountEditPrivacySubmit" ,
103 : "routes.AccountEditMFA" ,
104 : "routes.AccountEditMFASetup" ,
105 : "routes.AccountEditMFASetupSubmit" ,
106 : "routes.AccountEditMFADisableSubmit" ,
107 : "routes.AccountEditEmail" ,
108 : "routes.AccountEditEmailTokenSubmit" ,
109 : "routes.AccountLogins" ,
110 : "routes.AccountBlocked" ,
111 : "routes.LevelList" ,
112 : "routes.Convos" ,
113 : "routes.ConvosCreate" ,
114 : "routes.Convo" ,
115 : "routes.ConvosCreateSubmit" ,
116 : "routes.ConvosCreateReplySubmit" ,
117 : "routes.ConvosDeleteReplySubmit" ,
118 : "routes.ConvosEditReplySubmit" ,
119 : "routes.RelationsBlockCreate" ,
120 : "routes.RelationsBlockCreateSubmit" ,
121 : "routes.RelationsBlockRemove" ,
122 : "routes.RelationsBlockRemoveSubmit" ,
123 : "routes.ViewProfile" ,
124 : "routes.BanUserSubmit" ,
125 : "routes.UnbanUser" ,
126 : "routes.ActivateUser" ,
127 : "routes.IPSearch" ,
128 : "routes.DeletePostsSubmit" ,
129 : "routes.CreateTopicSubmit" ,
130 : "routes.EditTopicSubmit" ,
131 : "routes.DeleteTopicSubmit" ,
132 : "routes.StickTopicSubmit" ,
133 : "routes.UnstickTopicSubmit" ,
134 : "routes.LockTopicSubmit" ,
135 : "routes.UnlockTopicSubmit" ,
136 : "routes.MoveTopicSubmit" ,
137 : "routes.LikeTopicSubmit" ,
138 : "routes.UnlikeTopicSubmit" ,
139 : "routes.AddAttachToTopicSubmit" ,
140 : "routes.RemoveAttachFromTopicSubmit" ,
141 : "routes.ViewTopic" ,
142 : "routes.CreateReplySubmit" ,
143 : "routes.ReplyEditSubmit" ,
144 : "routes.ReplyDeleteSubmit" ,
145 : "routes.ReplyLikeSubmit" ,
146 : "routes.ReplyUnlikeSubmit" ,
147 : "routes.AddAttachToReplySubmit" ,
148 : "routes.RemoveAttachFromReplySubmit" ,
149 : "routes.ProfileReplyCreateSubmit" ,
150 : "routes.ProfileReplyEditSubmit" ,
151 : "routes.ProfileReplyDeleteSubmit" ,
152 : "routes.PollVote" ,
153 : "routes.PollResults" ,
154 : "routes.AccountLogin" ,
155 : "routes.AccountRegister" ,
156 : "routes.AccountLogout" ,
157 : "routes.AccountLoginSubmit" ,
158 : "routes.AccountLoginMFAVerify" ,
159 : "routes.AccountLoginMFAVerifySubmit" ,
160 : "routes.AccountRegisterSubmit" ,
161 : "routes.AccountPasswordReset" ,
162 : "routes.AccountPasswordResetSubmit" ,
163 : "routes.AccountPasswordResetToken" ,
164 : "routes.AccountPasswordResetTokenSubmit" ,
165 : "routes.DynamicRoute" ,
166 : "routes.UploadedFile" ,
167 : "routes.StaticFile" ,
168 : "routes.RobotsTxt" ,
169 : "routes.SitemapXml" ,
170 : "routes.OpenSearchXml" ,
171 : "routes.Favicon" ,
172 : "routes.BadRoute" ,
173 : "routes.HTTPSRedirect" ,
2018-02-04 08:15:20 +00:00
}
var osMapEnum = map [ string ] int {
"unknown" : 0 ,
"windows" : 1 ,
"linux" : 2 ,
"mac" : 3 ,
"android" : 4 ,
"iphone" : 5 ,
}
var reverseOSMapEnum = map [ int ] string {
0 : "unknown" ,
1 : "windows" ,
2 : "linux" ,
3 : "mac" ,
4 : "android" ,
5 : "iphone" ,
2018-01-09 07:39:29 +00:00
}
var agentMapEnum = map [ string ] int {
"unknown" : 0 ,
"firefox" : 1 ,
"chrome" : 2 ,
"opera" : 3 ,
"safari" : 4 ,
"edge" : 5 ,
2018-01-09 08:46:16 +00:00
"internetexplorer" : 6 ,
2018-02-04 08:15:20 +00:00
"trident" : 7 ,
"androidchrome" : 8 ,
"mobilesafari" : 9 ,
"samsung" : 10 ,
"ucbrowser" : 11 ,
"googlebot" : 12 ,
"yandex" : 13 ,
"bing" : 14 ,
2020-03-07 03:25:50 +00:00
"slurp" : 15 ,
"exabot" : 16 ,
2020-03-11 08:54:11 +00:00
"mojeek" : 17 ,
2020-03-13 06:37:18 +00:00
"cliqz" : 18 ,
2020-03-21 07:44:33 +00:00
"datenbank" : 19 ,
"baidu" : 20 ,
"sogou" : 21 ,
"toutiao" : 22 ,
"haosou" : 23 ,
"duckduckgo" : 24 ,
"seznambot" : 25 ,
"discord" : 26 ,
2020-05-28 22:41:19 +00:00
"telegram" : 27 ,
"twitter" : 28 ,
"facebook" : 29 ,
"cloudflare" : 30 ,
"archive_org" : 31 ,
"uptimebot" : 32 ,
"slackbot" : 33 ,
"apple" : 34 ,
"discourse" : 35 ,
"mattermost" : 36 ,
"alexa" : 37 ,
"lynx" : 38 ,
"blank" : 39 ,
"malformed" : 40 ,
"suspicious" : 41 ,
"semrush" : 42 ,
"dotbot" : 43 ,
"ahrefs" : 44 ,
"proximic" : 45 ,
"megaindex" : 46 ,
"majestic" : 47 ,
"cocolyze" : 48 ,
"babbar" : 49 ,
"surdotly" : 50 ,
"domcop" : 51 ,
"netcraft" : 52 ,
"blexbot" : 53 ,
"burf" : 54 ,
"aspiegel" : 55 ,
"mail_ru" : 56 ,
"ccbot" : 57 ,
"zgrab" : 58 ,
"cloudsystemnetworks" : 59 ,
"maui" : 60 ,
"curl" : 61 ,
"python" : 62 ,
"go" : 63 ,
"headlesschrome" : 64 ,
"awesome_bot" : 65 ,
2018-01-09 07:39:29 +00:00
}
var reverseAgentMapEnum = map [ int ] string {
0 : "unknown" ,
1 : "firefox" ,
2 : "chrome" ,
3 : "opera" ,
4 : "safari" ,
5 : "edge" ,
2018-01-09 08:46:16 +00:00
6 : "internetexplorer" ,
2018-02-04 08:15:20 +00:00
7 : "trident" ,
8 : "androidchrome" ,
9 : "mobilesafari" ,
10 : "samsung" ,
11 : "ucbrowser" ,
12 : "googlebot" ,
13 : "yandex" ,
14 : "bing" ,
2020-03-07 03:25:50 +00:00
15 : "slurp" ,
16 : "exabot" ,
2020-03-11 08:54:11 +00:00
17 : "mojeek" ,
2020-03-13 06:37:18 +00:00
18 : "cliqz" ,
2020-03-21 07:44:33 +00:00
19 : "datenbank" ,
20 : "baidu" ,
21 : "sogou" ,
22 : "toutiao" ,
23 : "haosou" ,
24 : "duckduckgo" ,
25 : "seznambot" ,
26 : "discord" ,
2020-05-28 22:41:19 +00:00
27 : "telegram" ,
28 : "twitter" ,
29 : "facebook" ,
30 : "cloudflare" ,
31 : "archive_org" ,
32 : "uptimebot" ,
33 : "slackbot" ,
34 : "apple" ,
35 : "discourse" ,
36 : "mattermost" ,
37 : "alexa" ,
38 : "lynx" ,
39 : "blank" ,
40 : "malformed" ,
41 : "suspicious" ,
42 : "semrush" ,
43 : "dotbot" ,
44 : "ahrefs" ,
45 : "proximic" ,
46 : "megaindex" ,
47 : "majestic" ,
48 : "cocolyze" ,
49 : "babbar" ,
50 : "surdotly" ,
51 : "domcop" ,
52 : "netcraft" ,
53 : "blexbot" ,
54 : "burf" ,
55 : "aspiegel" ,
56 : "mail_ru" ,
57 : "ccbot" ,
58 : "zgrab" ,
59 : "cloudsystemnetworks" ,
60 : "maui" ,
61 : "curl" ,
62 : "python" ,
63 : "go" ,
64 : "headlesschrome" ,
65 : "awesome_bot" ,
2017-12-19 03:53:13 +00:00
}
2018-12-31 09:03:49 +00:00
var markToAgent = map [ string ] string {
"OPR" : "opera" ,
"Chrome" : "chrome" ,
"Firefox" : "firefox" ,
2020-03-08 04:36:27 +00:00
"Safari" : "safari" ,
2018-12-31 09:03:49 +00:00
"MSIE" : "internetexplorer" ,
"Trident" : "trident" ,
"Edge" : "edge" ,
"Lynx" : "lynx" ,
"SamsungBrowser" : "samsung" ,
"UCBrowser" : "ucbrowser" ,
"Google" : "googlebot" ,
"Googlebot" : "googlebot" ,
"yandex" : "yandex" ,
"DuckDuckBot" : "duckduckgo" ,
2020-03-09 10:49:22 +00:00
"DuckDuckGo" : "duckduckgo" ,
2018-12-31 09:03:49 +00:00
"Baiduspider" : "baidu" ,
2020-03-07 03:25:50 +00:00
"Sogou" : "sogou" ,
2020-03-07 05:28:25 +00:00
"ToutiaoSpider" : "toutiao" ,
2020-03-08 00:50:23 +00:00
"360Spider" : "haosou" ,
2018-12-31 09:03:49 +00:00
"bingbot" : "bing" ,
"BingPreview" : "bing" ,
2020-03-18 21:21:06 +00:00
"msnbot" : "bing" ,
2020-03-07 03:25:50 +00:00
"Slurp" : "slurp" ,
"Exabot" : "exabot" ,
2020-03-11 08:54:11 +00:00
"MojeekBot" : "mojeek" ,
2020-03-13 06:37:18 +00:00
"Cliqzbot" : "cliqz" ,
2020-03-21 07:44:33 +00:00
"netEstate" : "datenbank" ,
2018-12-31 09:03:49 +00:00
"SeznamBot" : "seznambot" ,
"CloudFlare" : "cloudflare" ,
2020-03-08 00:50:23 +00:00
"archive" : "archive_org" ,
2018-12-31 09:03:49 +00:00
"Uptimebot" : "uptimebot" ,
"Slackbot" : "slackbot" ,
2020-03-07 05:28:25 +00:00
"Slack" : "slackbot" ,
2018-12-31 09:03:49 +00:00
"Discordbot" : "discord" ,
2020-05-28 22:41:19 +00:00
"TelegramBot" : "telegram" ,
2018-12-31 09:03:49 +00:00
"Twitterbot" : "twitter" ,
2019-03-03 02:28:17 +00:00
"facebookexternalhit" : "facebook" ,
"Facebot" : "facebook" ,
2019-06-01 02:03:04 +00:00
"Applebot" : "apple" ,
2018-12-31 09:03:49 +00:00
"Discourse" : "discourse" ,
2020-03-28 05:39:05 +00:00
"mattermost" : "mattermost" ,
2020-03-07 03:25:50 +00:00
"ia_archiver" : "alexa" ,
2019-02-10 09:32:05 +00:00
"SemrushBot" : "semrush" ,
2019-02-23 06:29:19 +00:00
"DotBot" : "dotbot" ,
2020-03-07 11:08:25 +00:00
"AhrefsBot" : "ahrefs" ,
2020-03-08 00:50:23 +00:00
"proximic" : "proximic" ,
2020-04-09 09:30:51 +00:00
"MegaIndex" : "megaindex" ,
2020-03-07 10:46:27 +00:00
"MJ12bot" : "majestic" ,
2020-04-04 09:03:11 +00:00
"mj12bot" : "majestic" ,
2020-05-26 21:08:13 +00:00
"Cocolyzebot" : "cocolyze" ,
"Barkrowler" : "babbar" ,
"SurdotlyBot" : "surdotly" ,
2020-05-28 22:41:19 +00:00
"DomCopBot" : "domcop" ,
2020-04-04 09:03:11 +00:00
"NetcraftSurveyAgent" : "netcraft" ,
2020-03-13 06:37:18 +00:00
"BLEXBot" : "blexbot" ,
2020-04-04 09:03:11 +00:00
"Burf" : "burf" ,
2020-03-07 03:25:50 +00:00
"AspiegelBot" : "aspiegel" ,
2020-03-08 00:50:23 +00:00
"RU_Bot" : "mail_ru" ,
2020-03-31 13:10:29 +00:00
"CCBot" : "ccbot" ,
2018-12-31 09:03:49 +00:00
"zgrab" : "zgrab" ,
2020-04-04 09:03:11 +00:00
"Nimbostratus" : "cloudsystemnetworks" ,
2020-05-28 22:41:19 +00:00
"MauiBot" : "maui" ,
2020-03-13 06:37:18 +00:00
"curl" : "curl" ,
2020-03-22 04:37:45 +00:00
"python" : "python" ,
"Go" : "go" ,
2020-04-12 08:33:24 +00:00
"HeadlessChrome" : "headlesschrome" ,
2020-05-26 21:08:13 +00:00
"awesome_bot" : "awesome_bot" ,
2018-02-03 05:47:14 +00:00
}
2020-03-08 04:15:27 +00:00
var markToID = map [ string ] int {
"OPR" : 3 ,
"Chrome" : 2 ,
"Firefox" : 1 ,
2020-03-08 04:36:27 +00:00
"Safari" : 4 ,
2020-03-08 04:15:27 +00:00
"MSIE" : 6 ,
"Trident" : 7 ,
"Edge" : 5 ,
2020-05-28 22:41:19 +00:00
"Lynx" : 38 ,
2020-03-08 04:15:27 +00:00
"SamsungBrowser" : 10 ,
"UCBrowser" : 11 ,
"Google" : 12 ,
"Googlebot" : 12 ,
"yandex" : 13 ,
2020-03-21 07:44:33 +00:00
"DuckDuckBot" : 24 ,
"DuckDuckGo" : 24 ,
"Baiduspider" : 20 ,
"Sogou" : 21 ,
"ToutiaoSpider" : 22 ,
"360Spider" : 23 ,
2020-03-08 04:15:27 +00:00
"bingbot" : 14 ,
"BingPreview" : 14 ,
2020-03-18 21:21:06 +00:00
"msnbot" : 14 ,
2020-03-08 04:15:27 +00:00
"Slurp" : 15 ,
"Exabot" : 16 ,
2020-03-11 08:54:11 +00:00
"MojeekBot" : 17 ,
2020-03-13 06:37:18 +00:00
"Cliqzbot" : 18 ,
2020-03-21 07:44:33 +00:00
"netEstate" : 19 ,
"SeznamBot" : 25 ,
2020-05-28 22:41:19 +00:00
"CloudFlare" : 30 ,
"archive" : 31 ,
"Uptimebot" : 32 ,
"Slackbot" : 33 ,
"Slack" : 33 ,
2020-03-21 07:44:33 +00:00
"Discordbot" : 26 ,
2020-05-28 22:41:19 +00:00
"TelegramBot" : 27 ,
"Twitterbot" : 28 ,
"facebookexternalhit" : 29 ,
"Facebot" : 29 ,
"Applebot" : 34 ,
"Discourse" : 35 ,
"mattermost" : 36 ,
"ia_archiver" : 37 ,
"SemrushBot" : 42 ,
"DotBot" : 43 ,
"AhrefsBot" : 44 ,
"proximic" : 45 ,
"MegaIndex" : 46 ,
"MJ12bot" : 47 ,
"mj12bot" : 47 ,
"Cocolyzebot" : 48 ,
"Barkrowler" : 49 ,
"SurdotlyBot" : 50 ,
"DomCopBot" : 51 ,
"NetcraftSurveyAgent" : 52 ,
"BLEXBot" : 53 ,
"Burf" : 54 ,
"AspiegelBot" : 55 ,
"RU_Bot" : 56 ,
"CCBot" : 57 ,
"zgrab" : 58 ,
"Nimbostratus" : 59 ,
"MauiBot" : 60 ,
"curl" : 61 ,
"python" : 62 ,
"Go" : 63 ,
"HeadlessChrome" : 64 ,
"awesome_bot" : 65 ,
2020-03-08 04:15:27 +00:00
}
2018-02-03 05:47:14 +00:00
/ * var agentRank = map [ string ] int {
"opera" : 9 ,
"chrome" : 8 ,
"safari" : 1 ,
} * /
2017-12-19 03:53:13 +00:00
// TODO: Stop spilling these into the package scope?
func init ( ) {
2020-02-28 23:11:07 +00:00
_ = time . Now ( )
2019-10-29 07:13:04 +00:00
co . SetRouteMapEnum ( routeMapEnum )
co . SetReverseRouteMapEnum ( reverseRouteMapEnum )
co . SetAgentMapEnum ( agentMapEnum )
co . SetReverseAgentMapEnum ( reverseAgentMapEnum )
co . SetOSMapEnum ( osMapEnum )
co . SetReverseOSMapEnum ( reverseOSMapEnum )
2020-03-08 04:15:27 +00:00
c . Chrome = agentMapEnum [ "chrome" ]
c . Firefox = agentMapEnum [ "firefox" ]
2020-03-22 06:24:31 +00:00
ame := agentMapEnum
2020-03-22 04:37:45 +00:00
c . SimpleBots = [ ] int {
2020-03-22 06:24:31 +00:00
ame [ "semrush" ] ,
ame [ "ahrefs" ] ,
ame [ "python" ] ,
ame [ "go" ] ,
ame [ "curl" ] ,
2020-03-22 04:37:45 +00:00
}
2017-12-19 03:53:13 +00:00
}
2018-08-23 12:18:15 +00:00
type WriterIntercept struct {
2018-08-24 06:24:27 +00:00
http . ResponseWriter
2018-08-23 12:18:15 +00:00
}
func NewWriterIntercept ( w http . ResponseWriter ) * WriterIntercept {
2018-08-24 06:24:27 +00:00
return & WriterIntercept { w }
2018-08-23 12:18:15 +00:00
}
2019-04-19 07:16:09 +00:00
var wiMaxAge = "max-age=" + strconv . Itoa ( int ( c . Day ) )
2020-03-12 06:52:26 +00:00
func ( wi * WriterIntercept ) WriteHeader ( code int ) {
2018-08-24 06:24:27 +00:00
if code == 200 {
2020-03-12 06:52:26 +00:00
h := wi . ResponseWriter . Header ( )
2019-07-12 08:33:25 +00:00
h . Set ( "Cache-Control" , wiMaxAge )
h . Set ( "Vary" , "Accept-Encoding" )
2018-08-24 06:24:27 +00:00
}
2020-03-12 06:52:26 +00:00
wi . ResponseWriter . WriteHeader ( code )
2018-08-23 12:18:15 +00:00
}
2019-03-21 22:59:41 +00:00
// HTTPSRedirect is a connection handler which redirects all HTTP requests to HTTPS
2019-07-12 08:33:25 +00:00
type HTTPSRedirect struct { }
2019-03-21 22:59:41 +00:00
func ( red * HTTPSRedirect ) ServeHTTP ( w http . ResponseWriter , req * http . Request ) {
w . Header ( ) . Set ( "Connection" , "close" )
2020-02-28 04:52:45 +00:00
co . RouteViewCounter . Bump ( 173 )
2019-03-21 22:59:41 +00:00
dest := "https://" + req . Host + req . URL . String ( )
http . Redirect ( w , req , dest , http . StatusTemporaryRedirect )
}
2017-04-12 13:39:03 +00:00
type GenRouter struct {
UploadHandler func ( http . ResponseWriter , * http . Request )
2020-03-18 09:21:34 +00:00
extraRoutes map [ string ] func ( http . ResponseWriter , * http . Request , * c . User ) c . RouteError
2018-04-03 04:34:07 +00:00
requestLogger * log . Logger
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
sync . RWMutex
2017-04-12 13:39:03 +00:00
}
2018-04-03 04:34:07 +00:00
func NewGenRouter ( uploads http . Handler ) ( * GenRouter , error ) {
2019-04-19 07:16:09 +00:00
f , err := os . OpenFile ( "./logs/reqs-" + strconv . FormatInt ( c . StartTime . Unix ( ) , 10 ) + ".log" , os . O_WRONLY | os . O_APPEND | os . O_CREATE , 0755 )
2018-04-03 04:34:07 +00:00
if err != nil {
return nil , err
}
2017-04-12 13:39:03 +00:00
return & GenRouter {
2020-05-28 22:41:19 +00:00
UploadHandler : func ( w http . ResponseWriter , r * http . Request ) {
2018-08-23 12:18:15 +00:00
writ := NewWriterIntercept ( w )
2020-05-28 22:41:19 +00:00
http . StripPrefix ( "/uploads/" , uploads ) . ServeHTTP ( writ , r )
2018-03-31 05:25:27 +00:00
} ,
2020-03-18 09:21:34 +00:00
extraRoutes : make ( map [ string ] func ( http . ResponseWriter , * http . Request , * c . User ) c . RouteError ) ,
2018-04-03 04:34:07 +00:00
requestLogger : log . New ( f , "" , log . LstdFlags ) ,
} , nil
2017-04-12 13:39:03 +00:00
}
2020-03-22 04:37:45 +00:00
func ( r * GenRouter ) handleError ( err c . RouteError , w http . ResponseWriter , req * http . Request , u * c . User ) {
2017-10-30 09:57:08 +00:00
if err . Handled ( ) {
return
}
if err . Type ( ) == "system" {
2019-04-19 07:16:09 +00:00
c . InternalErrorJSQ ( err , w , req , err . JSON ( ) )
2017-10-30 09:57:08 +00:00
return
}
2020-03-22 04:37:45 +00:00
c . LocalErrorJSQ ( err . Error ( ) , w , req , u , err . JSON ( ) )
2017-10-30 09:57:08 +00:00
}
2018-11-13 06:51:34 +00:00
func ( r * GenRouter ) Handle ( _ string , _ http . Handler ) {
2017-04-12 13:39:03 +00:00
}
2020-03-18 09:21:34 +00:00
func ( r * GenRouter ) HandleFunc ( pattern string , h func ( http . ResponseWriter , * http . Request , * c . User ) c . RouteError ) {
2018-11-13 06:51:34 +00:00
r . Lock ( )
defer r . Unlock ( )
2020-02-25 04:25:50 +00:00
r . extraRoutes [ pattern ] = h
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
}
2018-11-13 06:51:34 +00:00
func ( r * GenRouter ) RemoveFunc ( pattern string ) error {
r . Lock ( )
defer r . Unlock ( )
_ , ok := r . extraRoutes [ pattern ]
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if ! ok {
return ErrNoRoute
}
2018-11-13 06:51:34 +00:00
delete ( r . extraRoutes , pattern )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
return nil
2017-04-12 13:39:03 +00:00
}
2020-03-08 04:15:27 +00:00
// TODO: Use strings builder?
func ( r * GenRouter ) DumpRequest ( req * http . Request , pre string ) {
2018-02-26 09:07:00 +00:00
var heads string
2018-01-27 07:30:44 +00:00
for key , value := range req . Header {
for _ , vvalue := range value {
2020-03-28 05:39:05 +00:00
heads += "Head " + c . SanitiseSingleLine ( key ) + ": " + c . SanitiseSingleLine ( vvalue ) + "\n"
2018-01-27 07:30:44 +00:00
}
}
2018-02-26 09:07:00 +00:00
2020-03-08 04:15:27 +00:00
r . requestLogger . Print ( pre +
2019-04-19 07:16:09 +00:00
"\nUA: " + c . SanitiseSingleLine ( req . UserAgent ( ) ) + "\n" +
"Method: " + c . SanitiseSingleLine ( req . Method ) + "\n" + heads +
2020-02-25 04:25:50 +00:00
"Host: " + c . SanitiseSingleLine ( req . Host ) + "\n" +
"URL.Path: " + c . SanitiseSingleLine ( req . URL . Path ) + "\n" +
"URL.RawQuery: " + c . SanitiseSingleLine ( req . URL . RawQuery ) + "\n" +
2020-03-07 05:28:25 +00:00
"Ref: " + c . SanitiseSingleLine ( req . Referer ( ) ) + "\n" +
"IP: " + req . RemoteAddr + "\n" )
2018-01-27 07:30:44 +00:00
}
2020-03-08 04:15:27 +00:00
func ( r * GenRouter ) SuspiciousRequest ( req * http . Request , pre string ) {
if pre != "" {
pre += "\n"
2018-04-03 04:34:07 +00:00
}
2020-03-08 04:15:27 +00:00
r . DumpRequest ( req , pre + "Suspicious Request" )
2020-05-28 22:41:19 +00:00
co . AgentViewCounter . Bump ( 41 )
2018-01-27 07:30:44 +00:00
}
2020-02-25 04:25:50 +00:00
func isLocalHost ( h string ) bool {
return h == "localhost" || h == "127.0.0.1" || h == "::1"
2019-04-01 05:44:38 +00:00
}
2020-05-26 21:08:13 +00:00
//var brPool = sync.Pool{}
2020-04-13 04:54:47 +00:00
var gzipPool = sync . Pool { }
2020-05-26 21:08:13 +00:00
//var uaBufPool = sync.Pool{}
2020-04-13 04:54:47 +00:00
2018-06-17 07:28:18 +00:00
// TODO: Pass the default path or config struct to the router rather than accessing it via a package global
// TODO: SetDefaultPath
// TODO: GetDefaultPath
2018-11-13 06:51:34 +00:00
func ( r * GenRouter ) ServeHTTP ( w http . ResponseWriter , req * http . Request ) {
2019-10-29 07:13:04 +00:00
malformedRequest := func ( typ int ) {
2019-04-01 05:44:38 +00:00
w . WriteHeader ( 200 ) // 400
w . Write ( [ ] byte ( "" ) )
2019-04-14 00:13:32 +00:00
r . DumpRequest ( req , "Malformed Request T" + strconv . Itoa ( typ ) )
2020-05-28 22:41:19 +00:00
co . AgentViewCounter . Bump ( 40 )
2019-04-01 05:44:38 +00:00
}
// Split the Host and Port string
var shost , sport string
if req . Host [ 0 ] == '[' {
spl := strings . Split ( req . Host , "]" )
if len ( spl ) > 2 {
2019-04-14 00:13:32 +00:00
malformedRequest ( 0 )
2019-04-01 05:44:38 +00:00
return
}
shost = strings . TrimPrefix ( spl [ 0 ] , "[" )
sport = strings . TrimPrefix ( spl [ 1 ] , ":" )
2020-03-27 06:05:35 +00:00
} else if strings . Contains ( req . Host , ":" ) {
2019-04-01 05:44:38 +00:00
spl := strings . Split ( req . Host , ":" )
if len ( spl ) > 2 {
2019-04-14 00:13:32 +00:00
malformedRequest ( 1 )
2019-04-01 05:44:38 +00:00
return
}
shost = spl [ 0 ]
2020-03-27 06:05:35 +00:00
//if len(spl)==2 {
2019-04-01 05:44:38 +00:00
sport = spl [ 1 ]
2020-03-27 06:05:35 +00:00
//}
} else {
shost = req . Host
2019-04-01 05:44:38 +00:00
}
// TODO: Reject requests from non-local IPs, if the site host is set to localhost or a localhost IP
2019-04-19 07:16:09 +00:00
if ! c . Config . LoosePort && c . Site . PortInt != 80 && c . Site . PortInt != 443 && sport != c . Site . Port {
2019-04-14 00:13:32 +00:00
malformedRequest ( 2 )
2019-04-01 05:44:38 +00:00
return
}
// Redirect www. and local IP requests to the right place
2020-03-06 03:07:28 +00:00
if strings . HasPrefix ( shost , "www." ) || c . Site . LocalHost {
2019-04-19 07:16:09 +00:00
if shost == "www." + c . Site . Host || ( c . Site . LocalHost && shost != c . Site . Host && isLocalHost ( shost ) ) {
2019-03-31 01:50:59 +00:00
// TODO: Abstract the redirect logic?
2018-01-28 14:30:24 +00:00
w . Header ( ) . Set ( "Connection" , "close" )
var s string
2019-11-04 11:55:52 +00:00
if c . Config . SslSchema {
2018-01-28 14:30:24 +00:00
s = "s"
}
2019-04-01 05:44:38 +00:00
var p string
2019-04-19 07:16:09 +00:00
if c . Site . PortInt != 80 && c . Site . PortInt != 443 {
p = ":" + c . Site . Port
2019-04-01 05:44:38 +00:00
}
2019-04-19 07:16:09 +00:00
dest := "http" + s + "://" + c . Site . Host + p + req . URL . Path
2018-01-28 14:30:24 +00:00
if len ( req . URL . RawQuery ) > 0 {
dest += "?" + req . URL . RawQuery
}
http . Redirect ( w , req , dest , http . StatusMovedPermanently )
return
}
2020-03-06 03:07:28 +00:00
}
2018-01-28 14:30:24 +00:00
// Deflect malformed requests
2019-04-19 07:16:09 +00:00
if len ( req . URL . Path ) == 0 || req . URL . Path [ 0 ] != '/' || ( ! c . Config . LooseHost && shost != c . Site . Host ) {
2019-04-14 00:13:32 +00:00
malformedRequest ( 3 )
2017-04-12 13:39:03 +00:00
return
}
2019-04-19 07:16:09 +00:00
if c . Dev . FullReqLog {
2019-03-16 12:50:31 +00:00
r . DumpRequest ( req , "" )
}
2018-01-18 12:51:35 +00:00
2018-02-26 09:07:00 +00:00
// TODO: Cover more suspicious strings and at a lower layer than this
2019-11-04 11:55:52 +00:00
for _ , ch := range req . URL . Path { //char
if ch != '&' && ! ( ch > 44 && ch < 58 ) && ch != '=' && ch != '?' && ! ( ch > 64 && ch < 91 ) && ch != '\\' && ch != '_' && ! ( ch > 96 && ch < 123 ) {
2020-03-27 06:05:35 +00:00
r . SuspiciousRequest ( req , "Bad char '" + string ( ch ) + "' in path" )
2018-03-08 03:59:47 +00:00
break
2018-01-17 11:13:08 +00:00
}
2018-03-08 03:59:47 +00:00
}
2020-02-26 10:34:38 +00:00
lp := strings . ToLower ( req . URL . Path )
2018-03-08 03:59:47 +00:00
// TODO: Flag any requests which has a dot with anything but a number after that
2020-03-27 06:05:35 +00:00
// TODO: Use HasSuffix to avoid over-scanning?
2020-05-26 21:08:13 +00:00
if strings . Contains ( lp , ".." ) /* || strings.Contains(lp,"--")*/ || strings . Contains ( lp , ".php" ) || strings . Contains ( lp , ".asp" ) || strings . Contains ( lp , ".cgi" ) || strings . Contains ( lp , ".py" ) || strings . Contains ( lp , ".sql" ) || strings . Contains ( lp , ".act" ) { //.action
2018-11-13 06:51:34 +00:00
r . SuspiciousRequest ( req , "Bad snippet in path" )
2018-03-08 03:59:47 +00:00
}
2018-06-17 07:28:18 +00:00
// Indirect the default route onto a different one
if req . URL . Path == "/" {
2019-04-19 07:16:09 +00:00
req . URL . Path = c . Config . DefaultPath
2018-06-17 07:28:18 +00:00
}
2020-02-26 10:34:38 +00:00
//log.Print("URL.Path: ", req.URL.Path)
2020-03-22 06:24:31 +00:00
prefix := req . URL . Path [ 0 : strings . IndexByte ( req . URL . Path [ 1 : ] , '/' ) + 1 ]
2018-08-21 08:00:35 +00:00
2019-04-10 07:40:47 +00:00
// TODO: Use the same hook table as downstream
2019-04-19 07:16:09 +00:00
hTbl := c . GetHookTable ( )
2020-05-26 21:08:13 +00:00
skip , ferr := c . H_router_after_filters_hook ( hTbl , w , req , prefix )
2019-04-10 07:40:47 +00:00
if skip || ferr != nil {
return
}
2018-08-21 08:00:35 +00:00
if prefix != "/ws" {
h := w . Header ( )
h . Set ( "X-Frame-Options" , "deny" )
h . Set ( "X-XSS-Protection" , "1; mode=block" ) // TODO: Remove when we add a CSP? CSP's are horrendously glitchy things, tread with caution before removing
h . Set ( "X-Content-Type-Options" , "nosniff" )
2019-11-04 11:55:52 +00:00
if c . Config . RefNoRef || ! c . Config . SslSchema {
2019-08-14 10:39:04 +00:00
h . Set ( "Referrer-Policy" , "no-referrer" )
} else {
h . Set ( "Referrer-Policy" , "strict-origin" )
}
2018-08-21 08:00:35 +00:00
}
2017-08-06 15:22:18 +00:00
2019-04-19 07:16:09 +00:00
if c . Dev . SuperDebug {
2018-11-13 06:51:34 +00:00
r . DumpRequest ( req , "before routes.StaticFile" )
2017-08-06 15:22:18 +00:00
}
2018-02-19 04:26:01 +00:00
// Increment the request counter
2020-02-26 10:34:38 +00:00
if ! c . Config . DisableAnalytics {
co . GlobalViewCounter . Bump ( )
}
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
2019-08-14 10:39:04 +00:00
if prefix == "/s" { //old prefix: /static
2020-02-26 10:34:38 +00:00
if ! c . Config . DisableAnalytics {
2020-02-28 04:52:45 +00:00
co . RouteViewCounter . Bump ( 167 )
2020-02-26 10:34:38 +00:00
}
2018-02-03 05:47:14 +00:00
routes . StaticFile ( w , req )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
return
}
2020-03-27 06:05:35 +00:00
// TODO: Handle JS routes
2019-04-19 07:16:09 +00:00
if atomic . LoadInt32 ( & c . IsDBDown ) == 1 {
c . DatabaseError ( w , req )
2018-07-15 10:29:31 +00:00
return
}
2019-04-19 07:16:09 +00:00
if c . Dev . SuperDebug {
2018-11-13 06:51:34 +00:00
r . requestLogger . Print ( "before PreRoute" )
2017-07-17 10:23:42 +00:00
}
2017-12-10 03:43:30 +00:00
2020-02-23 09:08:47 +00:00
/ * if c . Dev . QuicPort != 0 {
w . Header ( ) . Set ( "Alt-Svc" , "quic=\":" + strconv . Itoa ( c . Dev . QuicPort ) + "\"; ma=2592000; v=\"44,43,39\", h3-23=\":" + strconv . Itoa ( c . Dev . QuicPort ) + "\"; ma=3600, h3-24=\":" + strconv . Itoa ( c . Dev . QuicPort ) + "\"; ma=3600, h2=\":443\"; ma=3600" )
} * /
2018-01-09 07:39:29 +00:00
// Track the user agents. Unfortunately, everyone pretends to be Mozilla, so this'll be a little less efficient than I would like.
// TODO: Add a setting to disable this?
// TODO: Use a more efficient detector instead of smashing every possible combination in
2020-03-08 04:15:27 +00:00
var agent int
2020-02-26 10:34:38 +00:00
if ! c . Config . DisableAnalytics {
ua := strings . TrimSpace ( strings . Replace ( strings . TrimPrefix ( req . UserAgent ( ) , "Mozilla/5.0 " ) , " Safari/537.36" , "" , - 1 ) ) // Noise, no one's going to be running this and it would require some sort of agent ranking system to determine which identifier should be prioritised over another
2018-02-03 05:47:14 +00:00
if ua == "" {
2020-05-28 22:41:19 +00:00
co . AgentViewCounter . Bump ( 39 )
2019-04-19 07:16:09 +00:00
if c . Dev . DebugMode {
2020-03-08 04:15:27 +00:00
var pre string
2018-03-08 03:59:47 +00:00
for _ , char := range req . UserAgent ( ) {
2020-03-08 04:15:27 +00:00
pre += strconv . Itoa ( int ( char ) ) + " "
2018-03-08 03:59:47 +00:00
}
2020-03-08 04:15:27 +00:00
r . DumpRequest ( req , "Blank UA: " + pre )
2018-01-11 09:29:25 +00:00
}
2018-12-31 09:03:49 +00:00
} else {
2018-02-03 05:47:14 +00:00
// WIP UA Parser
2020-05-26 21:08:13 +00:00
//var ii = uaBufPool.Get()
var buf [ ] byte
//if ii != nil {
// buf = ii.([]byte)
//}
2018-02-03 05:47:14 +00:00
var items [ ] string
2020-02-28 05:47:43 +00:00
var os int
2020-02-28 23:11:07 +00:00
for _ , it := range uutils . StringToBytes ( ua ) {
2020-03-08 08:04:37 +00:00
if ( it > 64 && it < 91 ) || ( it > 96 && it < 123 ) || it == '_' {
2020-03-27 06:05:35 +00:00
// TODO: Store an index and slice that instead?
2020-05-26 21:08:13 +00:00
buf = append ( buf , it )
} else if it == ' ' || it == '(' || it == ')' || it == '-' || ( it > 47 && it < 58 ) || it == ';' || it == ':' || it == '.' || it == '+' || it == '~' || it == '@' /*|| (it == ':' && bytes.Equal(buf,[]byte("http")))*/ || it == ',' || it == '/' {
if len ( buf ) != 0 {
if len ( buf ) > 2 {
2018-12-31 09:03:49 +00:00
// Use an unsafe zero copy conversion here just to use the switch, it's not safe for this string to escape from here, as it will get mutated, so do a regular string conversion in append
2020-05-26 21:08:13 +00:00
switch ( uutils . BytesToString ( buf ) ) {
2018-12-31 09:03:49 +00:00
case "Windows" :
2020-02-28 05:47:43 +00:00
os = 1
2018-12-31 09:03:49 +00:00
case "Linux" :
2020-02-28 05:47:43 +00:00
os = 2
2018-12-31 09:03:49 +00:00
case "Mac" :
2020-02-28 05:47:43 +00:00
os = 3
2018-12-31 09:03:49 +00:00
case "iPhone" :
2020-02-28 05:47:43 +00:00
os = 5
2018-12-31 09:03:49 +00:00
case "Android" :
2020-02-28 05:47:43 +00:00
os = 4
2020-05-26 21:08:13 +00:00
case "like" , "compatible" , "NT" , "X" , "KHTML" :
2019-02-10 09:32:05 +00:00
// Skip these words
2018-12-31 09:03:49 +00:00
default :
2020-05-26 21:08:13 +00:00
items = append ( items , string ( buf ) )
2018-12-31 09:03:49 +00:00
}
}
2020-05-26 21:08:13 +00:00
buf = buf [ : 0 ]
2018-02-04 08:15:20 +00:00
}
} else {
// TODO: Test this
items = items [ : 0 ]
2020-02-25 04:25:50 +00:00
r . SuspiciousRequest ( req , "Illegal char " + strconv . Itoa ( int ( it ) ) + " in UA" )
2020-05-26 21:08:13 +00:00
r . requestLogger . Print ( "UA Buf: " , buf )
r . requestLogger . Print ( "UA Buf String: " , string ( buf ) )
2018-02-04 08:15:20 +00:00
break
2018-02-03 05:47:14 +00:00
}
}
2020-05-26 21:08:13 +00:00
//uaBufPool.Put(buf)
2018-02-03 05:47:14 +00:00
// Iterate over this in reverse as the real UA tends to be on the right side
for i := len ( items ) - 1 ; i >= 0 ; i -- {
2020-03-08 04:15:27 +00:00
//fAgent, ok := markToAgent[items[i]]
fAgent , ok := markToID [ items [ i ] ]
2018-02-03 05:47:14 +00:00
if ok {
agent = fAgent
2020-03-08 04:15:27 +00:00
if agent != 4 {
2018-02-03 05:47:14 +00:00
break
}
}
}
2019-04-19 07:16:09 +00:00
if c . Dev . SuperDebug {
2018-11-13 06:51:34 +00:00
r . requestLogger . Print ( "parsed agent: " , agent )
r . requestLogger . Print ( "os: " , os )
r . requestLogger . Printf ( "items: %+v\n" , items )
2020-05-26 21:08:13 +00:00
/ * for _ , it := range items {
r . requestLogger . Printf ( "it: %+v\n" , string ( it ) )
} * /
2018-02-03 05:47:14 +00:00
}
// Special handling
switch ( agent ) {
2020-03-08 04:15:27 +00:00
case 2 :
2020-02-28 05:47:43 +00:00
if os == 4 {
2020-03-08 04:15:27 +00:00
agent = 8
2018-02-04 08:15:20 +00:00
}
2020-03-08 04:15:27 +00:00
case 4 :
2020-02-28 05:47:43 +00:00
if os == 5 {
2020-03-08 04:15:27 +00:00
agent = 9
2018-02-04 08:15:20 +00:00
}
2020-03-08 04:15:27 +00:00
case 7 :
2018-02-04 08:15:20 +00:00
// Hack to support IE11, change this after we start logging versions
if strings . Contains ( ua , "rv:11" ) {
2020-03-08 04:15:27 +00:00
agent = 6
2018-02-03 05:47:14 +00:00
}
2020-05-28 22:41:19 +00:00
case 58 :
2020-05-26 21:08:13 +00:00
r . SuspiciousRequest ( req , "Vuln Scanner" )
2018-02-03 05:47:14 +00:00
}
2020-03-08 04:15:27 +00:00
if agent == 0 {
2020-05-26 21:08:13 +00:00
//co.AgentViewCounter.Bump(0)
2019-04-19 07:16:09 +00:00
if c . Dev . DebugMode {
2020-03-08 04:15:27 +00:00
var pre string
2018-03-08 03:59:47 +00:00
for _ , char := range req . UserAgent ( ) {
2020-03-08 04:15:27 +00:00
pre += strconv . Itoa ( int ( char ) ) + " "
2018-03-08 03:59:47 +00:00
}
2020-03-08 04:15:27 +00:00
r . DumpRequest ( req , "Blank UA: " + pre )
2020-03-07 04:20:42 +00:00
} else {
r . requestLogger . Print ( "unknown ua: " , c . SanitiseSingleLine ( ua ) )
2018-02-03 05:47:14 +00:00
}
2020-05-26 21:08:13 +00:00
} // else {
2020-03-08 04:15:27 +00:00
//co.AgentViewCounter.Bump(agentMapEnum[agent])
co . AgentViewCounter . Bump ( agent )
2020-05-26 21:08:13 +00:00
//}
2020-02-28 05:47:43 +00:00
co . OSViewCounter . Bump ( os )
2018-01-09 07:39:29 +00:00
}
2018-02-05 10:29:13 +00:00
2018-03-08 03:59:47 +00:00
// TODO: Do we want to track missing language headers too? Maybe as it's own type, e.g. "noheader"?
2020-03-08 04:15:27 +00:00
// TODO: Default to anything other than en, if anything else is present, to avoid over-representing it for multi-linguals?
2018-03-08 03:59:47 +00:00
lang := req . Header . Get ( "Accept-Language" )
if lang != "" {
2020-03-27 06:05:35 +00:00
// TODO: Reduce allocs here
2020-02-26 10:34:38 +00:00
lLang := strings . Split ( strings . TrimSpace ( lang ) , "-" )
2019-02-28 07:28:17 +00:00
tLang := strings . Split ( strings . Split ( lLang [ 0 ] , ";" ) [ 0 ] , "," )
2019-04-19 07:16:09 +00:00
c . DebugDetail ( "tLang:" , tLang )
2019-02-28 07:28:17 +00:00
var llLang string
for _ , seg := range tLang {
if seg == "*" {
continue
}
llLang = seg
2019-03-03 02:28:17 +00:00
break
2019-02-28 07:28:17 +00:00
}
2019-04-19 07:16:09 +00:00
c . DebugDetail ( "llLang:" , llLang )
2020-03-08 04:15:27 +00:00
if ! co . LangViewCounter . Bump ( llLang ) {
2020-02-25 04:25:50 +00:00
r . DumpRequest ( req , "Invalid ISO Code" )
2019-02-23 06:29:19 +00:00
}
2018-03-17 08:16:43 +00:00
} else {
2020-03-08 04:15:27 +00:00
co . LangViewCounter . Bump2 ( 0 )
2018-03-08 03:59:47 +00:00
}
2019-08-14 10:39:04 +00:00
if ! c . Config . RefNoTrack {
2020-04-09 09:30:51 +00:00
ae := req . Header . Get ( "Accept-Encoding" )
likelyBot := ae == "gzip" || ae == ""
if ! likelyBot {
ref := req . Header . Get ( "Referer" ) // Check the 'referrer' header too? :P
if ref != "" {
// ? Optimise this a little?
ref = strings . TrimPrefix ( strings . TrimPrefix ( ref , "http://" ) , "https://" )
ref = strings . Split ( ref , "/" ) [ 0 ]
portless := strings . Split ( ref , ":" ) [ 0 ]
// TODO: Handle c.Site.Host in uppercase too?
if portless != "localhost" && portless != "127.0.0.1" && portless != c . Site . Host {
2020-04-13 03:28:52 +00:00
r . DumpRequest ( req , "Ref Route" )
2020-04-09 09:30:51 +00:00
co . ReferrerTracker . Bump ( ref )
}
2019-08-14 10:39:04 +00:00
}
2018-02-05 10:29:13 +00:00
}
}
2020-02-26 10:34:38 +00:00
}
2017-07-17 10:23:42 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
// Deal with the session stuff, etc.
2020-03-18 09:21:34 +00:00
ucpy , ok := c . PreRoute ( w , req )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
if ! ok {
return
}
2020-03-18 09:21:34 +00:00
user := & ucpy
2019-04-02 07:43:11 +00:00
user . LastAgent = agent
2019-04-19 07:16:09 +00:00
if c . Dev . SuperDebug {
2018-11-13 06:51:34 +00:00
r . requestLogger . Print (
2018-04-03 04:34:07 +00:00
"after PreRoute\n" +
"routeMapEnum: " , routeMapEnum )
2017-07-17 10:23:42 +00:00
}
2020-03-27 06:05:35 +00:00
//log.Println("req: ", req)
2018-08-11 15:53:42 +00:00
2018-08-21 08:00:35 +00:00
// Disable Gzip when SSL is disabled for security reasons?
2020-05-26 21:08:13 +00:00
if prefix != "/ws" {
ae := req . Header . Get ( "Accept-Encoding" )
/ * if strings . Contains ( ae , "br" ) {
h := w . Header ( )
h . Set ( "Content-Encoding" , "br" )
var ii = brPool . Get ( )
var igzw * brotli . Writer
if ii == nil {
igzw = brotli . NewWriter ( w )
} else {
igzw = ii . ( * brotli . Writer )
igzw . Reset ( w )
2018-08-22 07:10:29 +00:00
}
2020-05-26 21:08:13 +00:00
gzw := c . BrResponseWriter { Writer : igzw , ResponseWriter : w }
defer func ( ) {
//h := w.Header()
if h . Get ( "Content-Encoding" ) == "br" && h . Get ( "X-I" ) == "" {
//log.Print("push br close")
igzw := gzw . Writer . ( * brotli . Writer )
igzw . Close ( )
brPool . Put ( igzw )
}
} ( )
w = gzw
} else * / if strings . Contains ( ae , "gzip" ) {
h := w . Header ( )
h . Set ( "Content-Encoding" , "gzip" )
var ii = gzipPool . Get ( )
var igzw * gzip . Writer
if ii == nil {
igzw = gzip . NewWriter ( w )
} else {
igzw = ii . ( * gzip . Writer )
igzw . Reset ( w )
}
gzw := c . GzipResponseWriter { Writer : igzw , ResponseWriter : w }
defer func ( ) {
//h := w.Header()
if h . Get ( "Content-Encoding" ) == "gzip" && h . Get ( "X-I" ) == "" {
//log.Print("push gzip close")
igzw := gzw . Writer . ( * gzip . Writer )
igzw . Close ( )
gzipPool . Put ( igzw )
}
} ( )
w = gzw
}
2018-08-21 08:00:35 +00:00
}
2018-11-12 09:23:36 +00:00
2020-05-26 21:08:13 +00:00
skip , ferr = c . H_router_pre_route_hook ( hTbl , w , req , user , prefix )
2020-03-27 06:05:35 +00:00
if skip || ferr != nil {
r . handleError ( ferr , w , req , user )
return
}
2020-03-22 23:14:08 +00:00
var extraData string
if req . URL . Path [ len ( req . URL . Path ) - 1 ] != '/' {
extraData = req . URL . Path [ strings . LastIndexByte ( req . URL . Path , '/' ) + 1 : ]
req . URL . Path = req . URL . Path [ : strings . LastIndexByte ( req . URL . Path , '/' ) + 1 ]
}
2019-04-06 01:08:49 +00:00
ferr = r . routeSwitch ( w , req , user , prefix , extraData )
2018-11-12 09:23:36 +00:00
if ferr != nil {
2018-11-13 06:51:34 +00:00
r . handleError ( ferr , w , req , user )
2020-03-27 06:05:35 +00:00
return
2018-11-12 09:23:36 +00:00
}
2020-02-26 10:34:38 +00:00
/ * if ! c . Config . DisableAnalytics {
co . RouteViewCounter . Bump ( id )
} * /
2019-04-06 01:08:49 +00:00
hTbl . VhookNoRet ( "router_end" , w , req , user , prefix , extraData )
2019-04-19 07:16:09 +00:00
//c.StoppedServer("Profile end")
2018-08-11 15:53:42 +00:00
}
2017-07-17 10:23:42 +00:00
2020-03-18 09:21:34 +00:00
func ( r * GenRouter ) routeSwitch ( w http . ResponseWriter , req * http . Request , user * c . User , prefix , extraData string ) /*(id int, orerr */ c . RouteError /*)*/ {
2019-04-19 07:16:09 +00:00
var err c . RouteError
2020-02-29 01:10:39 +00:00
cn := uutils . Nanotime ( )
2017-04-13 09:26:40 +00:00
switch ( prefix ) {
case "/overview" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . Overview ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 1 , cn )
2017-12-22 03:32:23 +00:00
case "/pages" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . CustomPage ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 2 , cn )
2017-12-22 03:32:23 +00:00
case "/forums" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . ForumList ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 3 , cn )
2017-04-13 15:01:30 +00:00
case "/forum" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . ViewForum ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 4 , cn )
2017-09-10 16:57:22 +00:00
case "/theme" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2018-05-15 05:59:52 +00:00
err = routes . ChangeTheme ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 5 , cn )
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
case "/attachs" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2020-05-26 21:08:13 +00:00
if gzw , ok := w . ( c . GzipResponseWriter ) ; ok {
2018-08-22 02:13:17 +00:00
w = gzw . ResponseWriter
2020-03-12 06:52:26 +00:00
w . Header ( ) . Del ( "Content-Encoding" )
2018-08-22 02:13:17 +00:00
}
2018-05-15 05:59:52 +00:00
err = routes . ShowAttachment ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 6 , cn )
2018-01-18 12:31:25 +00:00
case "/ws" :
req . URL . Path += extraData
2019-04-19 07:16:09 +00:00
err = c . RouteWebsockets ( w , req , user )
2018-06-24 13:49:29 +00:00
case "/api" :
switch ( req . URL . Path ) {
case "/api/phrases/" :
err = routeAPIPhrases ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 8 , cn )
2020-02-26 10:34:38 +00:00
case "/api/me/" :
2018-08-11 15:53:42 +00:00
err = routes . APIMe ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 9 , cn )
2020-02-26 10:34:38 +00:00
case "/api/watches/" :
2018-07-05 09:54:01 +00:00
err = routeJSAntispam ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 10 , cn )
2020-02-26 10:34:38 +00:00
default :
2018-06-24 13:49:29 +00:00
err = routeAPI ( w , req , user )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 11 , cn )
2018-06-24 13:49:29 +00:00
}
2017-05-02 17:24:33 +00:00
case "/report" :
2019-04-19 07:16:09 +00:00
err = c . NoBanned ( w , req , user )
2017-11-08 07:28:33 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-08 07:28:33 +00:00
}
2017-05-02 17:24:33 +00:00
switch ( req . URL . Path ) {
case "/report/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2018-05-27 09:36:35 +00:00
err = routes . ReportSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 12 , cn )
2017-10-30 09:57:08 +00:00
}
2017-04-13 09:26:40 +00:00
case "/topics" :
switch ( req . URL . Path ) {
2018-09-26 07:46:30 +00:00
case "/topics/most-viewed/" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . TopicListMostViewed ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 13 , cn )
2017-04-13 09:26:40 +00:00
case "/topics/create/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . CreateTopic ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 14 , cn )
2017-04-13 10:55:51 +00:00
default :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . TopicList ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 15 , cn )
2017-10-30 09:57:08 +00:00
}
2017-04-13 10:55:51 +00:00
case "/panel" :
2019-04-19 07:16:09 +00:00
err = c . SuperModOnly ( w , req , user )
2017-10-30 09:57:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-10-30 09:57:08 +00:00
}
2017-04-13 10:55:51 +00:00
switch ( req . URL . Path ) {
case "/panel/forums/" :
2018-05-27 09:36:35 +00:00
err = panel . Forums ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 16 , cn )
2017-04-13 10:55:51 +00:00
case "/panel/forums/create/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . ForumsCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 17 , cn )
2017-04-13 10:55:51 +00:00
case "/panel/forums/delete/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . ForumsDelete ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 18 , cn )
2017-04-13 10:55:51 +00:00
case "/panel/forums/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . ForumsDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 19 , cn )
2019-04-27 06:32:26 +00:00
case "/panel/forums/order/edit/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = panel . ForumsOrderSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 20 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/forums/edit/" :
2018-05-27 09:36:35 +00:00
err = panel . ForumsEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 21 , cn )
2017-04-13 10:55:51 +00:00
case "/panel/forums/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . ForumsEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 22 , cn )
2017-06-05 11:57:27 +00:00
case "/panel/forums/edit/perms/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . ForumsEditPermsSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 23 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/forums/edit/perms/" :
2018-05-27 09:36:35 +00:00
err = panel . ForumsEditPermsAdvance ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 24 , cn )
2018-01-10 03:32:48 +00:00
case "/panel/forums/edit/perms/adv/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-10 03:32:48 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-10 03:32:48 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . ForumsEditPermsAdvanceSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 25 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/settings/" :
2018-05-27 09:36:35 +00:00
err = panel . Settings ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 26 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/settings/edit/" :
2018-05-27 09:36:35 +00:00
err = panel . SettingEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 27 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/settings/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . SettingEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 28 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/settings/word-filters/" :
2018-08-04 11:46:36 +00:00
err = panel . WordFilters ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 29 , cn )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/create/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-08-04 11:46:36 +00:00
err = panel . WordFiltersCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 30 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/settings/word-filters/edit/" :
2018-08-04 11:46:36 +00:00
err = panel . WordFiltersEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 31 , cn )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-08-04 11:46:36 +00:00
err = panel . WordFiltersEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 32 , cn )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-08-04 11:46:36 +00:00
err = panel . WordFiltersDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 33 , cn )
2018-06-06 00:21:22 +00:00
case "/panel/pages/" :
2019-04-19 07:16:09 +00:00
err = c . AdminOnly ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
err = panel . Pages ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 34 , cn )
2018-06-06 00:21:22 +00:00
case "/panel/pages/create/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . AdminOnly ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
err = panel . PagesCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 35 , cn )
2018-06-06 00:21:22 +00:00
case "/panel/pages/edit/" :
2019-04-19 07:16:09 +00:00
err = c . AdminOnly ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
err = panel . PagesEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 36 , cn )
2018-06-06 00:21:22 +00:00
case "/panel/pages/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . AdminOnly ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
err = panel . PagesEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 37 , cn )
2018-06-06 00:21:22 +00:00
case "/panel/pages/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . AdminOnly ( w , req , user )
2018-06-06 00:21:22 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-06 00:21:22 +00:00
}
err = panel . PagesDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 38 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/themes/" :
2018-09-30 14:43:46 +00:00
err = panel . Themes ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 39 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/themes/default/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-10-02 04:09:17 +00:00
err = panel . ThemesSetDefault ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 40 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/themes/menus/" :
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenus ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 41 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/themes/menus/edit/" :
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenusEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 42 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/themes/menus/item/edit/" :
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenuItemEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 43 , cn )
2018-05-11 05:41:51 +00:00
case "/panel/themes/menus/item/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-05-11 05:41:51 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-05-11 05:41:51 +00:00
}
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenuItemEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 44 , cn )
2018-05-13 06:56:59 +00:00
case "/panel/themes/menus/item/create/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-05-13 06:56:59 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-05-13 06:56:59 +00:00
}
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenuItemCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 45 , cn )
2018-05-13 06:56:59 +00:00
case "/panel/themes/menus/item/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-05-13 06:56:59 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-05-13 06:56:59 +00:00
}
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenuItemDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 46 , cn )
2018-05-13 06:56:59 +00:00
case "/panel/themes/menus/item/order/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-05-13 06:56:59 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-05-13 06:56:59 +00:00
}
2018-09-30 14:43:46 +00:00
err = panel . ThemesMenuItemOrderSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 47 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/themes/widgets/" :
2019-01-21 12:27:59 +00:00
err = panel . ThemesWidgets ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 48 , cn )
2019-01-21 12:27:59 +00:00
case "/panel/themes/widgets/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2019-01-21 12:27:59 +00:00
if err != nil {
return err
}
err = panel . ThemesWidgetsEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 49 , cn )
2019-01-21 12:27:59 +00:00
case "/panel/themes/widgets/create/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2019-01-21 12:27:59 +00:00
if err != nil {
return err
}
err = panel . ThemesWidgetsCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 50 , cn )
2019-01-21 12:27:59 +00:00
case "/panel/themes/widgets/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2019-01-21 12:27:59 +00:00
if err != nil {
return err
}
err = panel . ThemesWidgetsDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 51 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/plugins/" :
2018-07-29 10:54:12 +00:00
err = panel . Plugins ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 52 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/plugins/activate/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-07-29 10:54:12 +00:00
err = panel . PluginsActivate ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 53 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/plugins/deactivate/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-07-29 10:54:12 +00:00
err = panel . PluginsDeactivate ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 54 , cn )
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
case "/panel/plugins/install/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-07-29 10:54:12 +00:00
err = panel . PluginsInstall ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 55 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/users/" :
2018-06-17 07:28:18 +00:00
err = panel . Users ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 56 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/users/edit/" :
2018-06-17 07:28:18 +00:00
err = panel . UsersEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 57 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/users/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-06-17 07:28:18 +00:00
err = panel . UsersEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 58 , cn )
2019-06-10 22:00:57 +00:00
case "/panel/users/avatar/submit/" :
err = c . HandleUploadRoute ( w , req , user , int ( c . Config . MaxRequestSize ) )
if err != nil {
return err
}
err = c . NoUploadSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = panel . UsersAvatarSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 59 , cn )
2019-06-10 22:00:57 +00:00
case "/panel/users/avatar/remove/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = panel . UsersAvatarRemoveSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 60 , cn )
2017-12-30 05:47:46 +00:00
case "/panel/analytics/views/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-08 08:53:51 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-08 08:53:51 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsViews ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 61 , cn )
2018-01-04 10:23:33 +00:00
case "/panel/analytics/routes/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-17 11:13:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-17 11:13:08 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsRoutes ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 62 , cn )
2020-02-28 04:52:45 +00:00
case "/panel/analytics/routes-perf/" :
err = c . ParseForm ( w , req , user )
if err != nil {
return err
}
err = panel . AnalyticsRoutesPerf ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 63 , cn )
2018-01-09 07:39:29 +00:00
case "/panel/analytics/agents/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-17 11:13:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-17 11:13:08 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsAgents ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 64 , cn )
2018-02-04 08:15:20 +00:00
case "/panel/analytics/systems/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-02-04 08:15:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-02-04 08:15:20 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsSystems ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 65 , cn )
2018-03-08 03:59:47 +00:00
case "/panel/analytics/langs/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-02-05 10:29:13 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-02-05 10:29:13 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsLanguages ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 66 , cn )
2018-03-08 03:59:47 +00:00
case "/panel/analytics/referrers/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-03-08 03:59:47 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-03-08 03:59:47 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsReferrers ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 67 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/analytics/route/" :
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsRouteViews ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 68 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/analytics/agent/" :
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsAgentViews ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 69 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/analytics/forum/" :
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsForumViews ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 70 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/analytics/system/" :
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsSystemViews ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 71 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/analytics/lang/" :
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsLanguageViews ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 72 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/analytics/referrer/" :
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsReferrerViews ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 73 , cn )
2018-01-14 12:03:20 +00:00
case "/panel/analytics/posts/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsPosts ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 74 , cn )
2019-05-01 06:59:51 +00:00
case "/panel/analytics/memory/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-18 12:31:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-18 12:31:25 +00:00
}
2019-05-01 06:59:51 +00:00
err = panel . AnalyticsMemory ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 75 , cn )
2019-05-09 06:58:55 +00:00
case "/panel/analytics/active-memory/" :
2019-05-01 06:59:51 +00:00
err = c . ParseForm ( w , req , user )
if err != nil {
return err
}
2019-05-09 06:58:55 +00:00
err = panel . AnalyticsActiveMemory ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 76 , cn )
2019-05-09 06:58:55 +00:00
case "/panel/analytics/topics/" :
err = c . ParseForm ( w , req , user )
if err != nil {
return err
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsTopics ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 77 , cn )
2018-02-22 02:27:17 +00:00
case "/panel/analytics/forums/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-02-22 02:27:17 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-02-22 02:27:17 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . AnalyticsForums ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 78 , cn )
2020-02-23 09:08:47 +00:00
case "/panel/analytics/perf/" :
err = c . ParseForm ( w , req , user )
if err != nil {
return err
}
err = panel . AnalyticsPerf ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 79 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/groups/" :
2018-09-30 00:08:27 +00:00
err = panel . Groups ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 80 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/groups/edit/" :
2018-09-30 00:08:27 +00:00
err = panel . GroupsEdit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 81 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/groups/edit/promotions/" :
2019-09-29 04:56:39 +00:00
err = panel . GroupsEditPromotions ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 82 , cn )
2019-09-29 04:56:39 +00:00
case "/panel/groups/promotions/create/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = panel . GroupsPromotionsCreateSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 83 , cn )
2019-09-29 04:56:39 +00:00
case "/panel/groups/promotions/delete/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = panel . GroupsPromotionsDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 84 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/groups/edit/perms/" :
2018-09-30 00:08:27 +00:00
err = panel . GroupsEditPerms ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 85 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/groups/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-09-30 00:08:27 +00:00
err = panel . GroupsEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 86 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/groups/edit/perms/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-09-30 00:08:27 +00:00
err = panel . GroupsEditPermsSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 87 , cn )
2017-04-13 15:01:30 +00:00
case "/panel/groups/create/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-09-30 00:08:27 +00:00
err = panel . GroupsCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 88 , cn )
2017-09-23 19:57:13 +00:00
case "/panel/backups/" :
2019-04-19 07:16:09 +00:00
err = c . SuperAdminOnly ( w , req , user )
2017-12-19 03:53:13 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-12-19 03:53:13 +00:00
}
2020-05-26 21:08:13 +00:00
if gzw , ok := w . ( c . GzipResponseWriter ) ; ok {
2018-08-22 07:10:29 +00:00
w = gzw . ResponseWriter
2020-03-12 06:52:26 +00:00
w . Header ( ) . Del ( "Content-Encoding" )
2018-08-22 07:10:29 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . Backups ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 89 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/logs/regs/" :
2018-05-27 09:36:35 +00:00
err = panel . LogsRegs ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 90 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/logs/mod/" :
2018-05-27 09:36:35 +00:00
err = panel . LogsMod ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 91 , cn )
2020-02-26 10:34:38 +00:00
case "/panel/logs/admin/" :
2019-11-06 02:00:44 +00:00
err = panel . LogsAdmin ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 92 , cn )
2017-08-15 13:47:56 +00:00
case "/panel/debug/" :
2019-04-19 07:16:09 +00:00
err = c . AdminOnly ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-11 23:34:27 +00:00
}
2018-05-27 09:36:35 +00:00
err = panel . Debug ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 93 , cn )
2020-02-26 10:34:38 +00:00
default :
2018-10-02 05:03:20 +00:00
err = panel . Dashboard ( w , req , user )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 94 , cn )
2017-10-30 09:57:08 +00:00
}
2017-11-05 09:55:34 +00:00
case "/user" :
switch ( req . URL . Path ) {
2018-06-17 07:28:18 +00:00
case "/user/edit/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountEdit ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 95 , cn )
2018-06-17 07:28:18 +00:00
case "/user/edit/password/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-10 03:33:11 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountEditPassword ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 96 , cn )
2018-06-17 07:28:18 +00:00
case "/user/edit/password/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2018-06-17 07:28:18 +00:00
err = routes . AccountEditPasswordSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 97 , cn )
2017-11-05 09:55:34 +00:00
case "/user/edit/avatar/submit/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . HandleUploadRoute ( w , req , user , int ( c . Config . MaxRequestSize ) )
2018-08-22 02:13:17 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-08-22 02:13:17 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . NoUploadSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-05-14 08:56:56 +00:00
err = routes . AccountEditAvatarSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 98 , cn )
2019-06-09 03:21:48 +00:00
case "/user/edit/avatar/revoke/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-06-17 07:28:18 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-17 07:28:18 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2019-06-09 03:21:48 +00:00
err = routes . AccountEditRevokeAvatarSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 99 , cn )
2019-06-09 03:21:48 +00:00
case "/user/edit/username/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2018-06-17 07:28:18 +00:00
err = routes . AccountEditUsernameSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 100 , cn )
2019-12-08 03:40:56 +00:00
case "/user/edit/privacy/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-06-17 07:28:18 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-17 07:28:18 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-12-08 03:40:56 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountEditPrivacy ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 101 , cn )
2019-12-08 03:40:56 +00:00
case "/user/edit/privacy/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . AccountEditPrivacySubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 102 , cn )
2019-12-08 03:40:56 +00:00
case "/user/edit/mfa/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountEditMFA ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 103 , cn )
2018-06-17 07:28:18 +00:00
case "/user/edit/mfa/setup/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-06-17 07:28:18 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-17 07:28:18 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountEditMFASetup ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 104 , cn )
2018-06-17 07:28:18 +00:00
case "/user/edit/mfa/setup/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2018-06-17 07:28:18 +00:00
err = routes . AccountEditMFASetupSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 105 , cn )
2018-06-17 07:28:18 +00:00
case "/user/edit/mfa/disable/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-06-17 07:28:18 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-17 07:28:18 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-06-17 07:28:18 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-17 07:28:18 +00:00
}
err = routes . AccountEditMFADisableSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 106 , cn )
2017-11-05 09:55:34 +00:00
case "/user/edit/email/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-05 09:55:34 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountEditEmail ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 107 , cn )
2017-11-05 09:55:34 +00:00
case "/user/edit/token/" :
2018-05-27 09:36:35 +00:00
err = routes . AccountEditEmailTokenSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 108 , cn )
2018-12-17 04:58:55 +00:00
case "/user/edit/logins/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-10-10 07:33:51 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-10-10 07:33:51 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-12-17 04:58:55 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountLogins ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 109 , cn )
2019-11-12 06:17:46 +00:00
case "/user/edit/blocked/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-12-17 04:58:55 +00:00
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-11-12 06:17:46 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountBlocked ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 110 , cn )
2019-11-12 06:17:46 +00:00
case "/user/levels/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . LevelList ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 111 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convos/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-08-14 10:39:04 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . Convos ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 112 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convos/create/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-08-14 10:39:04 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . ConvosCreate ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 113 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convo/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-08-14 10:39:04 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . Convo ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 114 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convos/create/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . ConvosCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 115 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convo/create/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2019-08-20 08:44:37 +00:00
err = routes . ConvosCreateReplySubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 116 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convo/delete/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . ConvosDeleteReplySubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 117 , cn )
2019-08-14 10:39:04 +00:00
case "/user/convo/edit/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . ConvosEditReplySubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 118 , cn )
2019-10-18 00:35:13 +00:00
case "/user/block/create/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-10-18 00:35:13 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . RelationsBlockCreate ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 119 , cn )
2019-10-18 00:35:13 +00:00
case "/user/block/create/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . RelationsBlockCreateSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 120 , cn )
2019-10-18 00:35:13 +00:00
case "/user/block/remove/" :
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-10-18 00:35:13 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . RelationsBlockRemove ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 121 , cn )
2019-10-18 00:35:13 +00:00
case "/user/block/remove/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . RelationsBlockRemoveSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 122 , cn )
2017-11-05 09:55:34 +00:00
default :
2017-12-19 03:53:13 +00:00
req . URL . Path += extraData
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . ViewProfile ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 123 , cn )
2017-11-05 09:55:34 +00:00
}
2017-11-10 03:33:11 +00:00
case "/users" :
switch ( req . URL . Path ) {
case "/users/ban/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-10 03:33:11 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2018-01-21 11:17:43 +00:00
err = routes . BanUserSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 124 , cn )
2017-11-10 03:33:11 +00:00
case "/users/unban/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-10 03:33:11 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2018-01-21 11:17:43 +00:00
err = routes . UnbanUser ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 125 , cn )
2017-11-10 03:33:11 +00:00
case "/users/activate/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-10 03:33:11 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2018-01-21 11:17:43 +00:00
err = routes . ActivateUser ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 126 , cn )
2017-11-10 03:33:11 +00:00
case "/users/ips/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2017-11-12 07:18:25 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2017-11-12 07:18:25 +00:00
}
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . IPSearch ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 127 , cn )
2020-01-14 05:07:00 +00:00
case "/users/delete-posts/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . DeletePostsSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 128 , cn )
2017-11-10 03:33:11 +00:00
}
2018-01-14 12:03:20 +00:00
case "/topic" :
switch ( req . URL . Path ) {
case "/topic/create/submit/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . HandleUploadRoute ( w , req , user , int ( c . Config . MaxRequestSize ) )
2018-08-22 02:13:17 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-08-22 02:13:17 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . NoUploadSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-22 08:15:45 +00:00
err = routes . CreateTopicSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 129 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-18 12:31:25 +00:00
err = routes . EditTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 130 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
req . URL . Path += extraData
2018-01-20 06:50:29 +00:00
err = routes . DeleteTopicSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 131 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/stick/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . StickTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 132 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/unstick/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . UnstickTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 133 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/lock/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
req . URL . Path += extraData
2018-01-20 06:50:29 +00:00
err = routes . LockTopicSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 134 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/unlock/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . UnlockTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 135 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/move/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . MoveTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 136 , cn )
2018-01-14 12:03:20 +00:00
case "/topic/like/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-12-27 05:42:41 +00:00
err = routes . LikeTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 137 , cn )
Cascade delete attachments properly.
Cascade delete replied to topic events for replies properly.
Cascade delete likes on topic posts properly.
Cascade delete replies and their children properly.
Recalculate user stats properly when items are deleted.
Users can now unlike topic opening posts.
Add a recalculator to fix abnormalities across upgrades.
Try fixing a last_ip daily update bug.
Add Existable interface.
Add Delete method to LikeStore.
Add Each, Exists, Create, CountUser, CountMegaUser and CountBigUser methods to ReplyStore.
Add CountUser, CountMegaUser, CountBigUser methods to TopicStore.
Add Each method to UserStore.
Add Add, Delete and DeleteResource methods to SubscriptionStore.
Add Delete, DeleteByParams, DeleteByParamsExtra and AidsByParamsExtra methods to ActivityStream.
Add Exists method to ProfileReplyStore.
Add DropColumn, RenameColumn and ChangeColumn to the database adapters.
Shorten ipaddress column names to ip.
- topics table.
- replies table
- users_replies table.
- polls_votes table.
Add extra column to activity_stream table.
Fix an issue upgrading sites to MariaDB 10.3 from older versions of Gosora. Please report any other issues you find.
You need to run the updater / patcher for this commit.
2020-01-31 07:22:08 +00:00
case "/topic/unlike/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . UnlikeTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 138 , cn )
2018-12-27 05:42:41 +00:00
case "/topic/attach/add/submit/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-12-27 05:42:41 +00:00
if err != nil {
return err
}
2019-04-19 07:16:09 +00:00
err = c . HandleUploadRoute ( w , req , user , int ( c . Config . MaxRequestSize ) )
2018-12-27 05:42:41 +00:00
if err != nil {
return err
}
2019-04-19 07:16:09 +00:00
err = c . NoUploadSessionMismatch ( w , req , user )
2018-03-31 05:25:27 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-03-31 05:25:27 +00:00
}
2018-12-27 05:42:41 +00:00
err = routes . AddAttachToTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 139 , cn )
2018-12-27 05:42:41 +00:00
case "/topic/attach/remove/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-12-27 05:42:41 +00:00
if err != nil {
return err
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-12-27 05:42:41 +00:00
if err != nil {
return err
}
err = routes . RemoveAttachFromTopicSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 140 , cn )
2020-02-26 10:34:38 +00:00
default :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . ViewTopic ( w , req , user , h , extraData )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 141 , cn )
2018-01-14 12:03:20 +00:00
}
case "/reply" :
switch ( req . URL . Path ) {
case "/reply/create/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . HandleUploadRoute ( w , req , user , int ( c . Config . MaxRequestSize ) )
2018-08-22 02:13:17 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-08-22 02:13:17 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . NoUploadSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-03-08 03:59:47 +00:00
err = routes . CreateReplySubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 142 , cn )
2018-01-14 12:03:20 +00:00
case "/reply/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . ReplyEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 143 , cn )
2018-01-14 12:03:20 +00:00
case "/reply/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . ReplyDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 144 , cn )
2018-01-14 12:03:20 +00:00
case "/reply/like/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 12:03:20 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 12:03:20 +00:00
}
2018-05-15 05:59:52 +00:00
err = routes . ReplyLikeSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 145 , cn )
2020-01-31 10:48:55 +00:00
case "/reply/unlike/submit/" :
err = c . NoSessionMismatch ( w , req , user )
if err != nil {
return err
}
err = c . MemberOnly ( w , req , user )
if err != nil {
return err
}
err = routes . ReplyUnlikeSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 146 , cn )
2018-12-31 09:03:49 +00:00
case "/reply/attach/add/submit/" :
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-12-31 09:03:49 +00:00
if err != nil {
return err
}
2019-04-19 07:16:09 +00:00
err = c . HandleUploadRoute ( w , req , user , int ( c . Config . MaxRequestSize ) )
2018-12-31 09:03:49 +00:00
if err != nil {
return err
}
2019-04-19 07:16:09 +00:00
err = c . NoUploadSessionMismatch ( w , req , user )
2018-12-31 09:03:49 +00:00
if err != nil {
return err
}
err = routes . AddAttachToReplySubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 147 , cn )
2018-12-31 09:03:49 +00:00
case "/reply/attach/remove/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-12-31 09:03:49 +00:00
if err != nil {
return err
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-12-31 09:03:49 +00:00
if err != nil {
return err
}
err = routes . RemoveAttachFromReplySubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 148 , cn )
2018-01-14 12:03:20 +00:00
}
2018-01-14 14:27:10 +00:00
case "/profile" :
switch ( req . URL . Path ) {
case "/profile/reply/create/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 14:27:10 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 14:27:10 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 14:27:10 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 14:27:10 +00:00
}
2018-05-15 05:59:52 +00:00
err = routes . ProfileReplyCreateSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 149 , cn )
2018-01-14 14:27:10 +00:00
case "/profile/reply/edit/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 14:27:10 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 14:27:10 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 14:27:10 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 14:27:10 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . ProfileReplyEditSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 150 , cn )
2018-01-14 14:27:10 +00:00
case "/profile/reply/delete/submit/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-14 14:27:10 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 14:27:10 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-14 14:27:10 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-14 14:27:10 +00:00
}
2018-01-20 06:50:29 +00:00
err = routes . ProfileReplyDeleteSubmit ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 151 , cn )
2018-01-14 14:27:10 +00:00
}
2018-01-27 07:30:44 +00:00
case "/poll" :
switch ( req . URL . Path ) {
case "/poll/vote/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-27 07:30:44 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-27 07:30:44 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-27 07:30:44 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-27 07:30:44 +00:00
}
err = routes . PollVote ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 152 , cn )
2020-02-26 10:34:38 +00:00
case "/poll/results/" :
2018-11-12 09:38:46 +00:00
err = routes . PollResults ( w , req , user , extraData )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 153 , cn )
2018-01-27 07:30:44 +00:00
}
2018-01-17 11:13:08 +00:00
case "/accounts" :
switch ( req . URL . Path ) {
case "/accounts/login/" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountLogin ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 154 , cn )
2018-01-17 11:13:08 +00:00
case "/accounts/create/" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountRegister ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 155 , cn )
2018-01-17 11:13:08 +00:00
case "/accounts/logout/" :
2019-04-19 07:16:09 +00:00
err = c . NoSessionMismatch ( w , req , user )
2018-01-17 11:13:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-17 11:13:08 +00:00
}
2019-04-19 07:16:09 +00:00
err = c . MemberOnly ( w , req , user )
2018-01-17 11:13:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-17 11:13:08 +00:00
}
2018-05-15 05:59:52 +00:00
err = routes . AccountLogout ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 156 , cn )
2018-01-17 11:13:08 +00:00
case "/accounts/login/submit/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-17 11:13:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-17 11:13:08 +00:00
}
2018-02-03 05:47:14 +00:00
err = routes . AccountLoginSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 157 , cn )
2020-02-26 10:34:38 +00:00
case "/accounts/mfa_verify/" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2018-11-12 09:23:36 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountLoginMFAVerify ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 158 , cn )
2018-06-17 07:28:18 +00:00
case "/accounts/mfa_verify/submit/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-06-17 07:28:18 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-06-17 07:28:18 +00:00
}
err = routes . AccountLoginMFAVerifySubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 159 , cn )
2018-01-17 11:13:08 +00:00
case "/accounts/create/submit/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2018-01-17 11:13:08 +00:00
if err != nil {
2018-11-12 09:23:36 +00:00
return err
2018-01-17 11:13:08 +00:00
}
2018-02-03 05:47:14 +00:00
err = routes . AccountRegisterSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 160 , cn )
2020-02-26 10:34:38 +00:00
case "/accounts/password-reset/" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-03-11 08:47:45 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountPasswordReset ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 161 , cn )
2019-03-11 08:47:45 +00:00
case "/accounts/password-reset/submit/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2019-03-11 08:47:45 +00:00
if err != nil {
return err
}
err = routes . AccountPasswordResetSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 162 , cn )
2020-02-26 10:34:38 +00:00
case "/accounts/password-reset/token/" :
2020-03-18 09:21:34 +00:00
h , err := c . UserCheckNano ( w , req , user , cn )
2019-03-11 08:47:45 +00:00
if err != nil {
return err
}
2020-02-26 10:34:38 +00:00
err = routes . AccountPasswordResetToken ( w , req , user , h )
2020-02-29 01:10:39 +00:00
co . RouteViewCounter . Bump3 ( 163 , cn )
2019-03-11 08:47:45 +00:00
case "/accounts/password-reset/token/submit/" :
2019-04-19 07:16:09 +00:00
err = c . ParseForm ( w , req , user )
2019-03-11 08:47:45 +00:00
if err != nil {
return err
}
err = routes . AccountPasswordResetTokenSubmit ( w , req , user )
2020-02-28 23:11:07 +00:00
co . RouteViewCounter . Bump3 ( 164 , cn )
2018-01-17 11:13:08 +00:00
}
2017-12-24 07:38:46 +00:00
/ * case "/sitemaps" : // TODO: Count these views
req . URL . Path += extraData
2018-08-22 02:29:11 +00:00
err = sitemapSwitch ( w , req ) * /
2020-03-13 06:37:18 +00:00
// ! Temporary fix for certain bots
case "/static" :
w . Header ( ) . Set ( "Connection" , "close" )
http . Redirect ( w , req , "/s/" + extraData , http . StatusTemporaryRedirect )
2018-08-22 02:13:17 +00:00
case "/uploads" :
if extraData == "" {
2020-03-07 05:28:25 +00:00
co . RouteViewCounter . Bump3 ( 166 , cn )
2019-04-19 07:16:09 +00:00
return c . NotFound ( w , req , nil )
2018-08-22 02:13:17 +00:00
}
2020-05-26 21:08:13 +00:00
/ * if bzw , ok := w . ( c . BrResponseWriter ) ; ok {
w = bzw . ResponseWriter
w . Header ( ) . Del ( "Content-Encoding" )
} else * / if gzw , ok := w . ( c . GzipResponseWriter ) ; ok {
2018-08-22 02:13:17 +00:00
w = gzw . ResponseWriter
2020-05-26 21:08:13 +00:00
w . Header ( ) . Del ( "Content-Encoding" )
2018-08-22 02:13:17 +00:00
}
req . URL . Path += extraData
// TODO: Find a way to propagate errors up from this?
2018-11-13 06:51:34 +00:00
r . UploadHandler ( w , req ) // TODO: Count these views
2020-03-07 05:28:25 +00:00
co . RouteViewCounter . Bump3 ( 166 , cn )
2018-11-12 09:23:36 +00:00
return nil
2017-04-13 09:26:40 +00:00
case "" :
2017-08-06 15:22:18 +00:00
// Stop the favicons, robots.txt file, etc. resolving to the topics list
2017-09-10 16:57:22 +00:00
// TODO: Add support for favicons and robots.txt files
2017-12-19 03:53:13 +00:00
switch ( extraData ) {
2017-08-06 15:22:18 +00:00
case "robots.txt" :
2020-03-07 05:28:25 +00:00
co . RouteViewCounter . Bump3 ( 168 , cn )
2018-11-12 09:23:36 +00:00
return routes . RobotsTxt ( w , req )
2019-02-28 07:28:17 +00:00
case "favicon.ico" :
2020-05-26 21:08:13 +00:00
/ * if bzw , ok := w . ( c . BrResponseWriter ) ; ok {
w = bzw . ResponseWriter
w . Header ( ) . Del ( "Content-Encoding" )
} else * / if gzw , ok := w . ( c . GzipResponseWriter ) ; ok {
2019-07-23 10:34:44 +00:00
w = gzw . ResponseWriter
2020-05-26 21:08:13 +00:00
w . Header ( ) . Del ( "Content-Encoding" )
2019-07-23 10:34:44 +00:00
}
2019-08-14 10:39:04 +00:00
req . URL . Path = "/s/favicon.ico"
2019-02-28 07:28:17 +00:00
routes . StaticFile ( w , req )
2020-03-04 23:56:45 +00:00
co . RouteViewCounter . Bump3 ( 171 , cn )
2019-02-28 07:28:17 +00:00
return nil
2019-05-08 05:26:38 +00:00
case "opensearch.xml" :
2020-03-07 05:28:25 +00:00
co . RouteViewCounter . Bump3 ( 170 , cn )
2019-05-08 05:26:38 +00:00
return routes . OpenSearchXml ( w , req )
2017-12-24 07:38:46 +00:00
/ * case "sitemap.xml" :
2020-03-07 05:28:25 +00:00
co . RouteViewCounter . Bump3 ( 169 , cn )
2018-11-12 09:23:36 +00:00
return routes . SitemapXml ( w , req ) * /
2017-08-06 15:22:18 +00:00
}
2020-02-26 10:34:38 +00:00
co . RouteViewCounter . Bump ( 0 )
2019-04-19 07:16:09 +00:00
return c . NotFound ( w , req , nil )
2017-10-30 09:57:08 +00:00
default :
2018-11-13 06:51:34 +00:00
// A fallback for dynamic routes, e.g. ones declared by plugins
r . RLock ( )
2020-02-26 10:34:38 +00:00
h , ok := r . extraRoutes [ req . URL . Path ]
2018-11-13 06:51:34 +00:00
r . RUnlock ( )
2020-03-27 12:00:29 +00:00
req . URL . Path += extraData
2017-10-30 09:57:08 +00:00
if ok {
2020-02-26 10:34:38 +00:00
// TODO: Be more specific about *which* dynamic route it is
2020-02-28 04:52:45 +00:00
co . RouteViewCounter . Bump ( 165 )
2020-02-26 10:34:38 +00:00
return h ( w , req , user )
2017-10-30 09:57:08 +00:00
}
2020-03-27 12:00:29 +00:00
co . RouteViewCounter . Bump3 ( 172 , cn )
2018-01-26 05:53:34 +00:00
2020-02-25 04:25:50 +00:00
lp := strings . ToLower ( req . URL . Path )
if strings . Contains ( lp , "admin" ) || strings . Contains ( lp , "sql" ) || strings . Contains ( lp , "manage" ) || strings . Contains ( lp , "//" ) || strings . Contains ( lp , "\\\\" ) || strings . Contains ( lp , "wp" ) || strings . Contains ( lp , "wordpress" ) || strings . Contains ( lp , "config" ) || strings . Contains ( lp , "setup" ) || strings . Contains ( lp , "install" ) || strings . Contains ( lp , "update" ) || strings . Contains ( lp , "php" ) || strings . Contains ( lp , "pl" ) || strings . Contains ( lp , "wget" ) || strings . Contains ( lp , "wp-" ) || strings . Contains ( lp , "include" ) || strings . Contains ( lp , "vendor" ) || strings . Contains ( lp , "bin" ) || strings . Contains ( lp , "system" ) || strings . Contains ( lp , "eval" ) || strings . Contains ( lp , "config" ) {
2018-11-13 06:51:34 +00:00
r . SuspiciousRequest ( req , "Bad Route" )
2020-03-27 12:00:29 +00:00
return c . MicroNotFound ( w , req )
2018-01-27 07:30:44 +00:00
}
2020-04-13 03:28:52 +00:00
2020-03-27 12:00:29 +00:00
r . DumpRequest ( req , "Bad Route" )
2020-04-13 03:28:52 +00:00
ae := req . Header . Get ( "Accept-Encoding" )
likelyBot := ae == "gzip" || ae == ""
if likelyBot {
return c . MicroNotFound ( w , req )
}
2019-04-19 07:16:09 +00:00
return c . NotFound ( w , req , nil )
2017-04-12 13:39:03 +00:00
}
2018-11-12 09:23:36 +00:00
return err
2017-04-12 13:39:03 +00:00
}