filebrowser/backend/settings/structs.go

90 lines
3.3 KiB
Go
Raw Normal View History

2023-08-05 12:32:43 +00:00
package settings
import (
"github.com/gtsteffaniak/filebrowser/rules"
"github.com/gtsteffaniak/filebrowser/users"
)
type Settings struct {
Commands map[string][]string `json:"commands"`
Shell []string `json:"shell"`
Rules []rules.Rule `json:"rules"`
Server Server `json:"server"`
Auth Auth `json:"auth"`
Frontend Frontend `json:"frontend"`
Users []UserDefaults `json:"users,omitempty"`
UserDefaults UserDefaults `json:"userDefaults"`
2023-08-05 12:32:43 +00:00
}
2023-09-01 14:00:02 +00:00
type Auth struct {
TokenExpirationTime string `json:"tokenExpirationTime"`
Recaptcha Recaptcha `json:"recaptcha"`
Header string `json:"header"`
Method string `json:"method"`
Command string `json:"command"`
Signup bool `json:"signup"`
Shell string `json:"shell"`
AdminUsername string `json:"adminUsername"`
AdminPassword string `json:"adminPassword"`
Key []byte `json:"key"`
2023-09-01 14:00:02 +00:00
}
type Recaptcha struct {
2023-09-02 15:52:34 +00:00
Host string `json:"host"`
Key string `json:"key"`
Secret string `json:"secret"`
2023-09-01 14:00:02 +00:00
}
2023-08-05 12:32:43 +00:00
type Server struct {
2023-09-02 00:51:13 +00:00
IndexingInterval uint32 `json:"indexingInterval"`
NumImageProcessors int `json:"numImageProcessors"`
2023-08-05 12:32:43 +00:00
Socket string `json:"socket"`
TLSKey string `json:"tlsKey"`
TLSCert string `json:"tlsCert"`
EnableThumbnails bool `json:"enableThumbnails"`
ResizePreview bool `json:"resizePreview"`
EnableExec bool `json:"enableExec"`
TypeDetectionByHeader bool `json:"typeDetectionByHeader"`
AuthHook string `json:"authHook"`
2023-09-02 00:51:13 +00:00
Port int `json:"port"`
2023-08-05 12:32:43 +00:00
BaseURL string `json:"baseURL"`
Address string `json:"address"`
Log string `json:"log"`
Database string `json:"database"`
Root string `json:"root"`
UserHomeBasePath string `json:"userHomeBasePath"`
CreateUserDir bool `json:"createUserDir"`
2024-07-30 17:45:27 +00:00
Indexing bool `json:"indexing"`
2023-08-05 12:32:43 +00:00
}
2023-09-01 14:00:02 +00:00
type Frontend struct {
2023-08-05 12:32:43 +00:00
Name string `json:"name"`
DisableExternal bool `json:"disableExternal"`
DisableUsedPercentage bool `json:"disableUsedPercentage"`
Files string `json:"files"`
Color string `json:"color"`
}
// UserDefaults is a type that holds the default values
// for some fields on User.
type UserDefaults struct {
2024-08-03 15:34:12 +00:00
StickySidebar bool `json:"stickySidebar"`
DarkMode bool `json:"darkMode"`
2023-09-24 18:57:11 +00:00
LockPassword bool `json:"lockPassword"`
DisableSettings bool `json:"disableSettings,omitempty"`
Scope string `json:"scope"`
Locale string `json:"locale"`
ViewMode string `json:"viewMode"`
SingleClick bool `json:"singleClick"`
Rules []rules.Rule `json:"rules"`
Sorting struct {
2023-09-02 15:52:34 +00:00
By string `json:"by"`
Asc bool `json:"asc"`
} `json:"sorting"`
2023-09-03 22:09:38 +00:00
Perm users.Permissions `json:"perm"`
2023-09-03 22:16:49 +00:00
Permissions users.Permissions `json:"permissions"`
2023-09-25 01:03:09 +00:00
Commands []string `json:"commands,omitempty"`
2023-09-03 22:09:38 +00:00
HideDotfiles bool `json:"hideDotfiles"`
DateFormat bool `json:"dateFormat"`
2023-08-05 12:32:43 +00:00
}