2017-04-12 10:10:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
type Route struct {
|
2017-09-03 04:50:31 +00:00
|
|
|
Name string
|
|
|
|
Path string
|
2017-04-13 09:26:40 +00:00
|
|
|
Before string
|
2017-09-03 04:50:31 +00:00
|
|
|
Vars []string
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type RouteGroup struct {
|
2017-09-03 04:50:31 +00:00
|
|
|
Path string
|
2017-04-12 10:10:36 +00:00
|
|
|
Routes []Route
|
|
|
|
}
|
|
|
|
|
2017-04-13 09:26:40 +00:00
|
|
|
func addRoute(fname string, path string, before string, vars ...string) {
|
2017-09-03 04:50:31 +00:00
|
|
|
route_list = append(route_list, Route{fname, path, before, vars})
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func addRouteGroup(path string, routes ...Route) {
|
2017-09-03 04:50:31 +00:00
|
|
|
route_groups = append(route_groups, RouteGroup{path, routes})
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func routes() {
|
2017-04-13 09:26:40 +00:00
|
|
|
//addRoute("default_route","","")
|
2017-09-11 10:24:03 +00:00
|
|
|
addRoute("routeAPI", "/api/", "")
|
|
|
|
///addRoute("routeStatic","/static/","req.URL.Path += extra_data")
|
|
|
|
addRoute("routeOverview", "/overview/", "")
|
|
|
|
//addRoute("routeCustomPage","/pages/",""/*,"&extra_data"*/)
|
|
|
|
addRoute("routeForums", "/forums/", "" /*,"&forums"*/)
|
|
|
|
addRoute("routeForum", "/forum/", "", "extra_data")
|
|
|
|
//addRoute("routeTopicCreate","/topics/create/","","extra_data")
|
|
|
|
//addRoute("routeTopics","/topics/",""/*,"&groups","&forums"*/)
|
|
|
|
addRoute("routeChangeTheme", "/theme/", "")
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-05-02 17:24:33 +00:00
|
|
|
addRouteGroup("/report/",
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routeReportSubmit", "/report/submit/", "", []string{"extra_data"}},
|
2017-05-02 17:24:33 +00:00
|
|
|
)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 09:26:40 +00:00
|
|
|
addRouteGroup("/topics/",
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routeTopics", "/topics/", "", []string{}},
|
|
|
|
Route{"routeTopicCreate", "/topics/create/", "", []string{"extra_data"}},
|
2017-04-13 09:26:40 +00:00
|
|
|
)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 10:55:51 +00:00
|
|
|
// The Control Panel
|
|
|
|
addRouteGroup("/panel/",
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanel", "/panel/", "", []string{}},
|
|
|
|
Route{"routePanelForums", "/panel/forums/", "", []string{}},
|
|
|
|
Route{"routePanelForumsCreateSubmit", "/panel/forums/create/", "", []string{}},
|
|
|
|
Route{"routePanelForumsDelete", "/panel/forums/delete/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelForumsDeleteSubmit", "/panel/forums/delete/submit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelForumsEdit", "/panel/forums/edit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelForumsEditSubmit", "/panel/forums/edit/submit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelForumsEditPermsSubmit", "/panel/forums/edit/perms/submit/", "", []string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelSettings", "/panel/settings/", "", []string{}},
|
|
|
|
Route{"routePanelSetting", "/panel/settings/edit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelSettingEdit", "/panel/settings/edit/submit/", "", []string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelWordFilters", "/panel/settings/word-filters/", "", []string{}},
|
|
|
|
Route{"routePanelWordFiltersCreate", "/panel/settings/word-filters/create/", "", []string{}},
|
|
|
|
Route{"routePanelWordFiltersEdit", "/panel/settings/word-filters/edit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelWordFiltersEditSubmit", "/panel/settings/word-filters/edit/submit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelWordFiltersDeleteSubmit", "/panel/settings/word-filters/delete/submit/", "", []string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelThemes", "/panel/themes/", "", []string{}},
|
|
|
|
Route{"routePanelThemesSetDefault", "/panel/themes/default/", "", []string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelPlugins", "/panel/plugins/", "", []string{}},
|
|
|
|
Route{"routePanelPluginsActivate", "/panel/plugins/activate/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelPluginsDeactivate", "/panel/plugins/deactivate/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelPluginsInstall", "/panel/plugins/install/", "", []string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelUsers", "/panel/users/", "", []string{}},
|
|
|
|
Route{"routePanelUsersEdit", "/panel/users/edit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelUsersEditSubmit", "/panel/users/edit/submit/", "", []string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelGroups", "/panel/groups/", "", []string{}},
|
|
|
|
Route{"routePanelGroupsEdit", "/panel/groups/edit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelGroupsEditPerms", "/panel/groups/edit/perms/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelGroupsEditSubmit", "/panel/groups/edit/submit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelGroupsEditPermsSubmit", "/panel/groups/edit/perms/submit/", "", []string{"extra_data"}},
|
|
|
|
Route{"routePanelGroupsCreateSubmit", "/panel/groups/create/", "", []string{}},
|
2017-09-03 04:50:31 +00:00
|
|
|
|
2017-09-23 19:57:13 +00:00
|
|
|
Route{"routePanelBackups", "/panel/backups/", "", []string{"extra_data"}},
|
2017-09-11 10:24:03 +00:00
|
|
|
Route{"routePanelLogsMod", "/panel/logs/mod/", "", []string{}},
|
|
|
|
Route{"routePanelDebug", "/panel/debug/", "", []string{}},
|
2017-04-13 10:55:51 +00:00
|
|
|
)
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|