services

package
v0.0.0-...-5b2cea3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ControlledToken = 104002
View Source
const DbConnErr = 900001
View Source
const EmailUnavailable = 102001
View Source
const Illegal2FASecret = 202002
View Source
const IllegalParams = 902003
View Source
const InternalError = 900000
View Source
const InvalidInviteCode = 201001
View Source
const InvalidNickname = 102000
View Source
const InvalidPassword = 102010
View Source
const InvalidPatchCommand = 103003
View Source
const NicknameMaxLen = 20
View Source
const NotFound = 902000
View Source
const PermissionDenied = 902001
View Source
const ReadErr = 901001
View Source
const StatusOK = 0
View Source
const TFAAlreadyEnabled = 202004
View Source
const TFAAttemptLimited = 202003
View Source
const TFANotEnabled = 202000
View Source
const Unauthorized = 902002
View Source
const UserNotExist = 102020
View Source
const WriteErr = 901000
View Source
const Wrong2FACode = 202001

Variables

This section is empty.

Functions

func AuthRequired

func AuthRequired(ctx *gin.Context)

func CustomHeaders

func CustomHeaders(ctx *gin.Context)

func Endpoint2FA

func Endpoint2FA(ng *gin.Engine)

func EndpointBasics

func EndpointBasics(g *gin.Engine)

func EndpointFavorite

func EndpointFavorite(ng *gin.Engine)

func EndpointLyric

func EndpointLyric(ng *gin.Engine)

func EndpointMeta

func EndpointMeta(ng *gin.Engine)

func EndpointPlaylist

func EndpointPlaylist(ng *gin.Engine)

func EndpointSearch

func EndpointSearch(ng *gin.Engine)

func EndpointShare

func EndpointShare(ng *gin.Engine)

func EndpointStat

func EndpointStat(ng *gin.Engine)

func EndpointToken

func EndpointToken(ng *gin.Engine)

func EndpointUser

func EndpointUser(ng *gin.Engine)

func Start

func Start(listen string) error

func TFARequired

func TFARequired(ctx *gin.Context)

Types

type AlbumFavForm

type AlbumFavForm struct {
	AlbumID string `json:"album_id"`
}

type AnnilShareClaims

type AnnilShareClaims struct {
	jwt.RegisteredClaims
	Type   string                       `json:"type"`
	Audios map[string]map[string][]uint `json:"audios"`
}

type AnnilTokenShareInfo

type AnnilTokenShareInfo struct {
	KeyID   string   `json:"key_id"`
	Secret  string   `json:"secret"`
	Allowed []string `json:"allowed,omitempty"`
}

type AnnilUserClaims

type AnnilUserClaims struct {
	jwt.RegisteredClaims
	Type   string               `json:"type"`
	UserID string               `json:"user_id"`
	Share  *AnnilTokenShareInfo `json:"share,omitempty"`
}

type ChangePasswordForm

type ChangePasswordForm struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type Cover

type Cover struct {
	AlbumID *string `json:"album_id" mapstructure:"album_id"`
	DiscID  *uint   `json:"disc_id" mapstructure:"disc_id"`
}

type CreateShareForm

type CreateShareForm struct {
	Info     meta.ExportedPlaylistInfo                       `json:"info"`
	Metadata map[meta.AlbumIdentifier]meta.ExportedAlbumInfo `json:"metadata"`
	Albums   map[meta.AlbumIdentifier]string                 `json:"albums"`
}

type DeleteForm

type DeleteForm struct {
	ID string `json:"id"`
}

type Enable2FAForm

type Enable2FAForm struct {
	Secret string `json:"2fa_secret"`
	Code   string `json:"2fa_code"`
}

type FavoriteMusicEntry

type FavoriteMusicEntry struct {
	AlbumID string `json:"album_id"`
	DiscID  int    `json:"disc_id"`
	TrackID int    `json:"track_id"`
}

type FavoritePlaylistEntry

type FavoritePlaylistEntry struct {
	PlaylistID string `json:"playlist_id"`
	Name       string `json:"name"`
	Owner      string `json:"owner"`
}

type FavoritePlaylistForm

type FavoritePlaylistForm struct {
	PlaylistID string `json:"playlist_id"`
}

type HistoryRecord

type HistoryRecord struct {
	Track meta.TrackIdentifier `json:"track"`
	At    int64                `json:"at"`
}

type LoginForm

type LoginForm struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Code     string `json:"2fa_code"`
}

type LyricLanguage

type LyricLanguage struct {
	Language    string    `json:"language"`
	Type        string    `json:"type"`
	Data        string    `json:"data"`
	Contributor UserIntro `json:"contributor"`
	Source      string    `json:"source"`
}

type LyricPatchForm

type LyricPatchForm struct {
	AlbumID string `json:"album_id"`
	DiscID  int    `json:"disc_id"`
	TrackID int    `json:"track_id"`
	Type    string `json:"type"`
	Lang    string `json:"lang"`
	Data    string `json:"data"`
}

type LyricResponse

type LyricResponse struct {
	Source       LyricLanguage   `json:"source"`
	Translations []LyricLanguage `json:"translations"`
}

type PatchedPlaylistInfo

type PatchedPlaylistInfo struct {
	Name        *string `json:"name" mapstructure:"name"`
	Description *string `json:"description" mapstructure:"description"`
	IsPublic    *bool   `json:"is_public" mapstructure:"is_public"`
	Cover       *Cover  `json:"cover" mapstructure:"cover"`
}

type PlayRecordRes

type PlayRecordRes struct {
	Track meta.TrackIdentifier `json:"track"`
	Total int64                `json:"count"`
}

type PlaylistDetails

type PlaylistDetails struct {
	PlaylistInfo
	Items []PlaylistItemWithId `json:"items"`
}

type PlaylistForm

type PlaylistForm struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	IsPublic    bool           `json:"is_public"`
	Cover       Cover          `json:"cover"`
	Items       []PlaylistItem `json:"items"`
}

type PlaylistInfo

type PlaylistInfo struct {
	Name         string               `json:"name"`
	Description  string               `json:"description"`
	IsPublic     bool                 `json:"is_public"`
	Cover        *meta.DiscIdentifier `json:"cover"`
	ID           string               `json:"id"`
	Owner        string               `json:"owner"`
	LastModified int64                `json:"last_modified"`
}

type PlaylistItem

type PlaylistItem struct {
	Type        string      `json:"type"`
	Description string      `json:"description"`
	Info        interface{} `json:"info"`
}

type PlaylistItemWithId

type PlaylistItemWithId struct {
	PlaylistItem
	ID string `json:"id"`
}

type PlaylistPatchForm

type PlaylistPatchForm struct {
	ID      string      `json:"id"`
	Command string      `json:"command"`
	Payload interface{} `json:"payload"`
}

type PlaylistResult

type PlaylistResult struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Owner       string `json:"owner"`
}

type RegisterForm

type RegisterForm struct {
	Password   string `json:"password"`
	Email      string `json:"email"`
	Nickname   string `json:"nickname"`
	Avatar     string `json:"avatar"`
	Secret     string `json:"2fa_secret"`
	Code       string `json:"2fa_code"`
	InviteCode string `json:"invite_code"`
}

type Response

type Response struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type SearchResult

type SearchResult struct {
	Albums    []meta.AlbumDetails       `json:"albums,omitempty"`
	Tracks    []meta.TrackInfoWithAlbum `json:"tracks,omitempty"`
	Playlists []PlaylistInfo            `json:"playlists,omitempty"`
}

type ShareEntry

type ShareEntry struct {
	ID   string `json:"id"`
	Date int64  `json:"date"`
}

type SiteInfo

type SiteInfo struct {
	SiteName        string   `json:"site_name"`
	Description     string   `json:"description"`
	ProtocolVersion string   `json:"protocol_version"`
	Features        []string `json:"features"`
}

type SongPlayRecord

type SongPlayRecord struct {
	Track meta.TrackIdentifier `json:"track"`
	At    []int64              `json:"at"`
}

type Token

type Token struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Token    string `json:"token"`
	Priority int    `json:"priority"`
}

type TokenGrant

type TokenGrant struct {
	Claims AnnilShareClaims `json:"claims"`
	Secret string           `json:"secret"`
	Server string           `json:"server"`
	Kid    string           `json:"kid"`
}

func (*TokenGrant) Grant

func (grant *TokenGrant) Grant() (*meta.ExportedToken, error)

type TokenPatch

type TokenPatch struct {
	ID       string  `json:"id"`
	Name     *string `json:"name"`
	URL      *string `json:"url"`
	Token    *string `json:"token"`
	Priority *int    `json:"priority"`
}

type TokenResponse

type TokenResponse struct {
	ID         string `json:"id"`
	Controlled bool   `json:"controlled"`
	Token
}

type UserInfo

type UserInfo struct {
	UserID    string `json:"user_id"`
	Email     string `json:"email"`
	Nickname  string `json:"nickname"`
	Avatar    string `json:"avatar"`
	Enable2FA bool   `json:"2fa_enabled"`
}

type UserIntro

type UserIntro struct {
	UserID   string `json:"user_id"`
	Nickname string `json:"nickname"`
	Avatar   string `json:"avatar"`
}

type UserIntroForm

type UserIntroForm struct {
	Nickname string `json:"nickname"`
	Avatar   string `json:"avatar"`
}

Jump to

Keyboard shortcuts

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