From 239b95705491195924b928026e86d717c2a3e86c Mon Sep 17 00:00:00 2001 From: f0x Date: Tue, 20 Sep 2022 16:47:30 +0200 Subject: [PATCH] add redirects for old setting panel urls --- internal/web/web.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/web/web.go b/internal/web/web.go index f8c2c4e5f..a816f3f08 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -38,6 +38,8 @@ customCSSPath = profilePath + "/custom.css" statusPath = profilePath + "/statuses/:" + statusIDKey assetsPathPrefix = "/assets" + userPanelPath = "/settings/user" + adminPanelPath = "/settings/admin" tokenParam = "token" 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/*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) { - 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