mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
add api/v1/instance info handler + instance model (#18)
This commit is contained in:
20
internal/api/client/instance/instanceget.go
Normal file
20
internal/api/client/instance/instanceget.go
Normal file
@ -0,0 +1,20 @@
|
||||
package instance
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (m *Module) InstanceInformationGETHandler(c *gin.Context) {
|
||||
l := m.log.WithField("func", "InstanceInformationGETHandler")
|
||||
|
||||
instance, err := m.processor.InstanceGet(m.config.Host)
|
||||
if err != nil {
|
||||
l.Debugf("error getting instance from processor: %s", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, instance)
|
||||
}
|
Reference in New Issue
Block a user