2017-04-12 13:39:03 +00:00
// Code generated by. DO NOT EDIT.
/* 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"
"sync"
"errors"
"net/http"
"./common"
)
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 { } {
2017-12-10 03:43:30 +00:00
"routeAPI" : routeAPI ,
"routeOverview" : routeOverview ,
2017-12-22 03:32:23 +00:00
"routeCustomPage" : routeCustomPage ,
2017-12-10 03:43:30 +00:00
"routeForums" : routeForums ,
"routeForum" : routeForum ,
"routeChangeTheme" : routeChangeTheme ,
"routeShowAttachment" : routeShowAttachment ,
"routeReportSubmit" : routeReportSubmit ,
"routeTopicCreate" : routeTopicCreate ,
"routeTopics" : routeTopics ,
"routePanelForums" : routePanelForums ,
"routePanelForumsCreateSubmit" : routePanelForumsCreateSubmit ,
"routePanelForumsDelete" : routePanelForumsDelete ,
"routePanelForumsDeleteSubmit" : routePanelForumsDeleteSubmit ,
"routePanelForumsEdit" : routePanelForumsEdit ,
"routePanelForumsEditSubmit" : routePanelForumsEditSubmit ,
"routePanelForumsEditPermsSubmit" : routePanelForumsEditPermsSubmit ,
2018-01-08 08:53:51 +00:00
"routePanelForumsEditPermsAdvance" : routePanelForumsEditPermsAdvance ,
2017-12-10 03:43:30 +00:00
"routePanelSettings" : routePanelSettings ,
"routePanelSettingEdit" : routePanelSettingEdit ,
"routePanelSettingEditSubmit" : routePanelSettingEditSubmit ,
"routePanelWordFilters" : routePanelWordFilters ,
"routePanelWordFiltersCreate" : routePanelWordFiltersCreate ,
"routePanelWordFiltersEdit" : routePanelWordFiltersEdit ,
"routePanelWordFiltersEditSubmit" : routePanelWordFiltersEditSubmit ,
"routePanelWordFiltersDeleteSubmit" : routePanelWordFiltersDeleteSubmit ,
"routePanelThemes" : routePanelThemes ,
"routePanelThemesSetDefault" : routePanelThemesSetDefault ,
"routePanelPlugins" : routePanelPlugins ,
"routePanelPluginsActivate" : routePanelPluginsActivate ,
"routePanelPluginsDeactivate" : routePanelPluginsDeactivate ,
"routePanelPluginsInstall" : routePanelPluginsInstall ,
"routePanelUsers" : routePanelUsers ,
"routePanelUsersEdit" : routePanelUsersEdit ,
"routePanelUsersEditSubmit" : routePanelUsersEditSubmit ,
2017-12-30 05:47:46 +00:00
"routePanelAnalyticsViews" : routePanelAnalyticsViews ,
2018-01-04 10:23:33 +00:00
"routePanelAnalyticsRoutes" : routePanelAnalyticsRoutes ,
2018-01-05 22:47:13 +00:00
"routePanelAnalyticsRouteViews" : routePanelAnalyticsRouteViews ,
2017-12-10 03:43:30 +00:00
"routePanelGroups" : routePanelGroups ,
"routePanelGroupsEdit" : routePanelGroupsEdit ,
"routePanelGroupsEditPerms" : routePanelGroupsEditPerms ,
"routePanelGroupsEditSubmit" : routePanelGroupsEditSubmit ,
"routePanelGroupsEditPermsSubmit" : routePanelGroupsEditPermsSubmit ,
"routePanelGroupsCreateSubmit" : routePanelGroupsCreateSubmit ,
"routePanelBackups" : routePanelBackups ,
"routePanelLogsMod" : routePanelLogsMod ,
"routePanelDebug" : routePanelDebug ,
"routePanel" : routePanel ,
"routeAccountEditCritical" : routeAccountEditCritical ,
"routeAccountEditCriticalSubmit" : routeAccountEditCriticalSubmit ,
"routeAccountEditAvatar" : routeAccountEditAvatar ,
"routeAccountEditAvatarSubmit" : routeAccountEditAvatarSubmit ,
"routeAccountEditUsername" : routeAccountEditUsername ,
"routeAccountEditUsernameSubmit" : routeAccountEditUsernameSubmit ,
"routeAccountEditEmail" : routeAccountEditEmail ,
"routeAccountEditEmailTokenSubmit" : routeAccountEditEmailTokenSubmit ,
"routeProfile" : routeProfile ,
"routeBanSubmit" : routeBanSubmit ,
"routeUnban" : routeUnban ,
"routeActivate" : routeActivate ,
"routeIps" : routeIps ,
2017-12-24 22:08:35 +00:00
"routeDynamic" : routeDynamic ,
"routeUploads" : routeUploads ,
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 {
"routeAPI" : 0 ,
"routeOverview" : 1 ,
2017-12-22 03:32:23 +00:00
"routeCustomPage" : 2 ,
"routeForums" : 3 ,
"routeForum" : 4 ,
"routeChangeTheme" : 5 ,
"routeShowAttachment" : 6 ,
"routeReportSubmit" : 7 ,
"routeTopicCreate" : 8 ,
"routeTopics" : 9 ,
"routePanelForums" : 10 ,
"routePanelForumsCreateSubmit" : 11 ,
"routePanelForumsDelete" : 12 ,
"routePanelForumsDeleteSubmit" : 13 ,
"routePanelForumsEdit" : 14 ,
"routePanelForumsEditSubmit" : 15 ,
"routePanelForumsEditPermsSubmit" : 16 ,
2018-01-08 08:53:51 +00:00
"routePanelForumsEditPermsAdvance" : 17 ,
"routePanelSettings" : 18 ,
"routePanelSettingEdit" : 19 ,
"routePanelSettingEditSubmit" : 20 ,
"routePanelWordFilters" : 21 ,
"routePanelWordFiltersCreate" : 22 ,
"routePanelWordFiltersEdit" : 23 ,
"routePanelWordFiltersEditSubmit" : 24 ,
"routePanelWordFiltersDeleteSubmit" : 25 ,
"routePanelThemes" : 26 ,
"routePanelThemesSetDefault" : 27 ,
"routePanelPlugins" : 28 ,
"routePanelPluginsActivate" : 29 ,
"routePanelPluginsDeactivate" : 30 ,
"routePanelPluginsInstall" : 31 ,
"routePanelUsers" : 32 ,
"routePanelUsersEdit" : 33 ,
"routePanelUsersEditSubmit" : 34 ,
"routePanelAnalyticsViews" : 35 ,
"routePanelAnalyticsRoutes" : 36 ,
"routePanelAnalyticsRouteViews" : 37 ,
"routePanelGroups" : 38 ,
"routePanelGroupsEdit" : 39 ,
"routePanelGroupsEditPerms" : 40 ,
"routePanelGroupsEditSubmit" : 41 ,
"routePanelGroupsEditPermsSubmit" : 42 ,
"routePanelGroupsCreateSubmit" : 43 ,
"routePanelBackups" : 44 ,
"routePanelLogsMod" : 45 ,
"routePanelDebug" : 46 ,
"routePanel" : 47 ,
"routeAccountEditCritical" : 48 ,
"routeAccountEditCriticalSubmit" : 49 ,
"routeAccountEditAvatar" : 50 ,
"routeAccountEditAvatarSubmit" : 51 ,
"routeAccountEditUsername" : 52 ,
"routeAccountEditUsernameSubmit" : 53 ,
"routeAccountEditEmail" : 54 ,
"routeAccountEditEmailTokenSubmit" : 55 ,
"routeProfile" : 56 ,
"routeBanSubmit" : 57 ,
"routeUnban" : 58 ,
"routeActivate" : 59 ,
"routeIps" : 60 ,
"routeDynamic" : 61 ,
"routeUploads" : 62 ,
2017-12-19 03:53:13 +00:00
}
var reverseRouteMapEnum = map [ int ] string {
0 : "routeAPI" ,
1 : "routeOverview" ,
2017-12-22 03:32:23 +00:00
2 : "routeCustomPage" ,
3 : "routeForums" ,
4 : "routeForum" ,
5 : "routeChangeTheme" ,
6 : "routeShowAttachment" ,
7 : "routeReportSubmit" ,
8 : "routeTopicCreate" ,
9 : "routeTopics" ,
10 : "routePanelForums" ,
11 : "routePanelForumsCreateSubmit" ,
12 : "routePanelForumsDelete" ,
13 : "routePanelForumsDeleteSubmit" ,
14 : "routePanelForumsEdit" ,
15 : "routePanelForumsEditSubmit" ,
16 : "routePanelForumsEditPermsSubmit" ,
2018-01-08 08:53:51 +00:00
17 : "routePanelForumsEditPermsAdvance" ,
18 : "routePanelSettings" ,
19 : "routePanelSettingEdit" ,
20 : "routePanelSettingEditSubmit" ,
21 : "routePanelWordFilters" ,
22 : "routePanelWordFiltersCreate" ,
23 : "routePanelWordFiltersEdit" ,
24 : "routePanelWordFiltersEditSubmit" ,
25 : "routePanelWordFiltersDeleteSubmit" ,
26 : "routePanelThemes" ,
27 : "routePanelThemesSetDefault" ,
28 : "routePanelPlugins" ,
29 : "routePanelPluginsActivate" ,
30 : "routePanelPluginsDeactivate" ,
31 : "routePanelPluginsInstall" ,
32 : "routePanelUsers" ,
33 : "routePanelUsersEdit" ,
34 : "routePanelUsersEditSubmit" ,
35 : "routePanelAnalyticsViews" ,
36 : "routePanelAnalyticsRoutes" ,
37 : "routePanelAnalyticsRouteViews" ,
38 : "routePanelGroups" ,
39 : "routePanelGroupsEdit" ,
40 : "routePanelGroupsEditPerms" ,
41 : "routePanelGroupsEditSubmit" ,
42 : "routePanelGroupsEditPermsSubmit" ,
43 : "routePanelGroupsCreateSubmit" ,
44 : "routePanelBackups" ,
45 : "routePanelLogsMod" ,
46 : "routePanelDebug" ,
47 : "routePanel" ,
48 : "routeAccountEditCritical" ,
49 : "routeAccountEditCriticalSubmit" ,
50 : "routeAccountEditAvatar" ,
51 : "routeAccountEditAvatarSubmit" ,
52 : "routeAccountEditUsername" ,
53 : "routeAccountEditUsernameSubmit" ,
54 : "routeAccountEditEmail" ,
55 : "routeAccountEditEmailTokenSubmit" ,
56 : "routeProfile" ,
57 : "routeBanSubmit" ,
58 : "routeUnban" ,
59 : "routeActivate" ,
60 : "routeIps" ,
61 : "routeDynamic" ,
62 : "routeUploads" ,
2017-12-19 03:53:13 +00:00
}
// TODO: Stop spilling these into the package scope?
func init ( ) {
common . SetRouteMapEnum ( routeMapEnum )
common . SetReverseRouteMapEnum ( reverseRouteMapEnum )
}
2017-04-12 13:39:03 +00:00
type GenRouter struct {
UploadHandler func ( http . ResponseWriter , * http . Request )
2017-12-19 03:53:13 +00:00
extraRoutes map [ string ] func ( http . ResponseWriter , * http . Request , common . User ) common . RouteError
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
}
2017-04-13 09:26:40 +00:00
func NewGenRouter ( uploads http . Handler ) * GenRouter {
2017-04-12 13:39:03 +00:00
return & GenRouter {
2017-04-13 09:26:40 +00:00
UploadHandler : http . StripPrefix ( "/uploads/" , uploads ) . ServeHTTP ,
2017-12-19 03:53:13 +00:00
extraRoutes : make ( map [ string ] func ( http . ResponseWriter , * http . Request , common . User ) common . RouteError ) ,
2017-04-12 13:39:03 +00:00
}
}
2017-11-11 04:06:16 +00:00
func ( router * GenRouter ) handleError ( err common . RouteError , w http . ResponseWriter , r * http . Request , user common . User ) {
2017-10-30 09:57:08 +00:00
if err . Handled ( ) {
return
}
if err . Type ( ) == "system" {
2017-11-11 04:06:16 +00:00
common . InternalErrorJSQ ( err , w , r , err . JSON ( ) )
2017-10-30 09:57:08 +00:00
return
}
2017-11-11 04:06:16 +00:00
common . LocalErrorJSQ ( err . Error ( ) , w , r , user , err . JSON ( ) )
2017-10-30 09:57:08 +00:00
}
2017-04-13 09:26:40 +00:00
func ( router * GenRouter ) Handle ( _ string , _ http . Handler ) {
2017-04-12 13:39:03 +00:00
}
2017-11-11 04:06:16 +00:00
func ( router * GenRouter ) HandleFunc ( pattern string , handle func ( http . ResponseWriter , * http . Request , common . User ) common . RouteError ) {
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
router . Lock ( )
2017-12-10 03:43:30 +00:00
defer router . Unlock ( )
2017-12-19 03:53:13 +00:00
router . extraRoutes [ pattern ] = handle
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
}
func ( router * GenRouter ) RemoveFunc ( pattern string ) error {
2017-04-12 13:39:03 +00:00
router . Lock ( )
2017-12-10 03:43:30 +00:00
defer router . Unlock ( )
2017-12-19 03:53:13 +00:00
_ , ok := router . 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
}
2017-12-19 03:53:13 +00:00
delete ( router . 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
}
2017-12-22 03:32:23 +00:00
// TODO: Pass the default route or config struct to the router rather than accessing it via a package global
// TODO: SetDefaultRoute
// TODO: GetDefaultRoute
2017-04-12 13:39:03 +00:00
func ( router * GenRouter ) ServeHTTP ( w http . ResponseWriter , req * http . Request ) {
2017-08-15 13:47:56 +00:00
if len ( req . URL . Path ) == 0 || req . URL . Path [ 0 ] != '/' {
2017-04-12 13:39:03 +00:00
w . WriteHeader ( 405 )
w . Write ( [ ] byte ( "" ) )
return
}
2017-12-19 03:53:13 +00:00
var prefix , extraData string
2017-04-13 09:26:40 +00:00
prefix = req . URL . Path [ 0 : strings . IndexByte ( req . URL . Path [ 1 : ] , '/' ) + 1 ]
if req . URL . Path [ len ( req . URL . Path ) - 1 ] != '/' {
2017-12-19 03:53:13 +00:00
extraData = req . URL . Path [ strings . LastIndexByte ( req . URL . Path , '/' ) + 1 : ]
2017-04-12 13:39:03 +00:00
req . URL . Path = req . URL . Path [ : strings . LastIndexByte ( req . URL . Path , '/' ) + 1 ]
2017-04-13 09:26:40 +00:00
}
2017-08-06 15:22:18 +00:00
2017-11-11 04:06:16 +00:00
if common . Dev . SuperDebug {
2017-09-11 10:24:03 +00:00
log . Print ( "before routeStatic" )
2017-09-10 16:57:22 +00:00
log . Print ( "prefix: " , prefix )
log . Print ( "req.URL.Path: " , req . URL . Path )
2017-12-19 03:53:13 +00:00
log . Print ( "extraData: " , extraData )
2017-09-10 16:57:22 +00:00
log . Print ( "req.Referer(): " , req . Referer ( ) )
2017-08-06 15:22:18 +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
if prefix == "/static" {
2017-12-19 03:53:13 +00:00
req . URL . Path += extraData
2017-11-11 04:06:16 +00:00
routeStatic ( 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
}
2017-11-11 04:06:16 +00:00
if common . Dev . SuperDebug {
2017-08-13 11:22:34 +00:00
log . Print ( "before PreRoute" )
2017-07-17 10:23:42 +00:00
}
2017-12-10 03:43:30 +00:00
// Increment the global view counter
common . GlobalViewCounter . Bump ( )
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.
2017-11-11 04:06:16 +00:00
user , ok := common . 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
}
2017-11-11 04:06:16 +00:00
if common . Dev . SuperDebug {
2017-08-13 11:22:34 +00:00
log . Print ( "after PreRoute" )
2017-12-19 03:53:13 +00:00
log . Print ( "routeMapEnum: " , routeMapEnum )
2017-07-17 10:23:42 +00:00
}
2017-11-11 04:06:16 +00:00
var err common . RouteError
2017-04-13 09:26:40 +00:00
switch ( prefix ) {
2017-05-02 17:24:33 +00:00
case "/api" :
2017-12-19 03:53:13 +00:00
common . RouteViewCounter . Bump ( 0 )
2017-10-30 09:57:08 +00:00
err = routeAPI ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
}
2017-04-13 09:26:40 +00:00
case "/overview" :
2017-12-19 03:53:13 +00:00
common . RouteViewCounter . Bump ( 1 )
2017-10-30 09:57:08 +00:00
err = routeOverview ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
}
2017-12-22 03:32:23 +00:00
case "/pages" :
2017-12-19 03:53:13 +00:00
common . RouteViewCounter . Bump ( 2 )
2017-12-22 03:32:23 +00:00
err = routeCustomPage ( w , req , user , extraData )
if err != nil {
router . handleError ( err , w , req , user )
}
case "/forums" :
common . RouteViewCounter . Bump ( 3 )
2017-10-30 09:57:08 +00:00
err = routeForums ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
}
2017-04-13 15:01:30 +00:00
case "/forum" :
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 4 )
2017-12-19 03:53:13 +00:00
err = routeForum ( w , req , user , extraData )
2017-10-30 09:57:08 +00:00
if err != nil {
router . handleError ( err , w , req , user )
}
2017-09-10 16:57:22 +00:00
case "/theme" :
2017-11-12 07:18:25 +00:00
err = common . ParseForm ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 5 )
2017-10-30 09:57:08 +00:00
err = routeChangeTheme ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
}
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" :
2017-11-12 07:18:25 +00:00
err = common . ParseForm ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 6 )
2017-12-19 03:53:13 +00:00
err = routeShowAttachment ( w , req , user , extraData )
2017-10-30 09:57:08 +00:00
if err != nil {
router . handleError ( err , w , req , user )
}
2017-05-02 17:24:33 +00:00
case "/report" :
2017-11-11 04:06:16 +00:00
err = common . NoBanned ( w , req , user )
2017-11-08 07:28:33 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-05-02 17:24:33 +00:00
switch ( req . URL . Path ) {
case "/report/submit/" :
2017-11-12 07:18:25 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
err = common . MemberOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 7 )
2017-12-19 03:53:13 +00:00
err = routeReportSubmit ( w , req , user , extraData )
2017-10-30 09:57:08 +00:00
}
if err != nil {
router . handleError ( err , w , req , user )
2017-05-02 17:24:33 +00:00
}
2017-04-13 09:26:40 +00:00
case "/topics" :
switch ( req . URL . Path ) {
case "/topics/create/" :
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 8 )
2017-12-19 03:53:13 +00:00
err = routeTopicCreate ( w , req , user , extraData )
2017-04-13 10:55:51 +00:00
default :
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 9 )
2017-10-30 09:57:08 +00:00
err = routeTopics ( w , req , user )
}
if err != nil {
router . handleError ( err , w , req , user )
2017-04-13 10:55:51 +00:00
}
case "/panel" :
2017-11-11 04:06:16 +00:00
err = common . SuperModOnly ( w , req , user )
2017-10-30 09:57:08 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-04-13 10:55:51 +00:00
switch ( req . URL . Path ) {
case "/panel/forums/" :
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 10 )
2017-10-30 09:57:08 +00:00
err = routePanelForums ( w , req , user )
2017-04-13 10:55:51 +00:00
case "/panel/forums/create/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 11 )
2017-10-30 09:57:08 +00:00
err = routePanelForumsCreateSubmit ( w , req , user )
2017-04-13 10:55:51 +00:00
case "/panel/forums/delete/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 12 )
2017-12-19 03:53:13 +00:00
err = routePanelForumsDelete ( w , req , user , extraData )
2017-04-13 10:55:51 +00:00
case "/panel/forums/delete/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 13 )
2017-12-19 03:53:13 +00:00
err = routePanelForumsDeleteSubmit ( w , req , user , extraData )
2017-04-13 10:55:51 +00:00
case "/panel/forums/edit/" :
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 14 )
2017-12-19 03:53:13 +00:00
err = routePanelForumsEdit ( w , req , user , extraData )
2017-04-13 10:55:51 +00:00
case "/panel/forums/edit/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 15 )
2017-12-19 03:53:13 +00:00
err = routePanelForumsEditSubmit ( w , req , user , extraData )
2017-06-05 11:57:27 +00:00
case "/panel/forums/edit/perms/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 16 )
2017-12-19 03:53:13 +00:00
err = routePanelForumsEditPermsSubmit ( w , req , user , extraData )
2018-01-08 08:53:51 +00:00
case "/panel/forums/edit/perms/" :
2017-12-22 03:32:23 +00:00
common . RouteViewCounter . Bump ( 17 )
2018-01-08 08:53:51 +00:00
err = routePanelForumsEditPermsAdvance ( w , req , user , extraData )
case "/panel/settings/" :
common . RouteViewCounter . Bump ( 18 )
2017-10-30 09:57:08 +00:00
err = routePanelSettings ( w , req , user )
2017-04-13 15:01:30 +00:00
case "/panel/settings/edit/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 19 )
2017-12-19 03:53:13 +00:00
err = routePanelSettingEdit ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/settings/edit/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 20 )
2017-12-19 03:53:13 +00:00
err = routePanelSettingEditSubmit ( w , req , user , extraData )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 21 )
2017-10-30 09:57:08 +00:00
err = routePanelWordFilters ( w , req , user )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/create/" :
2017-11-12 07:18:25 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 22 )
2017-10-30 09:57:08 +00:00
err = routePanelWordFiltersCreate ( w , req , user )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/edit/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 23 )
2017-12-19 03:53:13 +00:00
err = routePanelWordFiltersEdit ( w , req , user , extraData )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/edit/submit/" :
2017-11-12 07:18:25 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 24 )
2017-12-19 03:53:13 +00:00
err = routePanelWordFiltersEditSubmit ( w , req , user , extraData )
2017-08-27 09:33:45 +00:00
case "/panel/settings/word-filters/delete/submit/" :
2017-11-12 07:18:25 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-11 23:34:27 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 25 )
2017-12-19 03:53:13 +00:00
err = routePanelWordFiltersDeleteSubmit ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/themes/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 26 )
2017-10-30 09:57:08 +00:00
err = routePanelThemes ( w , req , user )
2017-04-13 15:01:30 +00:00
case "/panel/themes/default/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 27 )
2017-12-19 03:53:13 +00:00
err = routePanelThemesSetDefault ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/plugins/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 28 )
2017-10-30 09:57:08 +00:00
err = routePanelPlugins ( w , req , user )
2017-04-13 15:01:30 +00:00
case "/panel/plugins/activate/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 29 )
2017-12-19 03:53:13 +00:00
err = routePanelPluginsActivate ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/plugins/deactivate/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 30 )
2017-12-19 03:53:13 +00:00
err = routePanelPluginsDeactivate ( w , req , user , extraData )
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/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 31 )
2017-12-19 03:53:13 +00:00
err = routePanelPluginsInstall ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/users/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 32 )
2017-10-30 09:57:08 +00:00
err = routePanelUsers ( w , req , user )
2017-04-13 15:01:30 +00:00
case "/panel/users/edit/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 33 )
2017-12-19 03:53:13 +00:00
err = routePanelUsersEdit ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/users/edit/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 34 )
2017-12-19 03:53:13 +00:00
err = routePanelUsersEditSubmit ( w , req , user , extraData )
2017-12-30 05:47:46 +00:00
case "/panel/analytics/views/" :
2018-01-08 08:53:51 +00:00
err = common . ParseForm ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
common . RouteViewCounter . Bump ( 35 )
2017-12-30 05:47:46 +00:00
err = routePanelAnalyticsViews ( w , req , user )
2018-01-04 10:23:33 +00:00
case "/panel/analytics/routes/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 36 )
2018-01-04 10:23:33 +00:00
err = routePanelAnalyticsRoutes ( w , req , user )
2018-01-05 22:47:13 +00:00
case "/panel/analytics/route/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 37 )
2018-01-05 22:47:13 +00:00
err = routePanelAnalyticsRouteViews ( w , req , user , extraData )
case "/panel/groups/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 38 )
2017-10-30 09:57:08 +00:00
err = routePanelGroups ( w , req , user )
2017-04-13 15:01:30 +00:00
case "/panel/groups/edit/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 39 )
2017-12-19 03:53:13 +00:00
err = routePanelGroupsEdit ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/groups/edit/perms/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 40 )
2017-12-19 03:53:13 +00:00
err = routePanelGroupsEditPerms ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/groups/edit/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 41 )
2017-12-19 03:53:13 +00:00
err = routePanelGroupsEditSubmit ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/groups/edit/perms/submit/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 42 )
2017-12-19 03:53:13 +00:00
err = routePanelGroupsEditPermsSubmit ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/groups/create/" :
2017-11-11 23:34:27 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 43 )
2017-10-30 09:57:08 +00:00
err = routePanelGroupsCreateSubmit ( w , req , user )
2017-09-23 19:57:13 +00:00
case "/panel/backups/" :
2017-12-19 03:53:13 +00:00
err = common . SuperAdminOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 44 )
2017-12-19 03:53:13 +00:00
err = routePanelBackups ( w , req , user , extraData )
2017-04-13 15:01:30 +00:00
case "/panel/logs/mod/" :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 45 )
2017-10-30 09:57:08 +00:00
err = routePanelLogsMod ( w , req , user )
2017-08-15 13:47:56 +00:00
case "/panel/debug/" :
2017-11-11 23:34:27 +00:00
err = common . AdminOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 46 )
2017-10-30 09:57:08 +00:00
err = routePanelDebug ( w , req , user )
2017-04-13 10:55:51 +00:00
default :
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 47 )
2017-10-30 09:57:08 +00:00
err = routePanel ( w , req , user )
}
if err != nil {
router . handleError ( err , w , req , user )
2017-11-05 09:55:34 +00:00
}
case "/user" :
switch ( req . URL . Path ) {
case "/user/edit/critical/" :
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 48 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditCritical ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/critical/submit/" :
2017-11-11 04:06:16 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 49 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditCriticalSubmit ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/avatar/" :
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 50 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditAvatar ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/avatar/submit/" :
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 51 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditAvatarSubmit ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/username/" :
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 52 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditUsername ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/username/submit/" :
2017-11-12 07:18:25 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 53 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditUsernameSubmit ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/email/" :
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 54 )
2017-11-10 03:33:11 +00:00
err = routeAccountEditEmail ( w , req , user )
2017-11-05 09:55:34 +00:00
case "/user/edit/token/" :
2017-11-12 07:18:25 +00:00
err = common . NoSessionMismatch ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-11-11 04:06:16 +00:00
err = common . MemberOnly ( w , req , user )
2017-11-05 09:55:34 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 55 )
2017-12-19 03:53:13 +00:00
err = routeAccountEditEmailTokenSubmit ( w , req , user , extraData )
2017-11-05 09:55:34 +00:00
default :
2017-12-19 03:53:13 +00:00
req . URL . Path += extraData
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 56 )
2017-11-05 09:55:34 +00:00
err = routeProfile ( w , req , user )
}
if err != nil {
router . handleError ( err , w , req , user )
2017-11-10 03:33:11 +00:00
}
case "/users" :
switch ( req . URL . Path ) {
case "/users/ban/submit/" :
2017-11-11 04:06:16 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-11-12 07:18:25 +00:00
err = common . MemberOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 57 )
2017-12-25 02:41:10 +00:00
err = routeBanSubmit ( w , req , user , extraData )
2017-11-10 03:33:11 +00:00
case "/users/unban/" :
2017-11-11 04:06:16 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-11-12 07:18:25 +00:00
err = common . MemberOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 58 )
2017-12-25 02:41:10 +00:00
err = routeUnban ( w , req , user , extraData )
2017-11-10 03:33:11 +00:00
case "/users/activate/" :
2017-11-11 04:06:16 +00:00
err = common . NoSessionMismatch ( w , req , user )
2017-11-10 03:33:11 +00:00
if err != nil {
router . handleError ( err , w , req , user )
return
}
2017-11-12 07:18:25 +00:00
err = common . MemberOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 59 )
2017-12-25 02:41:10 +00:00
err = routeActivate ( w , req , user , extraData )
2017-11-10 03:33:11 +00:00
case "/users/ips/" :
2017-11-12 07:18:25 +00:00
err = common . MemberOnly ( w , req , user )
if err != nil {
router . handleError ( err , w , req , user )
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 60 )
2017-11-10 03:33:11 +00:00
err = routeIps ( w , req , user )
}
if err != nil {
router . handleError ( err , w , req , user )
2017-04-13 09:26:40 +00:00
}
2017-12-24 07:38:46 +00:00
/ * case "/sitemaps" : // TODO: Count these views
req . URL . Path += extraData
err = sitemapSwitch ( w , req )
if err != nil {
router . handleError ( err , w , req , user )
} * /
2017-04-13 09:26:40 +00:00
case "/uploads" :
2017-12-19 03:53:13 +00:00
if extraData == "" {
2017-11-11 04:06:16 +00:00
common . NotFound ( w , req )
2017-04-13 09:26:40 +00:00
return
}
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 62 )
2017-12-19 03:53:13 +00:00
req . URL . Path += extraData
2017-10-30 09:57:08 +00:00
// TODO: Find a way to propagate errors up from this?
2017-12-19 03:53:13 +00:00
router . UploadHandler ( w , req ) // TODO: Count these views
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" :
2017-12-19 03:53:13 +00:00
err = routeRobotsTxt ( w , req ) // TODO: Count these views
2017-10-30 09:57:08 +00:00
if err != nil {
router . handleError ( err , w , req , user )
}
2017-08-06 15:22:18 +00:00
return
2017-12-24 07:38:46 +00:00
/ * case "sitemap.xml" :
err = routeSitemapXml ( w , req ) // TODO: Count these views
if err != nil {
router . handleError ( err , w , req , user )
}
return * /
2017-08-06 15:22:18 +00:00
}
2017-12-19 03:53:13 +00:00
if extraData != "" {
2017-11-11 04:06:16 +00:00
common . NotFound ( w , req )
2017-08-06 15:22:18 +00:00
return
}
2017-12-22 03:32:23 +00:00
handle , ok := RouteMap [ common . Config . DefaultRoute ]
if ! ok {
// TODO: Make this a startup error not a runtime one
log . Print ( "Unable to find the default route" )
common . NotFound ( w , req )
return
}
common . RouteViewCounter . Bump ( routeMapEnum [ common . Config . DefaultRoute ] )
handle . ( func ( http . ResponseWriter , * http . Request , common . User ) common . RouteError ) ( w , req , user )
2017-10-30 09:57:08 +00:00
default :
// A fallback for the routes which haven't been converted to the new router yet or plugins
router . RLock ( )
2017-12-19 03:53:13 +00:00
handle , ok := router . extraRoutes [ req . URL . Path ]
2017-10-30 09:57:08 +00:00
router . RUnlock ( )
if ok {
2018-01-08 08:53:51 +00:00
common . RouteViewCounter . Bump ( 61 ) // TODO: Be more specific about *which* dynamic route it is
2017-12-19 03:53:13 +00:00
req . URL . Path += extraData
2017-12-24 22:08:35 +00:00
err = handle ( w , req , user )
2017-10-30 09:57:08 +00:00
if err != nil {
router . handleError ( err , w , req , user )
}
return
}
2017-12-19 03:53:13 +00:00
common . NotFound ( w , req ) // TODO: Collect all the error view counts so we can add a replacement for GlobalViewCounter by adding up the view counts of every route? Complex and may be inaccurate, collecting it globally and locally would at-least help find places we aren't capturing views
2017-04-12 13:39:03 +00:00
}
}