filebrowser/backend/settings/structs.go

168 lines
5.8 KiB
Go
Raw Permalink Normal View History

2023-08-05 12:32:43 +00:00
package settings
import (
2024-12-17 00:01:55 +00:00
"github.com/gtsteffaniak/filebrowser/backend/users"
2023-08-05 12:32:43 +00:00
)
2025-01-31 20:26:21 +00:00
type AllowedMethods string
const (
ProxyAuth AllowedMethods = "proxyAuth"
NoAuth AllowedMethods = "noAuth"
PasswordAuth AllowedMethods = "passwordAuth"
)
2023-08-05 12:32:43 +00:00
type Settings struct {
Commands map[string][]string `json:"commands"`
Shell []string `json:"shell"`
2024-11-21 00:15:30 +00:00
Rules []users.Rule `json:"rules"`
Server Server `json:"server"`
Auth Auth `json:"auth"`
Frontend Frontend `json:"frontend"`
Users []UserDefaults `json:"users,omitempty"`
UserDefaults UserDefaults `json:"userDefaults"`
2025-01-21 14:02:43 +00:00
Integrations Integrations `json:"integrations"`
2023-08-05 12:32:43 +00:00
}
2023-09-01 14:00:02 +00:00
type Auth struct {
2025-01-31 20:26:21 +00:00
TokenExpirationHours int `json:"tokenExpirationHours"`
Recaptcha Recaptcha `json:"recaptcha"`
Methods LoginMethods `json:"methods"`
Command string `json:"command"`
Signup bool `json:"signup"`
Method string `json:"method"`
Shell string `json:"shell"`
Key []byte `json:"key"`
AdminUsername string `json:"adminUsername"`
AdminPassword string `json:"adminPassword"`
}
type LoginMethods struct {
2025-02-01 13:10:46 +00:00
ProxyAuth ProxyAuthConfig `json:"proxy"`
NoAuth bool `json:"noauth"`
PasswordAuth PasswordAuthConfig `json:"password"`
}
type PasswordAuthConfig struct {
Enabled bool `json:"enabled"`
MinLength int `json:"minLength"`
2025-01-31 20:26:21 +00:00
}
type ProxyAuthConfig struct {
Enabled bool `json:"enabled"`
CreateUser bool `json:"createUser"`
Header string `json:"header"`
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 {
2025-01-27 00:21:12 +00:00
NumImageProcessors int `json:"numImageProcessors"`
Socket string `json:"socket"`
TLSKey string `json:"tlsKey"`
TLSCert string `json:"tlsCert"`
EnableThumbnails bool `json:"enableThumbnails"`
ResizePreview bool `json:"resizePreview"`
EnableExec bool `json:"enableExec"`
AuthHook string `json:"authHook"`
Port int `json:"port"`
BaseURL string `json:"baseURL"`
Logging []LogConfig `json:"logging"`
Database string `json:"database"`
Root string `json:"root"`
UserHomeBasePath string `json:"userHomeBasePath"`
CreateUserDir bool `json:"createUserDir"`
Sources []Source `json:"sources"`
ExternalUrl string `json:"externalUrl"`
InternalUrl string `json:"internalUrl"` // used by integrations
2025-01-31 20:26:21 +00:00
CacheDir string `json:"cacheDir"`
2025-01-21 14:02:43 +00:00
}
type Integrations struct {
OnlyOffice OnlyOffice `json:"office"`
}
// onlyoffice secret is stored in the local.json file
// docker exec <containerID> /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
type OnlyOffice struct {
Url string `json:"url"`
Secret string `json:"secret"`
}
type LogConfig struct {
Levels string `json:"levels"`
ApiLevels string `json:"apiLevels"`
Output string `json:"output"`
NoColors bool `json:"noColors"`
Json bool `json:"json"`
2025-01-05 19:05:33 +00:00
}
type Source struct {
2025-01-26 00:31:40 +00:00
Path string `json:"path"`
Name string `json:"name"`
2025-01-05 19:05:33 +00:00
Config IndexConfig `json:"config"`
}
type IndexConfig struct {
IndexingInterval uint32 `json:"indexingInterval"`
Disabled bool `json:"disabled"`
MaxWatchers int `json:"maxWatchers"`
NeverWatch []string `json:"neverWatchPaths"`
IgnoreHidden bool `json:"ignoreHidden"`
IgnoreZeroSizeFolders bool `json:"ignoreZeroSizeFolders"`
Exclude IndexFilter `json:"exclude"`
Include IndexFilter `json:"include"`
}
type IndexFilter struct {
Files []string `json:"files"`
Folders []string `json:"folders"`
FileEndsWith []string `json:"fileEndsWith"`
2023-08-05 12:32:43 +00:00
}
2023-09-01 14:00:02 +00:00
type Frontend struct {
2025-01-05 19:05:33 +00:00
Name string `json:"name"`
DisableDefaultLinks bool `json:"disableDefaultLinks"`
DisableUsedPercentage bool `json:"disableUsedPercentage"`
Files string `json:"files"`
Color string `json:"color"`
ExternalLinks []ExternalLink `json:"externalLinks"`
}
type ExternalLink struct {
Text string `json:"text"`
Title string `json:"title"`
Url string `json:"url"`
2023-08-05 12:32:43 +00:00
}
// 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"`
2024-08-24 22:02:33 +00:00
GallerySize int `json:"gallerySize"`
2023-09-24 18:57:11 +00:00
SingleClick bool `json:"singleClick"`
2024-11-21 00:15:30 +00:00
Rules []users.Rule `json:"rules"`
2023-09-24 18:57:11 +00:00
Sorting struct {
2023-09-02 15:52:34 +00:00
By string `json:"by"`
Asc bool `json:"asc"`
} `json:"sorting"`
2025-02-16 14:07:38 +00:00
Perm users.Permissions `json:"perm"`
Permissions users.Permissions `json:"permissions"`
Commands []string `json:"commands,omitempty"`
ShowHidden bool `json:"showHidden"`
DateFormat bool `json:"dateFormat"`
ThemeColor string `json:"themeColor"`
QuickDownload bool `json:"quickDownload"`
DisableOnlyOfficeExt string `json:"disableOnlyOfficeExt"`
2023-08-05 12:32:43 +00:00
}