mirror of
https://github.com/owncast/owncast.git
synced 2024-11-21 12:18:02 +03:00
feat(chat): cache custom emoji. For #3117
This commit is contained in:
parent
9c3006677e
commit
f9d0d66271
1 changed files with 3 additions and 0 deletions
|
@ -8,11 +8,13 @@ import (
|
|||
|
||||
"github.com/owncast/owncast/config"
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/router/middleware"
|
||||
)
|
||||
|
||||
// GetCustomEmojiList returns a list of emoji via the API.
|
||||
func GetCustomEmojiList(w http.ResponseWriter, r *http.Request) {
|
||||
emojiList := data.GetEmojiList()
|
||||
middleware.SetCachingHeaders(w, r)
|
||||
|
||||
if err := json.NewEncoder(w).Encode(emojiList); err != nil {
|
||||
InternalErrorHandler(w, err)
|
||||
|
@ -25,5 +27,6 @@ func GetCustomEmojiImage(w http.ResponseWriter, r *http.Request) {
|
|||
r.URL.Path = path
|
||||
|
||||
emojiFS := os.DirFS(config.CustomEmojiPath)
|
||||
middleware.SetCachingHeaders(w, r)
|
||||
http.FileServer(http.FS(emojiFS)).ServeHTTP(w, r)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue