Documentation ¶
Index ¶
- Variables
- func GenShareHash(userName, itmPath string) string
- type AllowedShare
- type Auth
- type CaptchaConfig
- type GlobalConfig
- func (cfg *GlobalConfig) Add(u *UserConfig) error
- func (cfg *GlobalConfig) CopyConfig() *GlobalConfig
- func (cfg *GlobalConfig) Delete(username string) error
- func (gc *GlobalConfig) DeleteShare(usr *UserConfig, p string) (res bool)
- func (cfg *GlobalConfig) GetAdmin() *UserConfig
- func (cfg *GlobalConfig) GetByIp(ip string) (*UserConfig, bool)
- func (cfg *GlobalConfig) GetByUsername(username string) (*UserConfig, bool)
- func (gc *GlobalConfig) GetDavPath(userName string) string
- func (gc *GlobalConfig) GetExternal(hash string) (res *ShareItem, usr *UserConfig)
- func (cfg *GlobalConfig) GetKeyBytes() ([]byte, error)
- func (cfg *GlobalConfig) GetSharePreviewPath(url string) (res string)
- func (cfg *GlobalConfig) GetUserHomePath(userName string) string
- func (cfg *GlobalConfig) GetUserPreviewPath(userName string) string
- func (cfg *GlobalConfig) GetUserSharesPath(userName string) string
- func (cfg *GlobalConfig) GetUsers() (res []*UserConfig)
- func (cfg *GlobalConfig) Init()
- func (cfg *GlobalConfig) ReadConfigFile()
- func (cfg *GlobalConfig) RefreshUserRam()
- func (cfg *GlobalConfig) SetKey(k []byte)
- func (cfg *GlobalConfig) Update(u *UserConfig) error
- func (cfg *GlobalConfig) UpdateConfig(u *GlobalConfig)
- func (cfg *GlobalConfig) UpdatePassword(u *UserConfig) error
- func (cfg *GlobalConfig) UpdateUsers(users []*UserConfig) error
- func (cfg *GlobalConfig) Verify()
- func (cfg *GlobalConfig) WriteConfig()
- type ListenConf
- type PreviewConf
- type ShareItem
- type UserConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DavLogger func(r *http.Request, err error)
Functions ¶
func GenShareHash ¶ added in v0.8.3
Types ¶
type AllowedShare ¶
type AllowedShare struct {}
type CaptchaConfig ¶
type CaptchaConfig struct { Host string `json:"host"` Key string `json:"key"` Secret string `json:"secret"` }
func (*CaptchaConfig) CopyCaptchaConfig ¶
func (c *CaptchaConfig) CopyCaptchaConfig() *CaptchaConfig
type GlobalConfig ¶
type GlobalConfig struct { Users []*UserConfig `json:"users"` Http *ListenConf `json:"http"` Tls *ListenConf `json:"https"` Log string `json:"log"` TLSKey string `json:"tlsKey"` TLSCert string `json:"tlsCert"` // Scope is the Path the user has access to. FilesPath string `json:"filesPath"` *CaptchaConfig `json:"captchaConfig"` *Auth `json:"auth"` *PreviewConf `json:"preview"` ExternalShareHost string `json:"externalShareHost"` //Path to config file Path string `json:"-"` // contains filtered or unexported fields }
Single config for everything. update automatically
func (*GlobalConfig) Add ¶
func (cfg *GlobalConfig) Add(u *UserConfig) error
func (*GlobalConfig) CopyConfig ¶
func (cfg *GlobalConfig) CopyConfig() *GlobalConfig
func (*GlobalConfig) Delete ¶
func (cfg *GlobalConfig) Delete(username string) error
func (*GlobalConfig) DeleteShare ¶ added in v0.8.3
func (gc *GlobalConfig) DeleteShare(usr *UserConfig, p string) (res bool)
func (*GlobalConfig) GetAdmin ¶
func (cfg *GlobalConfig) GetAdmin() *UserConfig
func (*GlobalConfig) GetByIp ¶
func (cfg *GlobalConfig) GetByIp(ip string) (*UserConfig, bool)
func (*GlobalConfig) GetByUsername ¶
func (cfg *GlobalConfig) GetByUsername(username string) (*UserConfig, bool)
func (*GlobalConfig) GetDavPath ¶ added in v0.8.3
func (gc *GlobalConfig) GetDavPath(userName string) string
func (*GlobalConfig) GetExternal ¶ added in v0.8.3
func (gc *GlobalConfig) GetExternal(hash string) (res *ShareItem, usr *UserConfig)
since we sure that this method will not modify, just return original
func (*GlobalConfig) GetKeyBytes ¶
func (cfg *GlobalConfig) GetKeyBytes() ([]byte, error)
func (*GlobalConfig) GetSharePreviewPath ¶ added in v0.8.3
func (cfg *GlobalConfig) GetSharePreviewPath(url string) (res string)
func (*GlobalConfig) GetUserHomePath ¶ added in v0.1.8
func (cfg *GlobalConfig) GetUserHomePath(userName string) string
func (*GlobalConfig) GetUserPreviewPath ¶ added in v0.1.8
func (cfg *GlobalConfig) GetUserPreviewPath(userName string) string
func (*GlobalConfig) GetUserSharesPath ¶ added in v0.8.3
func (cfg *GlobalConfig) GetUserSharesPath(userName string) string
func (*GlobalConfig) GetUsers ¶
func (cfg *GlobalConfig) GetUsers() (res []*UserConfig)
func (*GlobalConfig) Init ¶ added in v0.1.4
func (cfg *GlobalConfig) Init()
func (*GlobalConfig) ReadConfigFile ¶
func (cfg *GlobalConfig) ReadConfigFile()
func (*GlobalConfig) RefreshUserRam ¶ added in v0.8.3
func (cfg *GlobalConfig) RefreshUserRam()
func (*GlobalConfig) SetKey ¶
func (cfg *GlobalConfig) SetKey(k []byte)
func (*GlobalConfig) Update ¶
func (cfg *GlobalConfig) Update(u *UserConfig) error
func (*GlobalConfig) UpdateConfig ¶
func (cfg *GlobalConfig) UpdateConfig(u *GlobalConfig)
func (*GlobalConfig) UpdatePassword ¶ added in v0.8.3
func (cfg *GlobalConfig) UpdatePassword(u *UserConfig) error
func (*GlobalConfig) UpdateUsers ¶
func (cfg *GlobalConfig) UpdateUsers(users []*UserConfig) error
func (*GlobalConfig) Verify ¶
func (cfg *GlobalConfig) Verify()
func (*GlobalConfig) WriteConfig ¶ added in v0.1.8
func (cfg *GlobalConfig) WriteConfig()
type ListenConf ¶ added in v0.8.3
type ListenConf struct { Port int `json:"port"` IP string `json:"ip"` // Define if which of the following authentication mechansims should be used: // - 'default', which requires a user and a password. // - 'proxy', which requires a valid user and the user name has to be provided through an // web header. // - 'none', which allows anyone to access the filebrowser instance. // If 'Method' is set to 'proxy' the header configured below is used to identify the user. AuthMethod string `json:"authMethod"` }
type PreviewConf ¶
type PreviewConf struct { //enable preview generating by call .sh ScriptPath string `json:"scriptPath"` Threads int `json:"threads"` FirstRun bool `json:"previewOnFirstRun"` }
Auth settings.
type ShareItem ¶
type ShareItem struct { bool `json:"allowExternal"` AllowLocal bool `json:"allowLocal"` AllowUsers []string `json:"allowedUsers"` Hash string `json:"-"` User string `json:"-"` }AllowExternal
presents 1 share Path in filesystem, and access rules
type UserConfig ¶
type UserConfig struct { FirstRun bool `json:"hashPasswordFirstRun"` // Tells if this user is an admin. Admin bool `json:"admin"` // These indicate if the user can perform certain actions. AllowEdit bool `json:"allowEdit"` // Edit/rename files AllowNew bool `json:"allowNew"` // Create files and folders // Prevents the user to change its password. LockPassword bool `json:"lockPassword"` // Locale is the language of the user. Locale string `json:"locale"` // The hashed password. This never reaches the front-end because it's temporarily // emptied during JSON marshall. Password string `json:"password"` // Username is the user username used to login. Username string `json:"username"` // User view mode for files and folders. ViewMode string `json:"viewMode"` //authenticate by IP, need to change auth.method IpAuth []string `json:"ipAuth"` DavHandler *webdav.Handler `json:"-"` //create files/folders according this ownership UID int `json:"uid"` GID int `json:"gid"` }
User contains the configuration for each user.
func (*UserConfig) AddShare ¶
func (u *UserConfig) AddShare(shr *ShareItem) (res bool)
func (*UserConfig) GetShares ¶ added in v0.8.3
func (u *UserConfig) GetShares(relPath string, del bool) (res []*ShareItem)
func (*UserConfig) IsGuest ¶ added in v0.8.3
func (u *UserConfig) IsGuest() bool
Click to show internal directories.
Click to hide internal directories.