2017-04-12 10:10:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
type Route struct {
|
|
|
|
Name string
|
|
|
|
Path string
|
2017-04-13 09:26:40 +00:00
|
|
|
Before string
|
2017-04-12 10:10:36 +00:00
|
|
|
Vars []string
|
|
|
|
}
|
|
|
|
|
|
|
|
type RouteGroup struct {
|
|
|
|
Path string
|
|
|
|
Routes []Route
|
|
|
|
}
|
|
|
|
|
2017-04-13 09:26:40 +00:00
|
|
|
func addRoute(fname string, path string, before string, vars ...string) {
|
|
|
|
route_list = append(route_list,Route{fname,path,before,vars})
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func addRouteGroup(path string, routes ...Route) {
|
|
|
|
route_groups = append(route_groups,RouteGroup{path,routes})
|
|
|
|
}
|
|
|
|
|
|
|
|
func routes() {
|
2017-04-13 09:26:40 +00:00
|
|
|
//addRoute("default_route","","")
|
2017-05-02 17:24:33 +00:00
|
|
|
addRoute("route_api","/api/","")
|
2017-04-13 09:26:40 +00:00
|
|
|
addRoute("route_static","/static/","req.URL.Path += extra_data")
|
|
|
|
addRoute("route_overview","/overview/","")
|
2017-04-13 15:01:30 +00:00
|
|
|
//addRoute("route_custom_page","/pages/",""/*,"&extra_data"*/)
|
2017-04-13 09:26:40 +00:00
|
|
|
addRoute("route_forums","/forums/",""/*,"&forums"*/)
|
2017-04-13 15:01:30 +00:00
|
|
|
addRoute("route_forum","/forum/","","extra_data")
|
2017-04-13 09:26:40 +00:00
|
|
|
//addRoute("route_topic_create","/topics/create/","","extra_data")
|
|
|
|
//addRoute("route_topics","/topics/",""/*,"&groups","&forums"*/)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-05-02 17:24:33 +00:00
|
|
|
addRouteGroup("/report/",
|
|
|
|
Route{"route_report_submit","/report/submit/","",[]string{"extra_data"}},
|
|
|
|
)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 09:26:40 +00:00
|
|
|
addRouteGroup("/topics/",
|
|
|
|
Route{"route_topics","/topics/","",[]string{}},
|
|
|
|
Route{"route_topic_create","/topics/create/","",[]string{"extra_data"}},
|
|
|
|
)
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 10:55:51 +00:00
|
|
|
// The Control Panel
|
|
|
|
addRouteGroup("/panel/",
|
|
|
|
Route{"route_panel","/panel/","",[]string{}},
|
|
|
|
Route{"route_panel_forums","/panel/forums/","",[]string{}},
|
|
|
|
Route{"route_panel_forums_create_submit","/panel/forums/create/","",[]string{}},
|
|
|
|
Route{"route_panel_forums_delete","/panel/forums/delete/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_forums_delete_submit","/panel/forums/delete/submit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_forums_edit","/panel/forums/edit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_forums_edit_submit","/panel/forums/edit/submit/","",[]string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
Route{"route_panel_forums_edit_perms_submit","/panel/forums/edit/perms/submit/","",[]string{"extra_data"}},
|
|
|
|
|
2017-04-13 15:01:30 +00:00
|
|
|
Route{"route_panel_settings","/panel/settings/","",[]string{}},
|
|
|
|
Route{"route_panel_setting","/panel/settings/edit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_setting_edit","/panel/settings/edit/submit/","",[]string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 15:01:30 +00:00
|
|
|
Route{"route_panel_themes","/panel/themes/","",[]string{}},
|
|
|
|
Route{"route_panel_themes_default","/panel/themes/default/","",[]string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 15:01:30 +00:00
|
|
|
Route{"route_panel_plugins","/panel/plugins/","",[]string{}},
|
|
|
|
Route{"route_panel_plugins_activate","/panel/plugins/activate/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_plugins_deactivate","/panel/plugins/deactivate/","",[]string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 15:01:30 +00:00
|
|
|
Route{"route_panel_users","/panel/users/","",[]string{}},
|
|
|
|
Route{"route_panel_users_edit","/panel/users/edit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_users_edit_submit","/panel/users/edit/submit/","",[]string{"extra_data"}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 15:01:30 +00:00
|
|
|
Route{"route_panel_groups","/panel/groups/","",[]string{}},
|
|
|
|
Route{"route_panel_groups_edit","/panel/groups/edit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_groups_edit_perms","/panel/groups/edit/perms/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_groups_edit_submit","/panel/groups/edit/submit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_groups_edit_perms_submit","/panel/groups/edit/perms/submit/","",[]string{"extra_data"}},
|
|
|
|
Route{"route_panel_groups_create_submit","/panel/groups/create/","",[]string{}},
|
2017-06-05 11:57:27 +00:00
|
|
|
|
2017-04-13 15:01:30 +00:00
|
|
|
Route{"route_panel_logs_mod","/panel/logs/mod/","",[]string{}},
|
2017-04-13 10:55:51 +00:00
|
|
|
)
|
2017-04-12 10:10:36 +00:00
|
|
|
}
|