Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBgConfig(cfg *BgConfig, fillDefault bool) error
- func CheckFileInfo(info *FileInfo, fillDefault bool) error
- func CheckPreferences(prefers *Preferences, fillDefault bool) error
- func CheckQuota(quota *Quota) error
- func CheckSiteCfg(cfg *SiteConfig, fillDefault bool) error
- func CheckUser(user *User, fillDefault bool) error
- func ComparePreferences(p1, p2 *Preferences) bool
- func UploadNS(user string) string
- type BgConfig
- type ClientConfig
- type FileInfo
- type Preferences
- type Quota
- type SiteConfig
- type UploadInfo
- type User
- type UserCfg
Constants ¶
View Source
const ( UserSchemaNs = "UserSchemaNs" FileSchemaNs = "FileSchemaNs" UserIDsNs = "UserIDsNs" UsersNs = "UsersNs" RolesNs = "RolesNs" FileInfoNs = "FileInfoNs" KeyInitTime = "keyInitTime" AdminRole = "admin" UserRole = "user" VisitorRole = "visitor" )
Variables ¶
View Source
var ( ErrInvalidFileInfo = errors.New("invalid fileInfo") ErrInvalidUser = errors.New("invalid user") ErrInvalidQuota = errors.New("invalid quota") ErrInvalidPreferences = errors.New("invalid preferences") ErrBucketNotFound = errors.New("bucket not found") ErrKeyNotFound = errors.New("key not found") ErrKeyExisting = errors.New("key is existing") ErrCreateExisting = errors.New("create upload info which already exists") ErrQuota = errors.New("quota limit reached") DefaultSiteName = "Quickshare" DefaultSiteDesc = "Quickshare" DefaultBgConfig = &BgConfig{ Url: "", Repeat: "repeat", Position: "top", Align: "fixed", BgColor: "", } DefaultAllowSetBg = false DefaultAutoTheme = true BgRepeatValues = map[string]bool{ "repeat-x": true, "repeat-y": true, "repeat": true, "space": true, "round": true, "no-repeat": true, } BgAlignValues = map[string]bool{ "scroll": true, "fixed": true, "local": true, } BgPositionValues = map[string]bool{ "top": true, "bottom": true, "left": true, "right": true, "center": true, } DefaultCSSURL = "" DefaultLanPackURL = "" DefaultLan = "en_US" DefaultTheme = "light" DefaultAvatar = "" DefaultEmail = "" DefaultSpaceLimit = int64(1024 * 1024 * 1024) // 1GB DefaultUploadSpeedLimit = 50 * 1024 * 1024 // 50MB DefaultDownloadSpeedLimit = 50 * 1024 * 1024 // 50MB VisitorUploadSpeedLimit = 10 * 1024 * 1024 // 10MB VisitorDownloadSpeedLimit = 10 * 1024 * 1024 // 10MB DefaultPreferences = Preferences{ Bg: DefaultBgConfig, CSSURL: DefaultCSSURL, LanPackURL: DefaultLanPackURL, Lan: DefaultLan, Theme: DefaultTheme, Avatar: DefaultAvatar, Email: DefaultEmail, } )
Functions ¶
func CheckBgConfig ¶ added in v0.8.1
func CheckFileInfo ¶ added in v0.8.1
TODO: auto trigger hash generating
func CheckPreferences ¶ added in v0.8.1
func CheckPreferences(prefers *Preferences, fillDefault bool) error
func CheckQuota ¶ added in v0.8.1
TODO: check upper and lower limit
func CheckSiteCfg ¶ added in v0.8.1
func CheckSiteCfg(cfg *SiteConfig, fillDefault bool) error
func ComparePreferences ¶ added in v0.7.1
func ComparePreferences(p1, p2 *Preferences) bool
Types ¶
type ClientConfig ¶ added in v0.8.1
type Preferences ¶
type Preferences struct { Bg *BgConfig `json:"bg" yaml:"bg"` CSSURL string `json:"cssURL" yaml:"cssURL"` LanPackURL string `json:"lanPackURL" yaml:"lanPackURL"` Lan string `json:"lan" yaml:"lan"` Theme string `json:"theme" yaml:"theme"` Avatar string `json:"avatar" yaml:"avatar"` Email string `json:"email" yaml:"email"` }
type SiteConfig ¶ added in v0.8.1
type SiteConfig struct {
ClientCfg *ClientConfig `json:"clientCfg" yaml:"clientCfg"`
}
type UploadInfo ¶
type User ¶
type User struct { ID uint64 `json:"id,string" yaml:"id,string"` Name string `json:"name" yaml:"name"` Pwd string `json:"pwd" yaml:"pwd"` Role string `json:"role" yaml:"role"` UsedSpace int64 `json:"usedSpace,string" yaml:"usedSpace,string"` Quota *Quota `json:"quota" yaml:"quota"` Preferences *Preferences `json:"preferences" yaml:"preferences"` }
Click to show internal directories.
Click to hide internal directories.