summaryrefslogtreecommitdiff
path: root/internal/web/base.go
diff options
context:
space:
mode:
authorLibravatar Mia Heidenstedt <i5heu@i5h.eu>2022-11-03 13:15:31 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-03 13:15:31 +0100
commitf3fc040c2effd85afa91d94bd409fa016980056e (patch)
tree7e9c1f407183728c44fa18fa282215d640aa9d2e /internal/web/base.go
parent[frontend] change bundler to skulk (#942) (diff)
downloadgotosocial-f3fc040c2effd85afa91d94bd409fa016980056e.tar.xz
[feature] Allow user to show instead of landing page on / (#922)
* configurable user instead of landing page * rename DefaultUser to LandingPageUser * code review changes and fix tests * try to fix pipeline error * code review changes * code review changes * code review changes * remove unnecessary line
Diffstat (limited to 'internal/web/base.go')
-rw-r--r--internal/web/base.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/web/base.go b/internal/web/base.go
index 61b4634ed..0dae30772 100644
--- a/internal/web/base.go
+++ b/internal/web/base.go
@@ -20,6 +20,7 @@ package web
import (
"net/http"
+ "strings"
"github.com/gin-gonic/gin"
"github.com/superseriousbusiness/gotosocial/internal/api"
@@ -28,6 +29,13 @@ import (
)
func (m *Module) baseHandler(c *gin.Context) {
+
+ // if a landingPageUser is set in the config, redirect to that user's profile
+ if landingPageUser := config.GetLandingPageUser(); landingPageUser != "" {
+ c.Redirect(http.StatusFound, "/@"+c.Param(strings.ToLower(landingPageUser)))
+ return
+ }
+
host := config.GetHost()
instance, err := m.processor.InstanceGet(c.Request.Context(), host)
if err != nil {