controller

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2025 License: Zlib Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPageLimit int = 8
)

DefaultPageLimit is default limit number per page, and other constant.

Variables

View Source
var WebdavMethods = []string{
	"OPTIONS", "GET", "HEAD", "POST", "DELETE", "PUT",
	"MKCOL", "COPY", "MOVE", "LOCK", "UNLOCK", "PROPFIND", "PROPPATCH",
}

WebdavMethods is a list of supported WebDAV methods.

Functions

func ArticlesPage

func ArticlesPage(c *gin.Context)

ArticlesPage returns JSON information by page number. Request sample:

GET => /page/1?limit=6

func Atom added in v0.0.1

func Atom(c *gin.Context)

func BeginLogin added in v0.0.1

func BeginLogin(c *gin.Context)

BeginLogin returns login webauthn creation and session.

func BeginRegister added in v0.0.1

func BeginRegister(c *gin.Context)

BeginRegister returns register webauthn creation.

func BitcoinAliases added in v0.0.2

func BitcoinAliases(c *gin.Context)

BitcoinAliases returns the Bitcoin BIP15 alias for specified user. Note: The status of standard BIP15 aliases is deferred.

Any => /bitcoin-alias/?handle=fengyj

func DeleteArticle

func DeleteArticle(c *gin.Context)

DeleteArticle deletes an article.

func DeleteOption

func DeleteOption(c *gin.Context)

DeleteOption deletes option by 'name' param. Request sample:

DELETE => /option/:name

func Feed added in v0.0.1

func Feed(c *gin.Context)

func FinishLogin added in v0.0.1

func FinishLogin(c *gin.Context)

FinishLogin validates login webauthn credential.

func FinishRegister added in v0.0.1

func FinishRegister(c *gin.Context)

FinishRegister validates register webauthn credential.

func GetArticle

func GetArticle(c *gin.Context)

GetArticle gets an article by 'slug' param. Request sample:

GET => /article/article-custom-slug-path

func GetOption

func GetOption(c *gin.Context)

GetOption returns an option by 'name' param. Request sample:

GET => /option/:name

func GwtWhoisInfo added in v0.0.1

func GwtWhoisInfo(c *gin.Context)

GwtWhoisInfo gets domain whois information. Request sample:

GET => /whois?domain=xn--02f.com

func HomePage

func HomePage(c *gin.Context)

HomePage returns home and index page. Request sample:

GET => /
GET => /page/1

func InsertArticle

func InsertArticle(c *gin.Context)

InsertArticle inserts an article. Request sample:

POST => /article?title=foo&status=1&content=bar

func InsertOption

func InsertOption(c *gin.Context)

InsertOption inserts an option. Request sample:

POST => /option

func ListArticles

func ListArticles(c *gin.Context)

ListArticles returns the number of all articles. Request sample:

GET => /articles

func ListOptions

func ListOptions(c *gin.Context)

ListOptions returns all options. Request sample:

GET => /options

func LoginPage added in v0.0.1

func LoginPage(c *gin.Context)

LoginPage returns login html page.

func Mdcat added in v0.0.1

func Mdcat(c *gin.Context)

Mdcat renders the markdown page to HTML.

func MetaWeblog added in v0.0.1

func MetaWeblog(c *gin.Context)

MetaWeblog is the controller of MetaWeblog API. The MetaWeblog API (MWA) is a programming interface that allows external programs to get and set the text and attributes of weblog posts.

More info to http://xmlrpc.com/storyreader/story2198.md and https://codex.wordpress.org/XML-RPC_MetaWeblog_API

func PrometheusMetrics added in v0.1.1

func PrometheusMetrics(c *gin.Context)

PrometheusMetrics serves Prometheus metrics.

func RSS added in v0.0.1

func RSS(c *gin.Context)

func Redirect added in v0.0.1

func Redirect(routePath string) func(*gin.Context)

Redirect returns a HTTP redirect to the specific route path.

func RegisterPage added in v0.0.1

func RegisterPage(c *gin.Context)

RegisterPage returns register html page.

func UpdateArticle

func UpdateArticle(c *gin.Context)

UpdateArticle updates an article.

func UpdateOption

func UpdateOption(c *gin.Context)

UpdateOption updates an option. Request sample:

PUT => /option/:name

func UploadFileForUPic added in v0.0.1

func UploadFileForUPic(c *gin.Context)

UploadFileForUPic uploads files to the specified file path. Request sample:

POST => /upload/upic?file=...

func WebAuthnWellKnown added in v0.0.2

func WebAuthnWellKnown(c *gin.Context)

WebAuthnWellKnown returns well-known json for webauthn. The `origins` field is relate with the WebAuthn config.

func WebDAV added in v0.0.1

func WebDAV(c *gin.Context)

Types

type FinishLoginRequest added in v0.0.1

type FinishLoginRequest struct {
	Username   string          `json:"username"`
	Credential json.RawMessage `json:"credential"`
	Session    json.RawMessage `json:"session"`
}

FinishRegisterRequest is request body for finish register.

type FinishRegisterRequest added in v0.0.1

type FinishRegisterRequest struct {
	Username   string          `json:"username"`
	Credential json.RawMessage `json:"credential"`
}

FinishRegisterRequest is request body for finish register.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL