Files
web/server/models/site.go

73 lines
3.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "go.mongodb.org/mongo-driver/v2/bson"
// Site 站点
type Site struct {
ID bson.ObjectID `bson:"_id,omitempty" json:"id"`
Name string `bson:"name" json:"name"`
Domain string `bson:"domain" json:"domain"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
CreatedAt string `bson:"created_at" json:"created_at"`
}
// Page 网页(属于某站点)
type Page struct {
ID bson.ObjectID `bson:"_id,omitempty" json:"id"`
SiteID string `bson:"site_id" json:"site_id"`
Slug string `bson:"slug" json:"slug"` // index, about, ...
Title string `bson:"title" json:"title"`
Type string `bson:"type" json:"type"` // homepage, page
Content string `bson:"content" json:"content"` // html 模式为 HTMLbuilder 模式为 JSON见文档
ContentMode string `bson:"content_mode,omitempty" json:"content_mode"` // html | builder空视为 html
RoutePath string `bson:"route_path,omitempty" json:"route_path"` // 自定义前台路径,如 /about空则用 /{slug}
Published *bool `bson:"published,omitempty" json:"published"` // nil 或未设视为已发布
UpdatedAt string `bson:"updated_at" json:"updated_at"`
}
// HomepageData 首页可编辑数据(与 yuheng-download-space 对应)
type HomepageData struct {
LogoText string `json:"logo_text"` // YUHENG ONE
NavLinks []NavLink `json:"nav_links"` // MISSION, DOWNLOAD, CONTACT
Title string `json:"title"` // 宇恒一号
Subtitle string `json:"subtitle"` // INTERSTELLAR EXPLORER EDITION
Description string `json:"description"` // 跨越星际的智能伙伴...
DownloadText string `json:"download_text"` // START EXPLORING
DownloadURL string `json:"download_url"` // #
Platforms []PlatformItem `json:"platforms"` // Windows, macOS, ...
Version string `json:"version"` // VERSION 3.2.1
LaunchYear string `json:"launch_year"` // LAUNCH: 2024
BadgeText string `json:"badge_text"` // FREE ACCESS
Features []FeatureItem `json:"features"` // 星际导航等
FooterText string `json:"footer_text"` // © 2024 YUHENG ONE
// BodyBuilder 首页下方扩展区:与网页积木相同 JSON 字符串 {"version":1,"blocks":[...]},空则仅展示上方模板
BodyBuilder string `json:"body_builder,omitempty"`
}
type NavLink struct {
Label string `json:"label"`
URL string `json:"url"`
}
type PlatformItem struct {
Name string `json:"name"` // WINDOWS, MACOS, ...
URL string `json:"url"`
}
type FeatureItem struct {
Title string `json:"title"`
Desc string `json:"desc"`
}
// SiteAsset 站点功能模块/上传文件
type SiteAsset struct {
ID bson.ObjectID `bson:"_id,omitempty" json:"id"`
SiteID string `bson:"site_id" json:"site_id"`
Name string `bson:"name" json:"name"`
FilePath string `bson:"file_path" json:"file_path"` // 相对路径,可含多级目录
Size int64 `bson:"size" json:"size"`
ContentType string `bson:"content_type" json:"content_type"`
Downloadable bool `bson:"downloadable" json:"downloadable"` // 是否允许下载
CreatedAt string `bson:"created_at" json:"created_at"`
}