Documentation ¶
Index ¶
- Variables
- func BanAPIForUserCenter(ctx *gin.Context)
- func ExtractAndSetAcceptLanguage(ctx *gin.Context)
- func ExtractToken(ctx *gin.Context) (token string)
- func GetIsAdminFromContext(ctx *gin.Context) (isAdmin bool)
- func GetLoginUserIDFromContext(ctx *gin.Context) (userID string)
- func GetLoginUserIDInt64FromContext(ctx *gin.Context) (userID int64)
- func GetUserInfoFromContext(ctx *gin.Context) (u *entity.UserCacheInfo)
- func GetUserIsAdminModerator(ctx *gin.Context) (isAdminModerator bool)
- func HeadersByRequestURI() gin.HandlerFunc
- func ShowIndexPage(ctx *gin.Context)
- type AuthUserMiddleware
- func (am *AuthUserMiddleware) AdminAuth() gin.HandlerFunc
- func (am *AuthUserMiddleware) Auth() gin.HandlerFunc
- func (am *AuthUserMiddleware) CheckPrivateMode() gin.HandlerFunc
- func (am *AuthUserMiddleware) EjectUserBySiteInfo() gin.HandlerFunc
- func (am *AuthUserMiddleware) MustAuth() gin.HandlerFunc
- type AvatarMiddleware
- type ShortIDMiddleware
Constants ¶
This section is empty.
Variables ¶
var ProviderSetMiddleware = wire.NewSet( NewAuthUserMiddleware, NewAvatarMiddleware, NewShortIDMiddleware, )
ProviderSetMiddleware is providers.
Functions ¶
func BanAPIForUserCenter ¶ added in v1.1.0
BanAPIForUserCenter ban api for user center
func ExtractAndSetAcceptLanguage ¶ added in v1.0.0
ExtractAndSetAcceptLanguage extract accept language from header and set to context
func ExtractToken ¶
ExtractToken extract token from context
func GetIsAdminFromContext ¶ added in v0.4.2
GetIsAdminFromContext get user is admin from context
func GetLoginUserIDFromContext ¶
GetLoginUserIDFromContext get user id from context
func GetUserInfoFromContext ¶
func GetUserInfoFromContext(ctx *gin.Context) (u *entity.UserCacheInfo)
GetUserInfoFromContext get user info from context
func GetUserIsAdminModerator ¶ added in v1.1.1
func HeadersByRequestURI ¶ added in v1.1.0
func HeadersByRequestURI() gin.HandlerFunc
func ShowIndexPage ¶ added in v1.1.1
Types ¶
type AuthUserMiddleware ¶
type AuthUserMiddleware struct {
// contains filtered or unexported fields
}
AuthUserMiddleware auth user middleware
func NewAuthUserMiddleware ¶
func NewAuthUserMiddleware( authService *auth.AuthService, siteInfoCommonService siteinfo_common.SiteInfoCommonService) *AuthUserMiddleware
NewAuthUserMiddleware new auth user middleware
func (*AuthUserMiddleware) AdminAuth ¶ added in v1.0.1
func (am *AuthUserMiddleware) AdminAuth() gin.HandlerFunc
func (*AuthUserMiddleware) Auth ¶
func (am *AuthUserMiddleware) Auth() gin.HandlerFunc
Auth get token and auth user, set user info to context if user is already login
func (*AuthUserMiddleware) CheckPrivateMode ¶ added in v1.1.1
func (am *AuthUserMiddleware) CheckPrivateMode() gin.HandlerFunc
func (*AuthUserMiddleware) EjectUserBySiteInfo ¶ added in v1.0.0
func (am *AuthUserMiddleware) EjectUserBySiteInfo() gin.HandlerFunc
EjectUserBySiteInfo if admin config the site can access by nologin user, eject user.
func (*AuthUserMiddleware) MustAuth ¶
func (am *AuthUserMiddleware) MustAuth() gin.HandlerFunc
MustAuth auth user info. If the user does not log in, an unauthenticated error is displayed
type AvatarMiddleware ¶
type AvatarMiddleware struct {
// contains filtered or unexported fields
}
func NewAvatarMiddleware ¶
func NewAvatarMiddleware(serviceConfig *service_config.ServiceConfig, uploaderService uploader.UploaderService, ) *AvatarMiddleware
NewAvatarMiddleware new auth user middleware
func (*AvatarMiddleware) AvatarThumb ¶
func (am *AvatarMiddleware) AvatarThumb() gin.HandlerFunc
type ShortIDMiddleware ¶ added in v1.1.1
type ShortIDMiddleware struct {
// contains filtered or unexported fields
}
func NewShortIDMiddleware ¶ added in v1.1.1
func NewShortIDMiddleware(siteInfoService siteinfo_common.SiteInfoCommonService) *ShortIDMiddleware
func (*ShortIDMiddleware) SetShortIDFlag ¶ added in v1.1.1
func (sm *ShortIDMiddleware) SetShortIDFlag() gin.HandlerFunc