diff --git a/internal/web/panels.go b/internal/web/settings-panel.go similarity index 52% rename from internal/web/panels.go rename to internal/web/settings-panel.go index cb9f32748..5eee3461b 100644 --- a/internal/web/panels.go +++ b/internal/web/settings-panel.go @@ -49,52 +49,3 @@ func (m *Module) SettingsPanelHandler(c *gin.Context) { }, }) } - -func (m *Module) UserPanelHandler(c *gin.Context) { - host := config.GetHost() - instance, err := m.processor.InstanceGet(c.Request.Context(), host) - if err != nil { - api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) - return - } - - c.HTML(http.StatusOK, "frontend.tmpl", gin.H{ - "instance": instance, - "stylesheets": []string{ - assetsPathPrefix + "/Fork-Awesome/css/fork-awesome.min.css", - assetsPathPrefix + "/dist/_colors.css", - assetsPathPrefix + "/dist/base.css", - assetsPathPrefix + "/dist/panels-base.css", - assetsPathPrefix + "/dist/panels-user-style.css", - }, - "javascript": []string{ - assetsPathPrefix + "/dist/bundle.js", - assetsPathPrefix + "/dist/user-panel.js", - }, - }) -} - -// TODO: abstract the {admin, user}panel handlers in some way -func (m *Module) AdminPanelHandler(c *gin.Context) { - host := config.GetHost() - instance, err := m.processor.InstanceGet(c.Request.Context(), host) - if err != nil { - api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) - return - } - - c.HTML(http.StatusOK, "frontend.tmpl", gin.H{ - "instance": instance, - "stylesheets": []string{ - assetsPathPrefix + "/Fork-Awesome/css/fork-awesome.min.css", - assetsPathPrefix + "/dist/_colors.css", - assetsPathPrefix + "/dist/base.css", - assetsPathPrefix + "/dist/panels-base.css", - assetsPathPrefix + "/dist/panels-admin-style.css", - }, - "javascript": []string{ - assetsPathPrefix + "/dist/bundle.js", - assetsPathPrefix + "/dist/admin-panel.js", - }, - }) -} diff --git a/internal/web/web.go b/internal/web/web.go index 727f6c94a..8db5a1454 100644 --- a/internal/web/web.go +++ b/internal/web/web.go @@ -70,23 +70,12 @@ func (m *Module) Route(s router.Router) error { assetsGroup := s.AttachGroup(assetsPathPrefix) m.mountAssetsFilesystem(assetsGroup) - s.AttachHandler(http.MethodGet, adminPanelPath, m.AdminPanelHandler) - // redirect /admin/ to /admin - s.AttachHandler(http.MethodGet, adminPanelPath+"/", func(c *gin.Context) { - c.Redirect(http.StatusMovedPermanently, adminPanelPath) - }) - s.AttachHandler(http.MethodGet, "/settings", m.SettingsPanelHandler) s.AttachHandler(http.MethodGet, "/settings/*panel", m.SettingsPanelHandler) - s.AttachHandler(http.MethodGet, userPanelpath, m.UserPanelHandler) - // redirect /user/ to /user - s.AttachHandler(http.MethodGet, userPanelpath+"/", func(c *gin.Context) { - c.Redirect(http.StatusMovedPermanently, userPanelpath) - }) - // redirect /auth/edit to /user + // redirect /auth/edit to /settings/user s.AttachHandler(http.MethodGet, "/auth/edit", func(c *gin.Context) { - c.Redirect(http.StatusMovedPermanently, userPanelpath) + c.Redirect(http.StatusMovedPermanently, "/settings/user") }) // serve front-page