Skip to content

Commit

Permalink
chore: remove unused httpmeta getter api
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Oct 6, 2023
1 parent 125c9c9 commit 6ffc09d
Show file tree
Hide file tree
Showing 4 changed files with 827 additions and 877 deletions.
68 changes: 14 additions & 54 deletions api/v1/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions api/v1/http_getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 16 additions & 36 deletions api/v1/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
basePath: /
definitions:
getter.HTMLMeta:
properties:
description:
type: string
image:
type: string
title:
type: string
type: object
github_com_usememos_memos_store.UserSetting:
properties:
key:
Expand All @@ -20,6 +11,14 @@ definitions:
type: object
profile.Profile:
properties:
driver:
description: |-
Driver is the database driver
sqlite, mysql
type: string
dsn:
description: DSN points to where Memos stores its own data
type: string
mode:
description: Mode can be "prod" or "dev" or "demo"
type: string
Expand Down Expand Up @@ -90,8 +89,13 @@ definitions:
type: integer
id:
type: integer
parentID:
description: |-
Composed fields
For those comment memos, the parent ID is the memo ID of the memo being commented.
If the parent ID is nil, then this memo is not a comment.
type: integer
pinned:
description: Composed fields
type: boolean
relationList:
items:
Expand Down Expand Up @@ -122,11 +126,11 @@ definitions:
store.MemoRelationType:
enum:
- REFERENCE
- ADDITIONAL
- COMMENT
type: string
x-enum-varnames:
- MemoRelationReference
- MemoRelationAdditional
- MemoRelationComment
store.Resource:
properties:
blob:
Expand Down Expand Up @@ -267,8 +271,6 @@ definitions:
type: string
filename:
type: string
internalPath:
type: string
type:
type: string
type: object
Expand Down Expand Up @@ -1976,28 +1978,6 @@ paths:
summary: Get GetImage from URL
tags:
- get
/o/get/GetWebsiteMetadata:
get:
parameters:
- description: Website URL
in: query
name: url
required: true
type: string
produces:
- application/json
responses:
"200":
description: Extracted metadata
schema:
$ref: '#/definitions/getter.HTMLMeta'
"400":
description: Missing website url | Wrong url
"406":
description: 'Failed to get website meta with url: %s'
summary: Get website metadata
tags:
- get
/o/r/{resourceId}:
get:
description: '*Swagger UI may have problems displaying other file types than
Expand Down
Loading

0 comments on commit 6ffc09d

Please sign in to comment.