2021-05-31 17:36:35 +02:00
|
|
|
package emoji
|
|
|
|
|
2021-06-13 18:42:28 +02:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
2021-12-11 17:50:00 +01:00
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/api"
|
2021-06-13 18:42:28 +02:00
|
|
|
)
|
2021-05-31 17:36:35 +02:00
|
|
|
|
|
|
|
// EmojisGETHandler returns a list of custom emojis enabled on the instance
|
|
|
|
func (m *Module) EmojisGETHandler(c *gin.Context) {
|
2021-12-11 17:50:00 +01:00
|
|
|
if _, err := api.NegotiateAccept(c, api.JSONAcceptHeaders...); err != nil {
|
|
|
|
c.JSON(http.StatusNotAcceptable, gin.H{"error": err.Error()})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-05-20 10:34:36 +02:00
|
|
|
emojis, errWithCode := m.processor.CustomEmojisGet(c)
|
|
|
|
if errWithCode != nil {
|
|
|
|
c.JSON(errWithCode.Code(), gin.H{"error": errWithCode.Safe()})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, emojis)
|
2021-05-31 17:36:35 +02:00
|
|
|
}
|