Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Webcam restrictions. NoVideoRule = Rule("novideo") // Can not use video features at all NoBroadcastRule = Rule("nobroadcast") // They can not share their webcam NoImageRule = Rule("noimage") // Can not upload or see images RedCamRule = Rule("redcam") // Their camera is force marked NSFW NoDarkVideoRule = Rule("nodvd") // Exempt user from the dark video detector )
Available Rules your site can include in the JWT token: to enforce moderator rules on the user logging into chat.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
// Custom claims.
IsAdmin bool `json:"op,omitempty"`
VIP bool `json:"vip,omitempty"`
Avatar string `json:"img,omitempty"`
ProfileURL string `json:"url,omitempty"`
Nick string `json:"nick,omitempty"`
Emoji string `json:"emoji,omitempty"`
Gender string `json:"gender,omitempty"`
Rules Rules `json:"rules,omitempty"`
Flair Flair `json:"flair,omitempty"`
// Standard claims. Notes:
// subject = username
jwt.RegisteredClaims
}
Custom JWT Claims.
func ParseAndValidate ¶
ParseAndValidate returns the Claims, a boolean authOK, and any errors.
type Flair ¶
type Flair struct {
// Plain text of the flair, e.g. "Newbie"
Name string `json:"name,omitempty"`
// Bulma CSS color class for the flair icon and tag color in Profile Cards.
// One of: info, success, warning, danger, private
// Gets composed into class names e.g.: has-text-info, is-info
Color string `json:"color,omitempty"`
// FontAwesome CSS classes for the icon.
// e.g.: "fa fa-star"
// Default: "fa fa-star"
Icon string `json:"icon,omitempty"`
// NoVIP boolean: if set on a user with VIP status, their VIP flair is hidden from display.
// Other custom Flair properties may still show. If the Flair has only NoVIP set but everything
// else empty, then no VIP and no custom flair will show.
NoVIP bool `json:"noVIP,omitempty"`
}
Flair adds an optional custom icon and decoration to users on chat (e.g. like VIP but no special features).
type Rule ¶
type Rule string
Rule options for the JWT custom key.
Safely check its settings with the Is() functions which handle superset rules which imply other rules, for example novideo > nobroadcast.
func (Rule) IsNoBroadcastRule ¶
func (Rule) IsNoDarkVideoRule ¶
func (Rule) IsNoImageRule ¶
func (Rule) IsNoVideoRule ¶
func (Rule) IsRedCamRule ¶
Click to show internal directories.
Click to hide internal directories.