Documentation
¶
Index ¶
- Constants
- Variables
- func NormaliseTrustedProxyCIDRs(values []string) ([]string, []string)
- func ParseTrustedProxyPrefix(value string) (netip.Prefix, bool)
- type ClientIPMode
- func (r ClientIPMode) Format(f fmt.State, verb rune)
- func (r ClientIPMode) MarshalText() ([]byte, error)
- func (r *ClientIPMode) Scan(__iNpUt__ any) error
- func (r ClientIPMode) String() string
- func (r *ClientIPMode) UnmarshalText(__iNpUt__ []byte) error
- func (r ClientIPMode) Value() (driver.Value, error)
- type ClientIPServiceSettings
- type MessageOfTheDay
- type ModerationServiceSettings
- type RateLimitServiceSettings
- type RegistrationMode
- func (r RegistrationMode) Format(f fmt.State, verb rune)
- func (r RegistrationMode) MarshalText() ([]byte, error)
- func (r *RegistrationMode) Scan(__iNpUt__ any) error
- func (r RegistrationMode) String() string
- func (r *RegistrationMode) UnmarshalText(__iNpUt__ []byte) error
- func (r RegistrationMode) Value() (driver.Value, error)
- type RobotProviderSettings
- type RobotServiceSettings
- type ServiceSettings
- type Settings
- type SettingsRepository
Constants ¶
View Source
const ( DefaultTitle = "Storyden" DefaultDescription = "A forum for the modern age" DefaultContent = `` /* 312-byte string literal not displayed */ )
View Source
const DefaultColour = "hsl(157, 65%, 44%)"
View Source
const StorydenPrimarySettingsKey = "storyden_system"
StorydenPrimarySettingsKey is the key used to store the primary settings data in the database. The settings table itself can contain other settings and is treated as a key-value store. Storyden itself only cares about the row with this key, other rows may be used by plugins or any other integrated systems.
Variables ¶
View Source
var ( ClientIPModeRemoteAddr = ClientIPMode{clientIPModeRemoteAddr} ClientIPModeSingleHeader = ClientIPMode{clientIPModeSingleHeader} ClientIPModeXFFTrustedProxies = ClientIPMode{clientIPModeXFFTrustedProxies} )
View Source
var ( RegistrationModePublic = RegistrationMode{registrationModePublic} RegistrationModeInvitation = RegistrationMode{registrationModeInvitation} RegistrationModeDisabled = RegistrationMode{registrationModeDisabled} )
View Source
var DefaultSettings = Settings{ Title: opt.New(DefaultTitle), Description: opt.New(DefaultDescription), Content: opt.New(defaultContent), AccentColour: opt.New(DefaultColour), AuthenticationMode: opt.New(authentication.ModeHandle), RegistrationMode: opt.New(RegistrationModePublic), Services: opt.New(ServiceSettings{ Moderation: opt.New(ModerationServiceSettings{ ThreadBodyLengthMax: opt.New(60000), ReplyBodyLengthMax: opt.New(10000), SignatureLengthMax: opt.New(500), }), }), }
Functions ¶
func NormaliseTrustedProxyCIDRs ¶ added in v1.26.7
NormaliseTrustedProxyCIDRs trims and normalises trusted proxy values while returning a separate list of invalid entries for validation errors.
Types ¶
type ClientIPMode ¶ added in v1.26.7
type ClientIPMode struct {
// contains filtered or unexported fields
}
func NewClientIPMode ¶ added in v1.26.7
func NewClientIPMode(__iNpUt__ string) (ClientIPMode, error)
func (ClientIPMode) MarshalText ¶ added in v1.26.7
func (r ClientIPMode) MarshalText() ([]byte, error)
func (*ClientIPMode) Scan ¶ added in v1.26.7
func (r *ClientIPMode) Scan(__iNpUt__ any) error
func (ClientIPMode) String ¶ added in v1.26.7
func (r ClientIPMode) String() string
func (*ClientIPMode) UnmarshalText ¶ added in v1.26.7
func (r *ClientIPMode) UnmarshalText(__iNpUt__ []byte) error
type ClientIPServiceSettings ¶ added in v1.26.7
type MessageOfTheDay ¶
type MessageOfTheDay struct {
Content datagraph.Content
StartAt opt.Optional[time.Time]
EndAt opt.Optional[time.Time]
Metadata opt.Optional[map[string]any]
}
MessageOfTheDay is a date-bound rich text announcement.
type RegistrationMode ¶ added in v1.26.8
type RegistrationMode struct {
// contains filtered or unexported fields
}
func NewRegistrationMode ¶ added in v1.26.8
func NewRegistrationMode(__iNpUt__ string) (RegistrationMode, error)
func (RegistrationMode) Format ¶ added in v1.26.8
func (r RegistrationMode) Format(f fmt.State, verb rune)
func (RegistrationMode) MarshalText ¶ added in v1.26.8
func (r RegistrationMode) MarshalText() ([]byte, error)
func (*RegistrationMode) Scan ¶ added in v1.26.8
func (r *RegistrationMode) Scan(__iNpUt__ any) error
func (RegistrationMode) String ¶ added in v1.26.8
func (r RegistrationMode) String() string
func (*RegistrationMode) UnmarshalText ¶ added in v1.26.8
func (r *RegistrationMode) UnmarshalText(__iNpUt__ []byte) error
type RobotProviderSettings ¶ added in v1.26.13
type RobotServiceSettings ¶ added in v1.26.13
type ServiceSettings ¶
type ServiceSettings struct {
ClientIP opt.Optional[ClientIPServiceSettings]
RateLimit opt.Optional[RateLimitServiceSettings]
Moderation opt.Optional[ModerationServiceSettings]
Robots opt.Optional[RobotServiceSettings]
}
type Settings ¶
type Settings struct {
// Title is the primary name of the instance, it's commonly used for things
// like <title> tags in HTML for SEO as well as PWA and other app metadata.
Title opt.Optional[string]
// Description is similarly used for SEO tags, opengraph and other metadata.
Description opt.Optional[string]
// Content is a rich-text "about" field used for describing the instance.
Content opt.Optional[datagraph.Content]
// AccentColour is used for controlling frontend brand colour usage. Despite
// being frontend-specific, it may be used for backend email/SMS templates.
AccentColour opt.Optional[string]
// Public is intended to be used to configure public access to the API. If
// set to false any request to the API will require a verified user account.
Public opt.Optional[bool]
// The authentication mode is used to control which authentication methods
// are exposed to members during the frontend registration and login flows.
AuthenticationMode opt.Optional[authentication.Mode]
// The registration mode controls whether unauthenticated visitors may create
// accounts publicly, only via invitation, or not at all.
RegistrationMode opt.Optional[RegistrationMode]
Services opt.Optional[ServiceSettings]
// Metadata is an arbitrary object which can be used by frontends/clients to
// store vendor-specific configuration to control the client implementation.
Metadata opt.Optional[map[string]any]
// Motd is an optional announcement banner shown to all site visitors.
Motd opt.Optional[MessageOfTheDay]
}
Settings is the global Storyden settings data that can be changed at runtime.
Click to show internal directories.
Click to hide internal directories.