Documentation ¶
Index ¶
- type AuthConfig
- type BasicAuthConfig
- type CommentConfig
- type CommentTemplatesConfig
- type Config
- type CurrentVpsConfig
- type DataConfig
- type DatabaseConfig
- type FileDataConfig
- type GithubAuthConfig
- type GoogleAuthConfig
- type HostdareVpsConfig
- type MaintenanceConfig
- type MenuItem
- type Menus
- type NotificationChanifyConfig
- type NotificationConfig
- type NotificationMailerConfig
- type OthersConfig
- type Saver
- type Segment
- type Segments
- type ServerConfig
- type Settable
- type SiteConfig
- type ThemeConfig
- type ThemeStylesheetsConfig
- type Updater
- type VpsConfig
- type WhoisApiLayerConfig
- type WhoisConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct { Key string `yaml:"key"` NotifyKey string `yaml:"notify_key"` Basic BasicAuthConfig `yaml:"basic"` Github GithubAuthConfig `yaml:"github"` Google GoogleAuthConfig `yaml:"google"` AdminName string AdminEmails []string }
AuthConfig ...
type BasicAuthConfig ¶
BasicAuthConfig ...
func DefaultBasicBasicAuthConfig ¶
func DefaultBasicBasicAuthConfig() BasicAuthConfig
DefaultBasicBasicAuthConfig ...
type CommentConfig ¶
type CommentConfig struct { Author string `yaml:"author"` Emails []string `yaml:"emails"` Notify bool `yaml:"notify"` NotAllowedEmails []string `yaml:"not_allowed_emails"` NotAllowedAuthors []string `yaml:"not_allowed_authors"` Templates CommentTemplatesConfig `yaml:"templates"` }
CommentConfig ...
type CommentTemplatesConfig ¶
CommentTemplatesConfig ...
func DefaultCommentTemplatesConfig ¶
func DefaultCommentTemplatesConfig() CommentTemplatesConfig
DefaultCommentTemplatesConfig ...
type Config ¶
type Config struct { Database DatabaseConfig `yaml:"database"` Server ServerConfig `yaml:"server"` Data DataConfig `yaml:"data"` Maintenance MaintenanceConfig `yaml:"maintenance"` Auth AuthConfig `yaml:"auth"` Menus Menus `json:"menus" yaml:"menus"` Site SiteConfig `yaml:"site"` Comment CommentConfig `yaml:"comment"` Search search_config.Config `yaml:"search"` Others OthersConfig `json:"others" yaml:"others"` // 尽管站点字体应该由各主题提供,但是为了能跨主题共享字体(减少配置麻烦), // 所以我就在这里定义了针对所有站点适用的自定义样式表(或主题)集合。 Theme ThemeConfig `json:"theme" yaml:"theme"` VPS VpsConfig `json:"vps" yaml:"vps"` Notify NotificationConfig `json:"notify" yaml:"notify"` }
Config ...
type CurrentVpsConfig ¶
type CurrentVpsConfig string
func (CurrentVpsConfig) CanSave ¶
func (CurrentVpsConfig) CanSave()
type DatabaseConfig ¶
type DatabaseConfig struct { // 数据库文件路径。 // 如果不指定,使用内存数据库。 Path string `yaml:"path"` }
DatabaseConfig ...
type FileDataConfig ¶
type FileDataConfig struct { // 如果路径为空,使用内存文件系统。 Path string `yaml:"path"` }
FileDataConfig ...
type GithubAuthConfig ¶
type GithubAuthConfig struct { ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` UserID int64 `yaml:"user_id"` }
GithubAuthConfig ...
func DefaultGithubAuthConfig ¶
func DefaultGithubAuthConfig() GithubAuthConfig
DefaultGithubAuthConfig ...
type GoogleAuthConfig ¶
GoogleAuthConfig ...
func DefaultGoogleAuthConfig ¶
func DefaultGoogleAuthConfig() GoogleAuthConfig
DefaultGoogleAuthConfig ...
type HostdareVpsConfig ¶
type HostdareVpsConfig struct { Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` }
func (HostdareVpsConfig) CanSave ¶
func (HostdareVpsConfig) CanSave()
type MaintenanceConfig ¶
type MaintenanceConfig struct { DisableAdmin bool `yaml:"disable_admin"` Webhook struct { GitHub struct { Secret string `yaml:"secret"` } `yaml:"github"` } `yaml:"webhook"` }
MaintenanceConfig ...
func DefaultMainMaintenanceConfig ¶
func DefaultMainMaintenanceConfig() MaintenanceConfig
DefaultMainMaintenanceConfig ...
type MenuItem ¶
type MenuItem struct { Name string `json:"name" yaml:"name"` Link string `json:"link" yaml:"link"` Blank bool `json:"blank" yaml:"blank"` Items []MenuItem `json:"items" yaml:"items"` }
MenuItem ...
type NotificationChanifyConfig ¶
type NotificationChanifyConfig struct {
Token string `json:"token" yaml:"token"`
}
func (*NotificationChanifyConfig) BeforeSet ¶
func (c *NotificationChanifyConfig) BeforeSet(paths Segments, obj any) error
func (NotificationChanifyConfig) CanSave ¶
func (NotificationChanifyConfig) CanSave()
type NotificationConfig ¶
type NotificationConfig struct { Chanify NotificationChanifyConfig `json:"chanify" yaml:"chanify"` Mailer NotificationMailerConfig `json:"mailer" yaml:"mailer"` }
type NotificationMailerConfig ¶
type NotificationMailerConfig struct { // 服务器地址。形如:smtp.example.com:465 Server string `json:"server" yaml:"server"` // 帐户名。通常是邮件地址。 Account string `json:"account" yaml:"account"` // 密码。 Password string `json:"password" yaml:"password"` }
func (*NotificationMailerConfig) BeforeSet ¶
func (c *NotificationMailerConfig) BeforeSet(paths Segments, obj any) error
func (NotificationMailerConfig) CanSave ¶
func (NotificationMailerConfig) CanSave()
type OthersConfig ¶
type OthersConfig struct {
Whois WhoisConfig `json:"whois" yaml:"whois"`
}
type ServerConfig ¶
type ServerConfig struct { HTTPListen string `yaml:"http_listen"` GRPCListen string `yaml:"grpc_listen"` }
ServerConfig ...
type Settable ¶
type Settable interface { // 设置之前进行校验。 // paths:如果为空,则表示整体设置。 // 如果不为空,则表示设置对应名称的字段的值。 // obj:对象到具体的值(非值的指针)。 // // 注意: // - 具体的校验方式自己决定。如果 key 之前不相互依赖/影响,则可以单独判断。 // - 无需判断 path.Index 是否会对应到普通字段类型(非 struct、map)。 // - 无需判断值的类型,只要 path 对应,类型一定可强制断言且赋值。 // - 无需判断 path 是否存在。 BeforeSet(paths Segments, obj any) error }
type SiteConfig ¶
type SiteConfig struct { Home string `yaml:"home"` Name string `yaml:"name"` Description string `yaml:"description"` Since _Since `yaml:"since,omitempty"` }
SiteConfig ...
type ThemeConfig ¶
type ThemeConfig struct {
Stylesheets ThemeStylesheetsConfig `json:"stylesheets" yaml:"stylesheets"`
}
func DefaultThemeConfig ¶
func DefaultThemeConfig() ThemeConfig
func (ThemeConfig) CanSave ¶
func (ThemeConfig) CanSave()
type ThemeStylesheetsConfig ¶
type ThemeStylesheetsConfig struct { Template string `json:"template" yaml:"template"` Stylesheets []struct { Source string `json:"source" yaml:"source"` } `json:"stylesheets" yaml:"stylesheets"` }
func DefaultThemeStylesheetsConfig ¶
func DefaultThemeStylesheetsConfig() ThemeStylesheetsConfig
func (*ThemeStylesheetsConfig) Render ¶
func (c *ThemeStylesheetsConfig) Render() string
type VpsConfig ¶
type VpsConfig struct { Current CurrentVpsConfig `json:"current" yaml:"current"` Hostdare HostdareVpsConfig `json:"hostdare" yaml:"hostdare"` }
type WhoisApiLayerConfig ¶
type WhoisApiLayerConfig struct {
Key string `json:"key" yaml:"key"`
}
func (*WhoisApiLayerConfig) BeforeSet ¶
func (c *WhoisApiLayerConfig) BeforeSet(paths Segments, obj any) error
func (WhoisApiLayerConfig) CanSave ¶
func (WhoisApiLayerConfig) CanSave()
type WhoisConfig ¶
type WhoisConfig struct {
ApiLayer WhoisApiLayerConfig `json:"api_layer" yaml:"api_layer"`
}
Click to show internal directories.
Click to hide internal directories.