handlers

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAtomFeed

func GenerateAtomFeed(ctx fiber.Ctx) error

func GetHandleListArtworks

func GetHandleListArtworks(serv *service.Service, cfg runtimecfg.RestConfig) fiber.Handler

func HandleCountArtwork

func HandleCountArtwork(ctx fiber.Ctx) error

func HandleFetchArtwork

func HandleFetchArtwork(ctx fiber.Ctx) error

func HandleGetArtistByID

func HandleGetArtistByID(ctx fiber.Ctx) error

func HandleGetArtworkByID

func HandleGetArtworkByID(ctx fiber.Ctx) error

func HandleGetPictureFileByID

func HandleGetPictureFileByID(ctx fiber.Ctx) error

func HandleGetRandomPicture

func HandleGetRandomPicture(ctx fiber.Ctx) error

func HandleGetRandomTags

func HandleGetRandomTags(ctx fiber.Ctx) error

func HandleGetSizedPictureFileByID

func HandleGetSizedPictureFileByID(ctx fiber.Ctx) error

func HandleRandomArtworks

func HandleRandomArtworks(ctx fiber.Ctx) error

func HandleRandomPreviewArtworks

func HandleRandomPreviewArtworks(ctx fiber.Ctx) error

获得一个 artwork 并返回其第一张图片的 regular 直链, for compatibility

func HandleSendArtworkInfoByTelegramBot

func HandleSendArtworkInfoByTelegramBot(ctx fiber.Ctx) error

func MyIP

func Register

func Register(router fiber.Router, serv *service.Service, cfg runtimecfg.RestConfig)

Types

type RequestCountArtwork

type RequestCountArtwork struct {
	R18 int `query:"r18" form:"r18" json:"r18" validate:"omitempty,gte=0,lte=2" message:"r18 must be 0 (no R18), 1 (only R18) or 2 (both)"`
}

type RequestFetchArtwork

type RequestFetchArtwork struct {
	URL string `query:"url" form:"url" json:"url" validate:"required" message:"url is required and must be a valid url"`
}

type RequestListArtworks

type RequestListArtworks struct {
	R18           int    `query:"r18" form:"r18" json:"r18" validate:"gte=0,lte=2" message:"r18 must be 0 (no R18), 1 (only R18) or 2 (both)"`
	ArtistID      string `` /* 126-byte string literal not displayed */
	Tag           string `query:"tag" form:"tag" json:"tag"`
	Keyword       string `query:"keyword" form:"keyword" json:"keyword" validate:"max=50" message:"keyword max length is 50"`
	Page          int64  `query:"page" form:"page" json:"page"`
	PageSize      int64  `` /* 132-byte string literal not displayed */
	Hybrid        bool   `query:"hybrid" form:"hybrid" json:"hybrid"`
	SimilarTarget string `` /* 146-byte string literal not displayed */

}

func (*RequestListArtworks) ID

func (r *RequestListArtworks) ID() uint64

type RequestRandomArtworks

type RequestRandomArtworks struct {
	R18   int `` /* 135-byte string literal not displayed */
	Limit int `query:"limit,default=1" form:"limit,default=1" json:"limit" validate:"lte=200" message:"limit must be between 1 and 200"`
}

type RequestRandomTags

type RequestRandomTags struct {
	Limit int `json:"limit" query:"limit" form:"limit" validate:"omitempty,min=1,max=200" message:"limit must be between 1 and 200"`
}

type RequestSendArtworkInfoByTelegramBot

type RequestSendArtworkInfoByTelegramBot struct {
	SourceURL     string `json:"source_url" query:"source_url" form:"source_url" validate:"required"`
	ChatID        int64  `json:"chat_id" query:"chat_id" form:"chat_id" validate:"required"`
	AppendCaption string `json:"append_caption" query:"append_caption" form:"append_caption"`
}

type ResponseArtist

type ResponseArtist struct {
	ID       string            `json:"id" bson:"_id"`
	Name     string            `json:"name" bson:"name"`
	Type     shared.SourceType `json:"type" bson:"type"`
	UID      string            `json:"uid" bson:"uid"`
	Username string            `json:"username" bson:"username"`
}

type ResponseArtworkItem

type ResponseArtworkItem struct {
	ID          string            `json:"id"`
	CreatedAt   string            `json:"created_at"`
	Title       string            `json:"title"`
	Description string            `json:"description"`
	SourceURL   string            `json:"source_url"`
	R18         bool              `json:"r18"`
	LikeCount   uint              `json:"like_count"`
	Tags        []string          `json:"tags"`
	Artist      ResponseArtist    `json:"artist"`
	SourceType  shared.SourceType `json:"source_type"`
	Pictures    []ResponsePicture `json:"pictures"`
}

type ResponseFetchArtwork

type ResponseFetchArtwork struct {
	CacheID     string                       `json:"cache_id"`
	Title       string                       `json:"title"`
	Description string                       `json:"description"`
	SourceURL   string                       `json:"source_url"`
	R18         bool                         `json:"r18"`
	Tags        []string                     `json:"tags"`
	Artist      *ResponseFetchedArtist       `json:"artist"`
	SourceType  shared.SourceType            `json:"source_type"`
	Pictures    []*ResponseFetchedPicture    `json:"pictures"`
	Videos      []*ResponseFetchedVideo      `json:"videos,omitempty"`
	UgoiraMetas []*ResponseFetchedUgoiraMeta `json:"ugoira_metas,omitempty"`
}

type ResponseFetchedArtist

type ResponseFetchedArtist struct {
	Name     string `json:"name"`
	Username string `json:"username"`
	UID      string `json:"uid"`
}

type ResponseFetchedPicture

type ResponseFetchedPicture struct {
	Width     uint   `json:"width"`
	Height    uint   `json:"height"`
	Index     uint   `json:"index"`
	Thumbnail string `json:"thumbnail"`
	Original  string `json:"original"`
	FileName  string `json:"file_name"`
}

type ResponseFetchedUgoiraMeta added in v1.7.0

type ResponseFetchedUgoiraMeta struct {
	Data  shared.UgoiraMetaData `json:"data"`
	Index uint                  `json:"index"`
}

type ResponseFetchedVideo added in v1.7.0

type ResponseFetchedVideo struct {
	URL      string `json:"url"`
	Poster   string `json:"poster"`
	MimeType string `json:"mime_type"`
	Index    uint   `json:"index"`
	Width    uint   `json:"width"`
	Height   uint   `json:"height"`
	Duration uint   `json:"duration"`
}

type ResponsePicture

type ResponsePicture struct {
	ID        string `json:"id"`
	Width     uint   `json:"width"`
	Height    uint   `json:"height"`
	Index     uint   `json:"index"`
	Hash      string `json:"hash"`
	ThumbHash string `json:"thumb_hash"`
	FileName  string `json:"file_name"`
	MessageID int    `json:"message_id"` // deprecated
	Thumbnail string `json:"thumbnail"`
	Regular   string `json:"regular"`
}

type ResponseTag

type ResponseTag struct {
	ID    string   `json:"id"`
	Name  string   `json:"name"`
	Alias []string `json:"alias"`
}

Jump to

Keyboard shortcuts

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