Documentation
¶
Index ¶
- func AutoInitialize(adminApp *entity.Admin, db SystemDatabase, contentApp LicenseChecker, ...) error
- func CustomDomainFolder() string
- func DataDir() string
- func DeleteDir(dir string) error
- func DeployToNetlify(target string, deployment *valueobject.Deployment, domain *valueobject.Domain, ...) error
- func DeployToNetlifyBK(target string, deployment *valueobject.Deployment, domain *valueobject.Domain, ...) error
- func EnsureDirExists(dir string) error
- func EnterpriseDir() string
- func FridayDir() string
- func FridayFolder() string
- func FridayResourceRecycle(log loggers.Logger)
- func GenerateStaticSite() error
- func GenerateStaticSiteWithTarget(target string) error
- func ImageStorageDir() string
- func LicenseResourceRecycle(cs *contentEntity.Content, adminApp *adminEntity.Admin, log loggers.Logger)
- func LoadHugoProject() error
- func LogDir() string
- func MDFridayDir() string
- func NewContentServer(db repository.Repository) *entity.Content
- func NewDemo() (string, error)
- func PreviewDir() string
- func PreviewFolder() string
- func PreviewSiteRecycle(cs *contentEntity.Content, token string)
- func PublishDir() string
- func PublishFolder() string
- func ServeGenerateStaticSite() (afero.Fs, error)
- func SubDomainFolder() string
- func TLSDir() string
- func UploadDir() string
- type BackupMetadata
- type BackupScheduler
- type CaddyBackupInfo
- type CaddyStartParams
- type CompressionInfo
- type CouchDBBackupInfo
- type DatabaseBackupInfo
- type HugoverseBackupInfo
- type InstanceManager
- func (m *InstanceManager) CheckOfflineStatus() error
- func (m *InstanceManager) GetLocalInstance() (*LocalInstanceData, error)
- func (m *InstanceManager) GetOrCreateInstance() (*contentVO.Instance, error)
- func (m *InstanceManager) IsCacheValid() bool
- func (m *InstanceManager) IsLocalDevelopment() bool
- func (m *InstanceManager) SaveLocalDataDirect(localData *LocalInstanceData) error
- func (m *InstanceManager) UpdateFromRemote(remoteInstance *contentVO.Instance) error
- func (m *InstanceManager) UpdateLocalInstance(instance *contentVO.Instance) error
- type LicenseChecker
- type LocalInstanceData
- type SystemDatabase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoInitialize ¶ added in v0.2.47
func AutoInitialize(adminApp *entity.Admin, db SystemDatabase, contentApp LicenseChecker, log loggers.Logger) error
AutoInitialize 从环境变量自动初始化系统
func CustomDomainFolder ¶ added in v0.2.3
func CustomDomainFolder() string
func DeployToNetlify ¶
func DeployToNetlify(target string, deployment *valueobject.Deployment, domain *valueobject.Domain, token string) error
func DeployToNetlifyBK ¶
func DeployToNetlifyBK(target string, deployment *valueobject.Deployment, domain *valueobject.Domain, token string) error
func EnsureDirExists ¶ added in v0.2.1
func EnterpriseDir ¶ added in v0.2.23
func EnterpriseDir() string
func FridayFolder ¶ added in v0.2.44
func FridayFolder() string
func FridayResourceRecycle ¶ added in v0.2.44
FridayResourceRecycle 定期清理 Friday 免费预览目录 每小时检查一次,删除超过 24 小时的文件夹
func GenerateStaticSite ¶
func GenerateStaticSite() error
func ImageStorageDir ¶ added in v0.1.27
func ImageStorageDir() string
func LicenseResourceRecycle ¶ added in v0.2.25
func LicenseResourceRecycle(cs *contentEntity.Content, adminApp *adminEntity.Admin, log loggers.Logger)
func LoadHugoProject ¶
func LoadHugoProject() error
func MDFridayDir ¶ added in v0.2.47
func MDFridayDir() string
func NewContentServer ¶
func NewContentServer(db repository.Repository) *entity.Content
func PreviewDir ¶
func PreviewDir() string
func PreviewFolder ¶
func PreviewFolder() string
func PreviewSiteRecycle ¶
func PreviewSiteRecycle(cs *contentEntity.Content, token string)
func ServeGenerateStaticSite ¶
func SubDomainFolder ¶ added in v0.2.3
func SubDomainFolder() string
Types ¶
type BackupMetadata ¶ added in v0.2.36
type BackupMetadata struct {
Version string `json:"version"`
BackupType string `json:"backup_type"`
Timestamp time.Time `json:"timestamp"`
Hostname string `json:"hostname"`
Service string `json:"service"`
CouchDB CouchDBBackupInfo `json:"couchdb"`
Caddy CaddyBackupInfo `json:"caddy"`
Hugoverse HugoverseBackupInfo `json:"hugoverse"`
Compression CompressionInfo `json:"compression"`
TotalDuration int64 `json:"total_duration_ms"`
Status string `json:"status"`
}
BackupMetadata 备份元数据
type BackupScheduler ¶ added in v0.2.36
type BackupScheduler struct {
// contains filtered or unexported fields
}
BackupScheduler 备份调度器
func NewBackupScheduler ¶ added in v0.2.36
func NewBackupScheduler(couchdbCfg *couchdb.Config, caddyCfg *caddy.Config, contentServer *contentEntity.Content, log loggers.Logger) *BackupScheduler
NewBackupScheduler 创建备份调度器
type CaddyBackupInfo ¶ added in v0.2.36
type CaddyBackupInfo struct {
Status string `json:"status"`
Size int64 `json:"size_bytes"`
Duration int64 `json:"duration_ms"`
}
CaddyBackupInfo Caddy 备份信息
type CaddyStartParams ¶ added in v0.2.36
type CaddyStartParams struct {
Domain string `json:"domain"`
DNSPodToken string `json:"dnspod_token"`
ServerIP string `json:"server_ip"`
Backend string `json:"backend"`
CouchDB string `json:"couchdb"`
PIDFile string `json:"pid_file"`
LogFile string `json:"log_file"`
}
CaddyStartParams Caddy 启动参数
type CompressionInfo ¶ added in v0.2.36
type CompressionInfo struct {
OriginalSize int64 `json:"original_size_bytes"`
CompressedSize int64 `json:"compressed_size_bytes"`
Ratio float64 `json:"ratio"`
Algorithm string `json:"algorithm"`
}
CompressionInfo 压缩信息
type CouchDBBackupInfo ¶ added in v0.2.36
type CouchDBBackupInfo struct {
Status string `json:"status"`
URL string `json:"url"`
Databases map[string]DatabaseBackupInfo `json:"databases"`
TotalDatabases int `json:"total_databases"`
TotalDocs int `json:"total_docs"`
TotalSize int64 `json:"total_size_bytes"`
Duration int64 `json:"total_duration_ms"`
}
CouchDBBackupInfo CouchDB 备份信息
type DatabaseBackupInfo ¶ added in v0.2.36
type DatabaseBackupInfo struct {
DocCount int `json:"doc_count"`
UpdateSeq string `json:"update_seq"`
Size int64 `json:"size_bytes"`
BackupTime int64 `json:"backup_time_ms"`
}
DatabaseBackupInfo 单个数据库备份信息
type HugoverseBackupInfo ¶ added in v0.2.36
type HugoverseBackupInfo struct {
Status string `json:"status"`
DBPath string `json:"db_path"`
Size int64 `json:"size_bytes"`
Duration int64 `json:"duration_ms"`
}
HugoverseBackupInfo Hugoverse 备份信息
type InstanceManager ¶ added in v0.2.47
type InstanceManager struct {
// contains filtered or unexported fields
}
InstanceManager 实例管理器
func NewInstanceManager ¶ added in v0.2.47
func NewInstanceManager(log loggers.Logger, version string) *InstanceManager
NewInstanceManager 创建实例管理器
func (*InstanceManager) CheckOfflineStatus ¶ added in v0.2.47
func (m *InstanceManager) CheckOfflineStatus() error
CheckOfflineStatus 检查实例是否离线超时
func (*InstanceManager) GetLocalInstance ¶ added in v0.2.47
func (m *InstanceManager) GetLocalInstance() (*LocalInstanceData, error)
GetLocalInstance 获取本地实例数据
func (*InstanceManager) GetOrCreateInstance ¶ added in v0.2.47
func (m *InstanceManager) GetOrCreateInstance() (*contentVO.Instance, error)
GetOrCreateInstance 获取或创建实例 首先检查本地 JSON 文件,如果不存在则创建新实例
func (*InstanceManager) IsCacheValid ¶ added in v0.2.47
func (m *InstanceManager) IsCacheValid() bool
IsCacheValid 检查本地缓存是否有效(24小时内)
func (*InstanceManager) IsLocalDevelopment ¶ added in v0.2.49
func (m *InstanceManager) IsLocalDevelopment() bool
IsLocalDevelopment 检测是否为本地开发环境
func (*InstanceManager) SaveLocalDataDirect ¶ added in v0.2.47
func (m *InstanceManager) SaveLocalDataDirect(localData *LocalInstanceData) error
SaveLocalDataDirect 直接保存 LocalInstanceData 到文件(公开方法)
func (*InstanceManager) UpdateFromRemote ¶ added in v0.2.47
func (m *InstanceManager) UpdateFromRemote(remoteInstance *contentVO.Instance) error
UpdateFromRemote 从远端更新实例数据
func (*InstanceManager) UpdateLocalInstance ¶ added in v0.2.47
func (m *InstanceManager) UpdateLocalInstance(instance *contentVO.Instance) error
UpdateLocalInstance 更新本地实例数据
type LicenseChecker ¶ added in v0.2.47
LicenseChecker 接口定义
type LocalInstanceData ¶ added in v0.2.47
type LocalInstanceData struct {
InstanceID string `json:"instance_id"`
Domain string `json:"domain"` // 实例域名
LastSeenAt int64 `json:"last_seen_at"` // 最后心跳时间(用于判断离线)
LastSyncAt int64 `json:"last_sync_at"` // 最后同步时间(用于判断缓存是否过期)
CreatedAt int64 `json:"created_at"` // 首次安装时间
AllowOfflineSeconds int64 `json:"allow_offline_seconds"` // 允许离线时间(默认半年)
Status string `json:"status"` // 状态(active/blocked/suspended)
TotalLicenses int `json:"total_licenses"` // 总 license 数量
TotalTrials int `json:"total_trials"` // 总 trial 数量
}
LocalInstanceData 本地实例数据(持久化到 JSON)
type SystemDatabase ¶ added in v0.2.47
type SystemDatabase interface {
SystemInitComplete() bool
}
SystemDatabase 接口定义