97 lines
4.5 KiB
Go
97 lines
4.5 KiB
Go
package main
|
|
|
|
// TODO: How should we handle headerLite and headerVar?
|
|
func routes() {
|
|
//addRoute("default_route","","")
|
|
addRoute(Route("routeAPI", "/api/"))
|
|
///addRoute("routeStatic","/static/","req.URL.Path += extra_data")
|
|
addRoute(Route("routeOverview", "/overview/"))
|
|
//addRoute("routeCustomPage","/pages/",""/*,"&extra_data"*/)
|
|
addRoute(Route("routeForums", "/forums/" /*,"&forums"*/))
|
|
addRoute(Route("routeForum", "/forum/", "extra_data"))
|
|
//addRoute("routeTopicCreate","/topics/create/","","extra_data")
|
|
//addRoute("routeTopics","/topics/",""/*,"&groups","&forums"*/)
|
|
addRoute(Route("routeChangeTheme", "/theme/"))
|
|
addRoute(Route("routeShowAttachment", "/attachs/", "extra_data"))
|
|
|
|
// TODO: Reduce the number of Befores. With a new method, perhaps?
|
|
reportGroup := newRouteGroup("/report/",
|
|
Route("routeReportSubmit", "/report/submit/", "extra_data"),
|
|
).Before("MemberOnly").Before("NoBanned").Before("NoSessionMismatch")
|
|
addRouteGroup(reportGroup)
|
|
|
|
topicGroup := newRouteGroup("/topics/",
|
|
Route("routeTopics", "/topics/"),
|
|
Route("routeTopicCreate", "/topics/create/", "extra_data").Before("MemberOnly"),
|
|
)
|
|
addRouteGroup(topicGroup)
|
|
|
|
buildPanelRoutes()
|
|
buildUserRoutes()
|
|
}
|
|
|
|
// TODO: Test the email token route
|
|
func buildUserRoutes() {
|
|
userGroup := newRouteGroup("/user/")
|
|
userGroup.Routes(
|
|
Route("routeProfile", "/user/").Before("req.URL.Path += extra_data", true),
|
|
Route("routeAccountOwnEditCritical", "/user/edit/critical/"),
|
|
Route("routeAccountOwnEditCriticalSubmit", "/user/edit/critical/submit/"),
|
|
Route("routeAccountOwnEditAvatar", "/user/edit/avatar/"),
|
|
Route("routeAccountOwnEditAvatarSubmit", "/user/edit/avatar/submit/"),
|
|
Route("routeAccountOwnEditUsername", "/user/edit/username/"),
|
|
Route("routeAccountOwnEditUsernameSubmit", "/user/edit/username/submit/"),
|
|
Route("routeAccountOwnEditEmail", "/user/edit/email/"),
|
|
Route("routeAccountOwnEditEmailTokenSubmit", "/user/edit/token/", "extra_data"),
|
|
).Not("/user/").Before("MemberOnly")
|
|
addRouteGroup(userGroup)
|
|
}
|
|
|
|
func buildPanelRoutes() {
|
|
panelGroup := newRouteGroup("/panel/").Before("SuperModOnly")
|
|
panelGroup.Routes(
|
|
Route("routePanel", "/panel/"),
|
|
Route("routePanelForums", "/panel/forums/"),
|
|
Route("routePanelForumsCreateSubmit", "/panel/forums/create/"),
|
|
Route("routePanelForumsDelete", "/panel/forums/delete/", "extra_data"),
|
|
Route("routePanelForumsDeleteSubmit", "/panel/forums/delete/submit/", "extra_data"),
|
|
Route("routePanelForumsEdit", "/panel/forums/edit/", "extra_data"),
|
|
Route("routePanelForumsEditSubmit", "/panel/forums/edit/submit/", "extra_data"),
|
|
Route("routePanelForumsEditPermsSubmit", "/panel/forums/edit/perms/submit/", "extra_data"),
|
|
|
|
Route("routePanelSettings", "/panel/settings/"),
|
|
Route("routePanelSetting", "/panel/settings/edit/", "extra_data"),
|
|
Route("routePanelSettingEdit", "/panel/settings/edit/submit/", "extra_data"),
|
|
|
|
Route("routePanelWordFilters", "/panel/settings/word-filters/"),
|
|
Route("routePanelWordFiltersCreate", "/panel/settings/word-filters/create/"),
|
|
Route("routePanelWordFiltersEdit", "/panel/settings/word-filters/edit/", "extra_data"),
|
|
Route("routePanelWordFiltersEditSubmit", "/panel/settings/word-filters/edit/submit/", "extra_data"),
|
|
Route("routePanelWordFiltersDeleteSubmit", "/panel/settings/word-filters/delete/submit/", "extra_data"),
|
|
|
|
Route("routePanelThemes", "/panel/themes/"),
|
|
Route("routePanelThemesSetDefault", "/panel/themes/default/", "extra_data"),
|
|
|
|
Route("routePanelPlugins", "/panel/plugins/"),
|
|
Route("routePanelPluginsActivate", "/panel/plugins/activate/", "extra_data"),
|
|
Route("routePanelPluginsDeactivate", "/panel/plugins/deactivate/", "extra_data"),
|
|
Route("routePanelPluginsInstall", "/panel/plugins/install/", "extra_data"),
|
|
|
|
Route("routePanelUsers", "/panel/users/"),
|
|
Route("routePanelUsersEdit", "/panel/users/edit/", "extra_data"),
|
|
Route("routePanelUsersEditSubmit", "/panel/users/edit/submit/", "extra_data"),
|
|
|
|
Route("routePanelGroups", "/panel/groups/"),
|
|
Route("routePanelGroupsEdit", "/panel/groups/edit/", "extra_data"),
|
|
Route("routePanelGroupsEditPerms", "/panel/groups/edit/perms/", "extra_data"),
|
|
Route("routePanelGroupsEditSubmit", "/panel/groups/edit/submit/", "extra_data"),
|
|
Route("routePanelGroupsEditPermsSubmit", "/panel/groups/edit/perms/submit/", "extra_data"),
|
|
Route("routePanelGroupsCreateSubmit", "/panel/groups/create/"),
|
|
|
|
Route("routePanelBackups", "/panel/backups/", "extra_data"),
|
|
Route("routePanelLogsMod", "/panel/logs/mod/"),
|
|
Route("routePanelDebug", "/panel/debug/"),
|
|
)
|
|
addRouteGroup(panelGroup)
|
|
}
|