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 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 SiteThemeSnapshot
- type SiteThemeTokenKey
- 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 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"`
Draft *SiteThemeSnapshot `json:"draft,omitempty"`
History []SiteThemeSnapshot `json:"history,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"`
}
type SiteThemeSnapshot ¶ added in v0.2.23
type SiteThemeSnapshot struct {
Enabled bool `json:"enabled"`
Themes []SiteThemeDefinition `json:"themes"`
CreatedAt string `json:"createdAt,omitempty"`
Label string `json:"label,omitempty"`
}
type SiteThemeTokenKey ¶ added in v0.2.24
type SiteThemeTokenKey string
const ( SiteThemeTokenColorBase100 SiteThemeTokenKey = "color-base-100" SiteThemeTokenColorBase200 SiteThemeTokenKey = "color-base-200" SiteThemeTokenColorBase300 SiteThemeTokenKey = "color-base-300" SiteThemeTokenColorBaseContent SiteThemeTokenKey = "color-base-content" SiteThemeTokenColorIconMuted SiteThemeTokenKey = "color-icon-muted" SiteThemeTokenColorLine SiteThemeTokenKey = "color-line" SiteThemeTokenColorPrimary SiteThemeTokenKey = "color-primary" SiteThemeTokenColorPrimaryContent SiteThemeTokenKey = "color-primary-content" SiteThemeTokenColorSecondary SiteThemeTokenKey = "color-secondary" SiteThemeTokenColorSecondaryContent SiteThemeTokenKey = "color-secondary-content" SiteThemeTokenColorAccent SiteThemeTokenKey = "color-accent" SiteThemeTokenColorAccentContent SiteThemeTokenKey = "color-accent-content" SiteThemeTokenColorNeutral SiteThemeTokenKey = "color-neutral" SiteThemeTokenColorNeutralContent SiteThemeTokenKey = "color-neutral-content" SiteThemeTokenColorInfo SiteThemeTokenKey = "color-info" SiteThemeTokenColorInfoContent SiteThemeTokenKey = "color-info-content" SiteThemeTokenColorSuccess SiteThemeTokenKey = "color-success" SiteThemeTokenColorSuccessContent SiteThemeTokenKey = "color-success-content" SiteThemeTokenColorWarning SiteThemeTokenKey = "color-warning" SiteThemeTokenColorWarningContent SiteThemeTokenKey = "color-warning-content" SiteThemeTokenColorError SiteThemeTokenKey = "color-error" SiteThemeTokenColorErrorContent SiteThemeTokenKey = "color-error-content" SiteThemeTokenRadiusSelector SiteThemeTokenKey = "radius-selector" SiteThemeTokenRadiusField SiteThemeTokenKey = "radius-field" SiteThemeTokenRadiusBox SiteThemeTokenKey = "radius-box" SiteThemeTokenSizeSelector SiteThemeTokenKey = "size-selector" SiteThemeTokenSizeField SiteThemeTokenKey = "size-field" SiteThemeTokenBorder SiteThemeTokenKey = "border" SiteThemeTokenDepth SiteThemeTokenKey = "depth" SiteThemeTokenNoise SiteThemeTokenKey = "noise" )
func SiteThemeTokenKeys ¶ added in v0.2.24
func SiteThemeTokenKeys() []SiteThemeTokenKey
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) Get ¶ added in v0.2.24
func (tokens SiteThemeTokens) Get(key SiteThemeTokenKey) string
func (*SiteThemeTokens) Set ¶ added in v0.2.24
func (tokens *SiteThemeTokens) Set(key SiteThemeTokenKey, value string)
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.