Documentation
¶
Index ¶
- Constants
- func CheckVersion() bool
- func CreateOrSave(entity *Entity) int64
- func GetConfigByPageType[T any](pageType string, defaultValue T) T
- func GetConfigByPageTypeE[T any](pageType string, defaultValue T) (T, error)
- func GetMigrationVersion() uint32
- func NormalizeSiteThemeDefinition(theme *SiteThemeDefinition, defaults []SiteThemeDefinition, ...)
- func SyncMigrationVersion(version uint32)
- func SyncVersion()
- type AnnouncementConfig
- type Entity
- type FooterInfo
- type FooterItem
- type FriendLinksGroup
- type LinkItem
- type MailSettingsConfig
- type PItem
- type PostingContent
- type SecurityAndRegistration
- type SiteSettingsConfig
- type SiteThemeConfig
- type SiteThemeDefinition
- type SiteThemePrepublish
- type SiteThemeTokens
- type SponsorItem
- type Sponsors
- type SponsorsConfig
- type SponsorsContact
- type SponsorsPageIntro
- type SponsorsRule
Constants ¶
View Source
const ( FriendShipLinks = `friendShipLinks` SponsorsPage = `sponsors` SiteSettings = `siteSettings` EmailSettings = `emailSetting` Announcement = `announcement` SecuritySettings = `securitySettings` PostingSettings = `postingSettings` SiteTheme = `siteTheme` Version = `version` Migration = `migration` )
View Source
const AppMigrationVersion uint32 = 2
Variables ¶
This section is empty.
Functions ¶
func CheckVersion ¶ added in v0.0.10
func CheckVersion() bool
func CreateOrSave ¶
func GetConfigByPageType ¶ added in v0.0.5
func GetConfigByPageTypeE ¶ added in v0.0.8
func GetMigrationVersion ¶ added in v0.2.6
func GetMigrationVersion() uint32
func NormalizeSiteThemeDefinition ¶ added in v0.2.25
func NormalizeSiteThemeDefinition(theme *SiteThemeDefinition, defaults []SiteThemeDefinition, fallback SiteThemeDefinition)
func SyncMigrationVersion ¶ added in v0.2.6
func SyncMigrationVersion(version uint32)
func SyncVersion ¶ added in v0.0.10
func SyncVersion()
Types ¶
type AnnouncementConfig ¶ added in v0.0.9
type AnnouncementConfig struct {
Enabled bool `json:"enabled"` // 是否启用公告
Content string `json:"content"` // 公告内容
HtmlContent string `json:"-"` // 预渲染后的 HTML,仅服务端使用
}
AnnouncementConfig 公告设置配置
func (AnnouncementConfig) GetHtmlContent ¶ added in v0.1.2
func (itself AnnouncementConfig) GetHtmlContent() string
func (*AnnouncementConfig) PrepareHTML ¶ added in v0.1.2
func (itself *AnnouncementConfig) PrepareHTML()
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` // 主键
PageType string `gorm:"column:page_type;uniqueIndex;type:varchar(128);not null;default:'';" json:"pageType"` // 页面类型
Config string `gorm:"column:config;type:text;" json:"content"` //
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"` //
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
}
func GetByPageType ¶
type FooterInfo ¶ added in v0.1.1
type FooterInfo struct {
}
type FooterItem ¶ added in v0.0.8
type FooterItem struct {
}
type FriendLinksGroup ¶ added in v0.0.5
type MailSettingsConfig ¶ added in v0.0.8
type MailSettingsConfig struct {
// SMTP服务器设置
EnableMail bool `json:"enableMail"`
SmtpHost string `json:"smtpHost"`
SmtpPort int `json:"smtpPort"`
UseSSL bool `json:"useSSL"`
SmtpUsername string `json:"smtpUsername"`
SmtpPassword string `json:"smtpPassword"`
FromName string `json:"fromName"`
FromEmail string `json:"fromEmail"`
}
MailSettingsConfig 邮件设置配置
type PostingContent ¶ added in v0.1.1
type PostingContent struct {
TextControl struct {
MinPostLength int `json:"minPostLength"`
MaxPostLength int `json:"maxPostLength"`
MinTitleLength int `json:"minTitleLength"`
MaxTitleLength int `json:"maxTitleLength"`
NewUserPostCooldownMinutes int `json:"newUserPostCooldownMinutes"`
} `json:"textControl"`
UploadControl struct {
AllowAttachments bool `json:"allowAttachments"`
AuthorizedExtensions []string `json:"authorizedExtensions"`
MaxAttachmentSizeKb int `json:"maxAttachmentSizeKb"`
MaxDailyUploadsPerUser int `json:"maxDailyUploadsPerUser"`
NewUserUploadCooldownMinutes int `json:"newUserUploadCooldownMinutes"`
} `json:"uploadControl"`
}
type SecurityAndRegistration ¶ added in v0.1.1
type SiteSettingsConfig ¶ added in v0.0.8
type SiteSettingsConfig struct {
// 站点基本信息
SiteName string `json:"siteName"`
SiteLogo string `json:"siteLogo"`
SiteDescription string `json:"siteDescription"`
SiteKeywords string `json:"siteKeywords"`
SiteUrl string `json:"siteUrl"`
SiteEmail string `json:"siteEmail"`
ExternalLinks string `json:"externalLinks"`
// 品牌标识类型: default(默认样式), text(自定义文字), image(图片)
BrandType string `json:"brandType"`
BrandText string `json:"brandText"`
BrandImage string `json:"brandImage"`
}
SiteSettingsConfig 站点设置配置
type SiteThemeConfig ¶ added in v0.2.23
type SiteThemeConfig struct {
Version int `json:"version"`
Enabled bool `json:"enabled"`
Themes []SiteThemeDefinition `json:"themes"`
Prepublish *SiteThemePrepublish `json:"prepublish,omitempty"`
PublishedAt string `json:"publishedAt,omitempty"`
}
type SiteThemeDefinition ¶ added in v0.2.23
type SiteThemeDefinition struct {
Name string `json:"name"`
Label string `json:"label"`
ColorScheme string `json:"colorScheme"`
Tokens SiteThemeTokens `json:"tokens"`
}
func FirstSiteThemeDefinition ¶ added in v0.2.25
func FirstSiteThemeDefinition(themes []SiteThemeDefinition) SiteThemeDefinition
func NormalizeSiteThemeDefinitions ¶ added in v0.2.25
func NormalizeSiteThemeDefinitions(themes []SiteThemeDefinition, defaults []SiteThemeDefinition, fallback SiteThemeDefinition) []SiteThemeDefinition
type SiteThemePrepublish ¶ added in v0.2.25
type SiteThemePrepublish struct {
Enabled bool `json:"enabled"`
Themes []SiteThemeDefinition `json:"themes"`
UpdatedAt string `json:"updatedAt,omitempty"`
}
type SiteThemeTokens ¶ added in v0.2.24
type SiteThemeTokens struct {
ColorBase100 string `json:"color-base-100"`
ColorBase200 string `json:"color-base-200"`
ColorBase300 string `json:"color-base-300"`
ColorBaseContent string `json:"color-base-content"`
ColorIconMuted string `json:"color-icon-muted"`
ColorLine string `json:"color-line"`
ColorPrimary string `json:"color-primary"`
ColorPrimaryContent string `json:"color-primary-content"`
ColorSecondary string `json:"color-secondary"`
ColorSecondaryContent string `json:"color-secondary-content"`
ColorAccent string `json:"color-accent"`
ColorAccentContent string `json:"color-accent-content"`
ColorNeutral string `json:"color-neutral"`
ColorNeutralContent string `json:"color-neutral-content"`
ColorInfo string `json:"color-info"`
ColorInfoContent string `json:"color-info-content"`
ColorSuccess string `json:"color-success"`
ColorSuccessContent string `json:"color-success-content"`
ColorWarning string `json:"color-warning"`
ColorWarningContent string `json:"color-warning-content"`
ColorError string `json:"color-error"`
ColorErrorContent string `json:"color-error-content"`
RadiusSelector string `json:"radius-selector"`
RadiusField string `json:"radius-field"`
RadiusBox string `json:"radius-box"`
SizeSelector string `json:"size-selector"`
SizeField string `json:"size-field"`
Border string `json:"border"`
Depth string `json:"depth"`
Noise string `json:"noise"`
}
func (SiteThemeTokens) AppendCSSVariables ¶ added in v0.2.25
func (tokens SiteThemeTokens) AppendCSSVariables(sb *strings.Builder)
func (SiteThemeTokens) BaseColor ¶ added in v0.2.25
func (tokens SiteThemeTokens) BaseColor() string
func (*SiteThemeTokens) NormalizeFrom ¶ added in v0.2.25
func (tokens *SiteThemeTokens) NormalizeFrom(defaults SiteThemeTokens)
type SponsorItem ¶ added in v0.0.8
type Sponsors ¶ added in v0.0.8
type Sponsors struct {
Level0 []SponsorItem `json:"level0"`
Level1 []SponsorItem `json:"level1"`
Level2 []SponsorItem `json:"level2"`
Level3 []SponsorItem `json:"level3"`
}
type SponsorsConfig ¶ added in v0.0.8
type SponsorsConfig struct {
Sponsors Sponsors `json:"sponsors"`
Content SponsorsPageIntro `json:"content"`
Contact SponsorsContact `json:"contact"`
Rules []SponsorsRule `json:"rules"`
}
type SponsorsContact ¶ added in v0.2.2
type SponsorsPageIntro ¶ added in v0.2.2
type SponsorsRule ¶ added in v0.2.2
type SponsorsRule struct {
Content string `json:"content"`
}
Click to show internal directories.
Click to hide internal directories.