mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 04:12:26 -06:00
[feature] Implement /api/v2/instance
endpoint (#1409)
* interim: start adding /api/v2/instance * finish up
This commit is contained in:
parent
4ee4cd2da1
commit
382512a5a6
109 changed files with 1660 additions and 944 deletions
|
@ -24,7 +24,6 @@ import (
|
|||
|
||||
"github.com/gin-gonic/gin"
|
||||
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
)
|
||||
|
||||
|
@ -34,20 +33,19 @@ func (m *Module) confirmEmailGETHandler(c *gin.Context) {
|
|||
// if there's no token in the query, just serve the 404 web handler
|
||||
token := c.Query(tokenParam)
|
||||
if token == "" {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(errors.New(http.StatusText(http.StatusNotFound))), m.processor.InstanceGet)
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorNotFound(errors.New(http.StatusText(http.StatusNotFound))), m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
user, errWithCode := m.processor.UserConfirmEmail(ctx, token)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet)
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
host := config.GetHost()
|
||||
instance, err := m.processor.InstanceGet(ctx, host)
|
||||
instance, err := m.processor.InstanceGetV1(ctx)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet)
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue