mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-01 00:22:24 -05:00
add api/v1/instance info handler + instance model
This commit is contained in:
parent
0cbab627c7
commit
5b41a00e81
11 changed files with 222 additions and 22 deletions
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue