Commit 6ffc09d8 authored by Steven's avatar Steven

chore: remove unused httpmeta getter api

parent 125c9c92
...@@ -1891,40 +1891,6 @@ const docTemplate = `{ ...@@ -1891,40 +1891,6 @@ const docTemplate = `{
} }
} }
}, },
"/o/get/GetWebsiteMetadata": {
"get": {
"produces": [
"application/json"
],
"tags": [
"get"
],
"summary": "Get website metadata",
"parameters": [
{
"type": "string",
"description": "Website URL",
"name": "url",
"in": "query",
"required": true
}
],
"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"
}
}
}
},
"/o/r/{resourceId}": { "/o/r/{resourceId}": {
"get": { "get": {
"description": "*Swagger UI may have problems displaying other file types than images", "description": "*Swagger UI may have problems displaying other file types than images",
...@@ -2002,20 +1968,6 @@ const docTemplate = `{ ...@@ -2002,20 +1968,6 @@ const docTemplate = `{
} }
}, },
"definitions": { "definitions": {
"getter.HTMLMeta": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"image": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"github_com_usememos_memos_store.UserSetting": { "github_com_usememos_memos_store.UserSetting": {
"type": "object", "type": "object",
"properties": { "properties": {
...@@ -2033,6 +1985,14 @@ const docTemplate = `{ ...@@ -2033,6 +1985,14 @@ const docTemplate = `{
"profile.Profile": { "profile.Profile": {
"type": "object", "type": "object",
"properties": { "properties": {
"driver": {
"description": "Driver is the database driver\nsqlite, mysql",
"type": "string"
},
"dsn": {
"description": "DSN points to where Memos stores its own data",
"type": "string"
},
"mode": { "mode": {
"description": "Mode can be \"prod\" or \"dev\" or \"demo\"", "description": "Mode can be \"prod\" or \"dev\" or \"demo\"",
"type": "string" "type": "string"
...@@ -2139,8 +2099,11 @@ const docTemplate = `{ ...@@ -2139,8 +2099,11 @@ const docTemplate = `{
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"parentID": {
"description": "Composed fields\nFor those comment memos, the parent ID is the memo ID of the memo being commented.\nIf the parent ID is nil, then this memo is not a comment.",
"type": "integer"
},
"pinned": { "pinned": {
"description": "Composed fields",
"type": "boolean" "type": "boolean"
}, },
"relationList": { "relationList": {
...@@ -2189,11 +2152,11 @@ const docTemplate = `{ ...@@ -2189,11 +2152,11 @@ const docTemplate = `{
"type": "string", "type": "string",
"enum": [ "enum": [
"REFERENCE", "REFERENCE",
"ADDITIONAL" "COMMENT"
], ],
"x-enum-varnames": [ "x-enum-varnames": [
"MemoRelationReference", "MemoRelationReference",
"MemoRelationAdditional" "MemoRelationComment"
] ]
}, },
"store.Resource": { "store.Resource": {
...@@ -2406,9 +2369,6 @@ const docTemplate = `{ ...@@ -2406,9 +2369,6 @@ const docTemplate = `{
"filename": { "filename": {
"type": "string" "type": "string"
}, },
"internalPath": {
"type": "string"
},
"type": { "type": {
"type": "string" "type": "string"
} }
......
...@@ -11,39 +11,10 @@ import ( ...@@ -11,39 +11,10 @@ import (
) )
func (*APIV1Service) registerGetterPublicRoutes(g *echo.Group) { 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. // GET /get/image?url={url} - Get image.
g.GET("/get/image", GetImage) 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 // GetImage godoc
// //
// @Summary Get GetImage from URL // @Summary Get GetImage from URL
......
basePath: / basePath: /
definitions: definitions:
getter.HTMLMeta:
properties:
description:
type: string
image:
type: string
title:
type: string
type: object
github_com_usememos_memos_store.UserSetting: github_com_usememos_memos_store.UserSetting:
properties: properties:
key: key:
...@@ -20,6 +11,14 @@ definitions: ...@@ -20,6 +11,14 @@ definitions:
type: object type: object
profile.Profile: profile.Profile:
properties: 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: mode:
description: Mode can be "prod" or "dev" or "demo" description: Mode can be "prod" or "dev" or "demo"
type: string type: string
...@@ -90,8 +89,13 @@ definitions: ...@@ -90,8 +89,13 @@ definitions:
type: integer type: integer
id: id:
type: integer 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: pinned:
description: Composed fields
type: boolean type: boolean
relationList: relationList:
items: items:
...@@ -122,11 +126,11 @@ definitions: ...@@ -122,11 +126,11 @@ definitions:
store.MemoRelationType: store.MemoRelationType:
enum: enum:
- REFERENCE - REFERENCE
- ADDITIONAL - COMMENT
type: string type: string
x-enum-varnames: x-enum-varnames:
- MemoRelationReference - MemoRelationReference
- MemoRelationAdditional - MemoRelationComment
store.Resource: store.Resource:
properties: properties:
blob: blob:
...@@ -267,8 +271,6 @@ definitions: ...@@ -267,8 +271,6 @@ definitions:
type: string type: string
filename: filename:
type: string type: string
internalPath:
type: string
type: type:
type: string type: string
type: object type: object
...@@ -1976,28 +1978,6 @@ paths: ...@@ -1976,28 +1978,6 @@ paths:
summary: Get GetImage from URL summary: Get GetImage from URL
tags: tags:
- get - 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}: /o/r/{resourceId}:
get: get:
description: '*Swagger UI may have problems displaying other file types than description: '*Swagger UI may have problems displaying other file types than
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment