add redirects for old setting panel urls

This commit is contained in:
f0x 2022-09-20 16:47:30 +02:00
parent bb42d2609a
commit 239b957054

View file

@ -38,6 +38,8 @@ const (
customCSSPath = profilePath + "/custom.css" customCSSPath = profilePath + "/custom.css"
statusPath = profilePath + "/statuses/:" + statusIDKey statusPath = profilePath + "/statuses/:" + statusIDKey
assetsPathPrefix = "/assets" assetsPathPrefix = "/assets"
userPanelPath = "/settings/user"
adminPanelPath = "/settings/admin"
tokenParam = "token" tokenParam = "token"
usernameKey = "username" usernameKey = "username"
@ -71,9 +73,21 @@ func (m *Module) Route(s router.Router) error {
s.AttachHandler(http.MethodGet, "/settings", m.SettingsPanelHandler) s.AttachHandler(http.MethodGet, "/settings", m.SettingsPanelHandler)
s.AttachHandler(http.MethodGet, "/settings/*panel", m.SettingsPanelHandler) s.AttachHandler(http.MethodGet, "/settings/*panel", m.SettingsPanelHandler)
// redirect /auth/edit to /settings/user // User panel redirects
// used by clients
s.AttachHandler(http.MethodGet, "/auth/edit", func(c *gin.Context) { s.AttachHandler(http.MethodGet, "/auth/edit", func(c *gin.Context) {
c.Redirect(http.StatusMovedPermanently, "/settings/user") c.Redirect(http.StatusMovedPermanently, userPanelPath)
})
// old version of settings panel
s.AttachHandler(http.MethodGet, "/user", func(c *gin.Context) {
c.Redirect(http.StatusMovedPermanently, userPanelPath)
})
// Admin panel redirects
// old version of settings panel
s.AttachHandler(http.MethodGet, "/admin", func(c *gin.Context) {
c.Redirect(http.StatusMovedPermanently, adminPanelPath)
}) })
// serve front-page // serve front-page