pageConfig

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FriendShipLinks  = `friendShipLinks`
	SponsorsPage     = `sponsors`
	SiteSettings     = `siteSettings`
	EmailSettings    = `emailSetting`
	Announcement     = `announcement`
	SecuritySettings = `securitySettings`
	PostingSettings  = `postingSettings`
	Version          = `version`
	Migration        = `migration`
)
View Source
const AppMigrationVersion uint32 = 1

Variables

This section is empty.

Functions

func CheckVersion added in v0.0.10

func CheckVersion() bool

func CreateOrSave

func CreateOrSave(entity *Entity) int64

func GetConfigByPageType added in v0.0.5

func GetConfigByPageType[T any](pageType string, defaultValue T) T

func GetConfigByPageTypeE added in v0.0.8

func GetConfigByPageTypeE[T any](pageType string, defaultValue T) (T, error)

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 Get

func Get(id any) (entity Entity)

func GetByPageType

func GetByPageType(pageType string) (entity Entity)

func (*Entity) TableName

func (itself *Entity) TableName() string

type FooterInfo added in v0.1.1

type FooterInfo struct {
	Primary []PItem      `json:"primary"`
	List    []FooterItem `json:"list"`
}

type FooterItem added in v0.0.8

type FooterItem struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type FriendLinksGroup added in v0.0.5

type FriendLinksGroup struct {
	Name  string     `json:"name,omitempty"`
	Emoji string     `json:"emoji,omitempty"`
	Color string     `json:"color,omitempty"`
	Links []LinkItem `json:"links"`
}

type LinkItem added in v0.0.5

type LinkItem struct {
	Name    string `json:"name"`
	Desc    string `json:"desc"`
	Url     string `json:"url"`
	LogoUrl string `json:"logoUrl"`
	Status  int    `json:"status"`
}

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 PItem added in v0.0.8

type PItem struct {
	Content string `json:"content"`
}

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 SecurityAndRegistration struct {
	EnableSignup            bool     `json:"enableSignup"`
	EnableEmailVerification bool     `json:"enableEmailVerification"`
	AllowedDomains          []string `json:"allowedDomains"`
}

type SiteSettingsConfig added in v0.0.8

type SiteSettingsConfig struct {
	// 站点基本信息
	SiteName        string     `json:"siteName"`
	SiteDescription string     `json:"siteDescription"`
	SiteKeywords    string     `json:"siteKeywords"`
	SiteUrl         string     `json:"siteUrl"`
	SiteEmail       string     `json:"siteEmail"`
	ExternalLinks   string     `json:"externalLinks"`
	FooterInfo      FooterInfo `json:"footerInfo,omitempty"`
	// 品牌标识类型: default(默认样式), text(自定义文字), image(图片)
	BrandType  string `json:"brandType"`
	BrandText  string `json:"brandText"`
	BrandImage string `json:"brandImage"`
}

SiteSettingsConfig 站点设置配置

type SponsorItem added in v0.0.8

type SponsorItem struct {
	Link      string `json:"link"`
	Message   string `json:"message"`
	AvatarUrl string `json:"avatarUrl"`
	Name      string `json:"name"`
}

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 SponsorsContact struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	ButtonText  string `json:"buttonText"`
	ButtonLink  string `json:"buttonLink"`
}

type SponsorsPageIntro added in v0.2.2

type SponsorsPageIntro struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type SponsorsRule added in v0.2.2

type SponsorsRule struct {
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL