Documentation
¶
Index ¶
- Variables
- func GetAllowedShares(user string, excludeSelf bool) (res map[string][]*AllowedShare)
- func GetShare(ru, su, reqPath string) (res *ShareItem, user *UserConfig)
- type AllowedShare
- type Auth
- type CaptchaConfig
- type GlobalConfig
- func (cfg *GlobalConfig) Add(u *UserConfig) error
- func (cfg *GlobalConfig) CopyConfig() (res *GlobalConfig)
- func (cfg *GlobalConfig) Delete(username string) error
- func (cfg *GlobalConfig) GetAdmin() *UserConfig
- func (cfg *GlobalConfig) GetByIp(ip string) (*UserConfig, bool)
- func (cfg *GlobalConfig) GetByUsername(username string) (*UserConfig, bool)
- func (cfg *GlobalConfig) GetKeyBytes() ([]byte, error)
- func (cfg *GlobalConfig) GetUsers() (res []*UserConfig)
- func (cfg *GlobalConfig) Init()
- func (cfg *GlobalConfig) ReadConfigFile(file string)
- func (cfg *GlobalConfig) SetKey(k []byte)
- func (cfg *GlobalConfig) SetupLog()
- func (cfg *GlobalConfig) StartMonitor()
- func (cfg *GlobalConfig) Store()
- func (cfg *GlobalConfig) Update(u *UserConfig) error
- func (cfg *GlobalConfig) UpdateConfig(u *GlobalConfig)
- func (cfg *GlobalConfig) UpdateUsers(users []*UserConfig) error
- func (cfg *GlobalConfig) Verify()
- type PreviewConf
- type ShareItem
- type UserConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var FileName = "browsefile.json"
Functions ¶
func GetAllowedShares ¶
func GetAllowedShares(user string, excludeSelf bool) (res map[string][]*AllowedShare)
filter out allowed shares, and returns modified path, starting with username
func GetShare ¶
func GetShare(ru, su, reqPath string) (res *ShareItem, user *UserConfig)
* ru is request user
Types ¶
type AllowedShare ¶
type AllowedShare struct {
}
type Auth ¶
type Auth struct {
// 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.
Method string `json:"method"`
// If 'Method' is set to 'proxy' the header configured below is used to identify the user.
Header string `json:"header"`
Key string `json:"key"`
}
Auth settings.
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"`
Port int `json:"port"`
IP string `json:"ip"`
Log string `json:"log"`
RefreshSeconds int `json:"configRamRefreshSeconds"`
TLSKey string `json:"tlsKey"`
TLSCert string `json:"tlsCert"`
*CaptchaConfig `json:"captchaConfig"`
*Auth `json:"auth"`
*PreviewConf `json:"preview"`
// 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() (res *GlobalConfig)
func (*GlobalConfig) Delete ¶
func (cfg *GlobalConfig) Delete(username string) error
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) GetKeyBytes ¶
func (cfg *GlobalConfig) GetKeyBytes() ([]byte, error)
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(file string)
func (*GlobalConfig) SetKey ¶
func (cfg *GlobalConfig) SetKey(k []byte)
func (*GlobalConfig) SetupLog ¶
func (cfg *GlobalConfig) SetupLog()
func (*GlobalConfig) StartMonitor ¶
func (cfg *GlobalConfig) StartMonitor()
func (*GlobalConfig) Update ¶
func (cfg *GlobalConfig) Update(u *UserConfig) error
func (*GlobalConfig) UpdateConfig ¶
func (cfg *GlobalConfig) UpdateConfig(u *GlobalConfig)
func (*GlobalConfig) UpdateUsers ¶
func (cfg *GlobalConfig) UpdateUsers(users []*UserConfig) error
func (*GlobalConfig) Verify ¶
func (cfg *GlobalConfig) Verify()
type PreviewConf ¶
type PreviewConf struct {
//enable preview generating by call .sh
AllowGeneratePreview bool `json:"allowGeneratePreview"`
Threads int `json:"threads"`
FirstRun bool `json:"firstRun"`
}
Auth settings.
type ShareItem ¶
type ShareItem struct {
AllowExternal bool `json:"allowExternal"`
AllowLocal bool `json:"allowLocal"`
AllowUsers []string `json:"allowedUsers"`
}
presents 1 share path in filesystem, and access rules
type UserConfig ¶
type UserConfig struct {
FirstRun bool `json:"firstRun"`
// 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"`
// Scope is the path the user has access to.
Scope string `json:"homePath"`
// Username is the user username used to login.
Username string `json:"username" storm:"index,unique"`
// User view mode for files and folders.
ViewMode string `json:"viewMode"`
// system path to store user's image/video previews
PreviewScope string `json:"previewPath"`
//authenticate by IP, need to change auth.method
IpAuth []string `json:"ipAuth"`
//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) DeleteShare ¶
func (u *UserConfig) DeleteShare(relPath string) (res bool)
func (*UserConfig) GetShare ¶
func (u *UserConfig) GetShare(relPath string) (res *ShareItem)
Click to show internal directories.
Click to hide internal directories.