mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 12:52:27 -05:00
[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
This commit is contained in:
parent
c4c713988a
commit
f3fc040c2e
10 changed files with 56 additions and 13 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ func (m *Module) profileGETHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// usernames on our instance will always be lowercase
|
||||
username := strings.ToLower(c.Param(usernameKey))
|
||||
if username == "" {
|
||||
err := errors.New("no account username specified")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue