feat: add avatar_url field to user table (#1106)

refactor: add `avatar_url` field to user table
This commit is contained in:
boojack
2023-02-17 23:55:56 +08:00
committed by GitHub
parent a538b9789b
commit 096a71c58b
13 changed files with 79 additions and 262 deletions

View File

@@ -1,7 +1,6 @@
package server
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
@@ -24,12 +23,7 @@ func registerGetterPublicRoutes(g *echo.Group) {
if err != nil {
return echo.NewHTTPError(http.StatusNotAcceptable, fmt.Sprintf("Failed to get website meta with url: %s", urlStr)).SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(htmlMeta)); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode website HTML meta").SetInternal(err)
}
return nil
return c.JSON(http.StatusOK, composeResponse(htmlMeta))
})
g.GET("/get/image", func(c echo.Context) error {