Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPassword ¶
CheckPassword compares the hash with the salted password. A nil return means the password is correct, but an error could mean either the password is not correct, or the salt process failed - indicated in logs
func FmtBytes ¶
FmtBytes converts the numeric byte size value to the appropriate magnitude size in KB, MB, GB, TB, PB, or EB.
func HashPassword ¶
HashPassword encrypts the salted password using bcrypt
Types ¶
type Config ¶
type Config struct {
contentVO.Item
Name string `json:"name"`
Domain string `json:"domain"`
CouchDBSubDomain string `json:"couchdb_subdomain"`
HugoverseSubDomain string `json:"hugoverse_subdomain"`
Netlify string `json:"netlify"`
BindAddress string `json:"bind_addr"`
HTTPPort string `json:"http_port"` // Hugoverse 内部监听端口 (如 1314)
HTTPSPort string `json:"https_port"` // HTTPS 端口 (如 443)
ExternalHTTPPort string `json:"external_http_port"` // Caddy 对外 HTTP 端口 (如 80 或 8080)
DevHTTPSPort string `json:"dev_https_port"`
AdminEmail string `json:"admin_email"`
ClientSecret string `json:"client_secret"`
Etag string `json:"etag"`
DisableCORS bool `json:"cors_disabled"`
DisableGZIP bool `json:"gzip_disabled"`
DisableHTTPCache bool `json:"cache_disabled"`
CacheMaxAge int64 `json:"cache_max_age"`
CacheInvalidate []string `json:"cache"`
BackupBasicAuthUser string `json:"backup_basic_auth_user"`
BackupBasicAuthPassword string `json:"backup_basic_auth_password"`
// CouchDB 配置
URL string `json:"url"` // CouchDB 服务器地址 (如 http://localhost:5984)
AdminUser string `json:"admin_user"` // 管理员用户名
AdminPass string `json:"admin_pass"` // 管理员密码
DBPrefix string `json:"db_prefix"` // 用户数据库前缀 (如 userdb-)
// Caddy 配置
CaddyHost string `json:"caddy_host"` // Caddy 服务器地址 (如 localhost)
CaddyPort string `json:"caddy_port"` // Caddy 服务器端口 (如 8080)
// 服务器 IP 配置
ServerIP string `json:"server_ip"` // 服务器公网 IP (用于域名检测)
// GitHub 配置
GithubHookSecret string `json:"github_hook_secret"` // GitHub Webhook Secret (用于验证 webhook 签名)
GithubToken string `json:"github_token"` // GitHub Personal Access Token (用于下载私有仓库)
GithubTargetRepo string `json:"github_target_repo"` // GitHub 目标仓库全名 (如 mdfriday/obsidian-friday-plugin)
// SMTP 配置
SMTPHost string `json:"smtp_host"` // SMTP 服务器地址 (如 smtp.gmail.com)
SMTPPort int `json:"smtp_port"` // SMTP 端口 (如 587 for TLS, 465 for SSL)
SMTPUsername string `json:"smtp_username"` // SMTP 用户名 (通常是邮箱地址)
SMTPPassword string `json:"smtp_password"` // SMTP 密码或应用专用密码
SMTPFrom string `json:"smtp_from"` // 发件人邮箱地址
SMTPUseTLS bool `json:"smtp_use_tls"` // 是否使用 TLS (STARTTLS)
}
func (*Config) IsCacheInvalidate ¶
func (*Config) MarshalEditor ¶
MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable
type FileUpload ¶
type FileUpload struct {
contentVO.Item
Name string `json:"name"`
Path string `json:"path"`
ContentLength int64 `json:"content_length"`
ContentType string `json:"content_type"`
}
FileUpload represents the file uploaded to the system
func (*FileUpload) FilePath ¶
func (f *FileUpload) FilePath() string
func (*FileUpload) MarshalEditor ¶
func (f *FileUpload) MarshalEditor() ([]byte, error)
MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable
func (*FileUpload) Push ¶
func (f *FileUpload) Push() []string
func (*FileUpload) String ¶
func (f *FileUpload) String() string
String partially implements item.Identifiable and overrides Item's String()