mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: remove unused httpmeta getter api
This commit is contained in:
@@ -11,39 +11,10 @@ import (
|
||||
)
|
||||
|
||||
func (*APIV1Service) registerGetterPublicRoutes(g *echo.Group) {
|
||||
// GET /get/httpmeta?url={url} - Get website meta.
|
||||
g.GET("/get/httpmeta", GetWebsiteMetadata)
|
||||
|
||||
// GET /get/image?url={url} - Get image.
|
||||
g.GET("/get/image", GetImage)
|
||||
}
|
||||
|
||||
// GetWebsiteMetadata godoc
|
||||
//
|
||||
// @Summary Get website metadata
|
||||
// @Tags get
|
||||
// @Produce json
|
||||
// @Param url query string true "Website URL"
|
||||
// @Success 200 {object} getter.HTMLMeta "Extracted metadata"
|
||||
// @Failure 400 {object} nil "Missing website url | Wrong url"
|
||||
// @Failure 406 {object} nil "Failed to get website meta with url: %s"
|
||||
// @Router /o/get/GetWebsiteMetadata [GET]
|
||||
func GetWebsiteMetadata(c echo.Context) error {
|
||||
urlStr := c.QueryParam("url")
|
||||
if urlStr == "" {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Missing website url")
|
||||
}
|
||||
if _, err := url.Parse(urlStr); err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Wrong url").SetInternal(err)
|
||||
}
|
||||
|
||||
htmlMeta, err := getter.GetHTMLMeta(urlStr)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusNotAcceptable, fmt.Sprintf("Failed to get website meta with url: %s", urlStr)).SetInternal(err)
|
||||
}
|
||||
return c.JSON(http.StatusOK, htmlMeta)
|
||||
}
|
||||
|
||||
// GetImage godoc
|
||||
//
|
||||
// @Summary Get GetImage from URL
|
||||
|
Reference in New Issue
Block a user