2017-04-12 10:10:36 +00:00
|
|
|
package main
|
|
|
|
|
2017-11-07 22:38:15 +00:00
|
|
|
// TODO: How should we handle headerLite and headerVar?
|
2017-04-12 10:10:36 +00:00
|
|
|
func routes() {
|
2017-11-12 07:18:25 +00:00
|
|
|
addRoute(View("routeAPI", "/api/"))
|
|
|
|
addRoute(View("routeOverview", "/overview/"))
|
2017-09-11 10:24:03 +00:00
|
|
|
//addRoute("routeCustomPage","/pages/",""/*,"&extra_data"*/)
|
2017-11-12 07:18:25 +00:00
|
|
|
addRoute(View("routeForums", "/forums/" /*,"&forums"*/))
|
|
|
|
addRoute(View("routeForum", "/forum/", "extra_data"))
|
|
|
|
addRoute(AnonAction("routeChangeTheme", "/theme/"))
|
|
|
|
addRoute(
|
|
|
|
View("routeShowAttachment", "/attachs/", "extra_data").Before("ParseForm"),
|
|
|
|
)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-11-08 07:28:33 +00:00
|
|
|
// TODO: Reduce the number of Befores. With a new method, perhaps?
|
2017-10-30 09:57:08 +00:00
|
|
|
reportGroup := newRouteGroup("/report/",
|
2017-11-12 07:18:25 +00:00
|
|
|
Action("routeReportSubmit", "/report/submit/", "extra_data"),
|
|
|
|
).Before("NoBanned")
|
2017-10-30 09:57:08 +00:00
|
|
|
addRouteGroup(reportGroup)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-10-30 09:57:08 +00:00
|
|
|
topicGroup := newRouteGroup("/topics/",
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routeTopics", "/topics/"),
|
|
|
|
MemberView("routeTopicCreate", "/topics/create/", "extra_data"),
|
2017-04-13 09:26:40 +00:00
|
|
|
)
|
2017-10-30 09:57:08 +00:00
|
|
|
addRouteGroup(topicGroup)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-10-31 07:26:44 +00:00
|
|
|
buildPanelRoutes()
|
2017-11-05 09:55:34 +00:00
|
|
|
buildUserRoutes()
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Test the email token route
|
|
|
|
func buildUserRoutes() {
|
2017-11-08 07:28:33 +00:00
|
|
|
userGroup := newRouteGroup("/user/")
|
2017-11-05 09:55:34 +00:00
|
|
|
userGroup.Routes(
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routeProfile", "/user/").LitBefore("req.URL.Path += extra_data"),
|
|
|
|
MemberView("routeAccountEditCritical", "/user/edit/critical/"),
|
|
|
|
Action("routeAccountEditCriticalSubmit", "/user/edit/critical/submit/"), // TODO: Full test this
|
|
|
|
MemberView("routeAccountEditAvatar", "/user/edit/avatar/"),
|
|
|
|
UploadAction("routeAccountEditAvatarSubmit", "/user/edit/avatar/submit/"),
|
|
|
|
MemberView("routeAccountEditUsername", "/user/edit/username/"),
|
|
|
|
Action("routeAccountEditUsernameSubmit", "/user/edit/username/submit/"), // TODO: Full test this
|
|
|
|
MemberView("routeAccountEditEmail", "/user/edit/email/"),
|
|
|
|
Action("routeAccountEditEmailTokenSubmit", "/user/edit/token/", "extra_data"),
|
|
|
|
)
|
2017-11-05 09:55:34 +00:00
|
|
|
addRouteGroup(userGroup)
|
2017-11-10 03:33:11 +00:00
|
|
|
|
|
|
|
// TODO: Auto test and manual test these routes
|
2017-11-12 07:18:25 +00:00
|
|
|
userGroup = newRouteGroup("/users/")
|
2017-11-10 03:33:11 +00:00
|
|
|
userGroup.Routes(
|
2017-11-12 07:18:25 +00:00
|
|
|
Action("routeBanSubmit", "/users/ban/submit/"),
|
|
|
|
Action("routeUnban", "/users/unban/"),
|
|
|
|
Action("routeActivate", "/users/activate/"),
|
|
|
|
MemberView("routeIps", "/users/ips/"),
|
|
|
|
)
|
2017-11-10 03:33:11 +00:00
|
|
|
addRouteGroup(userGroup)
|
2017-10-31 07:26:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func buildPanelRoutes() {
|
2017-11-05 09:55:34 +00:00
|
|
|
panelGroup := newRouteGroup("/panel/").Before("SuperModOnly")
|
2017-10-30 09:57:08 +00:00
|
|
|
panelGroup.Routes(
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanel", "/panel/"),
|
|
|
|
View("routePanelForums", "/panel/forums/"),
|
|
|
|
Action("routePanelForumsCreateSubmit", "/panel/forums/create/"),
|
|
|
|
Action("routePanelForumsDelete", "/panel/forums/delete/", "extra_data"),
|
|
|
|
Action("routePanelForumsDeleteSubmit", "/panel/forums/delete/submit/", "extra_data"),
|
|
|
|
View("routePanelForumsEdit", "/panel/forums/edit/", "extra_data"),
|
|
|
|
Action("routePanelForumsEditSubmit", "/panel/forums/edit/submit/", "extra_data"),
|
|
|
|
Action("routePanelForumsEditPermsSubmit", "/panel/forums/edit/perms/submit/", "extra_data"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelSettings", "/panel/settings/"),
|
2017-11-23 05:37:08 +00:00
|
|
|
View("routePanelSettingEdit", "/panel/settings/edit/", "extra_data"),
|
|
|
|
Action("routePanelSettingEditSubmit", "/panel/settings/edit/submit/", "extra_data"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelWordFilters", "/panel/settings/word-filters/"),
|
|
|
|
Action("routePanelWordFiltersCreate", "/panel/settings/word-filters/create/"),
|
|
|
|
View("routePanelWordFiltersEdit", "/panel/settings/word-filters/edit/", "extra_data"),
|
|
|
|
Action("routePanelWordFiltersEditSubmit", "/panel/settings/word-filters/edit/submit/", "extra_data"),
|
|
|
|
Action("routePanelWordFiltersDeleteSubmit", "/panel/settings/word-filters/delete/submit/", "extra_data"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelThemes", "/panel/themes/"),
|
|
|
|
Action("routePanelThemesSetDefault", "/panel/themes/default/", "extra_data"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelPlugins", "/panel/plugins/"),
|
|
|
|
Action("routePanelPluginsActivate", "/panel/plugins/activate/", "extra_data"),
|
|
|
|
Action("routePanelPluginsDeactivate", "/panel/plugins/deactivate/", "extra_data"),
|
|
|
|
Action("routePanelPluginsInstall", "/panel/plugins/install/", "extra_data"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelUsers", "/panel/users/"),
|
|
|
|
View("routePanelUsersEdit", "/panel/users/edit/", "extra_data"),
|
|
|
|
Action("routePanelUsersEditSubmit", "/panel/users/edit/submit/", "extra_data"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelGroups", "/panel/groups/"),
|
|
|
|
View("routePanelGroupsEdit", "/panel/groups/edit/", "extra_data"),
|
|
|
|
View("routePanelGroupsEditPerms", "/panel/groups/edit/perms/", "extra_data"),
|
|
|
|
Action("routePanelGroupsEditSubmit", "/panel/groups/edit/submit/", "extra_data"),
|
|
|
|
Action("routePanelGroupsEditPermsSubmit", "/panel/groups/edit/perms/submit/", "extra_data"),
|
|
|
|
Action("routePanelGroupsCreateSubmit", "/panel/groups/create/"),
|
2017-10-31 07:26:44 +00:00
|
|
|
|
2017-11-12 07:18:25 +00:00
|
|
|
View("routePanelBackups", "/panel/backups/", "extra_data"),
|
|
|
|
View("routePanelLogsMod", "/panel/logs/mod/"),
|
|
|
|
View("routePanelDebug", "/panel/debug/").Before("AdminOnly"),
|
2017-04-13 10:55:51 +00:00
|
|
|
)
|
2017-10-30 09:57:08 +00:00
|
|
|
addRouteGroup(panelGroup)
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|