v2.26.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 14 Imported by: 1




View Source
const DefaultTusChunkSize = 10 * 1024 * 1024 // 10MB
View Source
const DefaultTusRetryCount = 5
View Source
const DefaultUsersHomeBasePath = "/users"


This section is empty.


func GenerateKey

func GenerateKey() ([]byte, error)

GenerateKey generates a key of 512 bits.


type AuthMethod

type AuthMethod string

AuthMethod describes an authentication method.

type Branding

type Branding struct {
	Name                  string `json:"name"`
	DisableExternal       bool   `json:"disableExternal"`
	DisableUsedPercentage bool   `json:"disableUsedPercentage"`
	Files                 string `json:"files"`
	Theme                 string `json:"theme"`
	Color                 string `json:"color"`

Branding contains the branding settings of the app.

type Server

type Server struct {
	Root                  string `json:"root"`
	BaseURL               string `json:"baseURL"`
	Socket                string `json:"socket"`
	TLSKey                string `json:"tlsKey"`
	TLSCert               string `json:"tlsCert"`
	Port                  string `json:"port"`
	Address               string `json:"address"`
	Log                   string `json:"log"`
	EnableThumbnails      bool   `json:"enableThumbnails"`
	ResizePreview         bool   `json:"resizePreview"`
	EnableExec            bool   `json:"enableExec"`
	TypeDetectionByHeader bool   `json:"typeDetectionByHeader"`
	AuthHook              string `json:"authHook"`
	TokenExpirationTime   string `json:"tokenExpirationTime"`

Server specific settings.

func (*Server) Clean

func (s *Server) Clean()

Clean cleans any variables that might need cleaning.

func (*Server) GetTokenExpirationTime added in v2.26.0

func (s *Server) GetTokenExpirationTime(fallback time.Duration) time.Duration

type Settings

type Settings struct {
	Key              []byte              `json:"key"`
	Signup           bool                `json:"signup"`
	CreateUserDir    bool                `json:"createUserDir"`
	UserHomeBasePath string              `json:"userHomeBasePath"`
	Defaults         UserDefaults        `json:"defaults"`
	AuthMethod       AuthMethod          `json:"authMethod"`
	Branding         Branding            `json:"branding"`
	Tus              Tus                 `json:"tus"`
	Commands         map[string][]string `json:"commands"`
	Shell            []string            `json:"shell"`
	Rules            []rules.Rule        `json:"rules"`

Settings contain the main settings of the application.

func (*Settings) GetRules

func (s *Settings) GetRules() []rules.Rule

GetRules implements rules.Provider.

func (*Settings) MakeUserDir added in v2.0.4

func (s *Settings) MakeUserDir(username, userScope, serverRoot string) (string, error)

MakeUserDir makes the user directory according to settings.

type Storage

type Storage struct {
	// contains filtered or unexported fields

Storage is a settings storage.

func NewStorage

func NewStorage(back StorageBackend) *Storage

NewStorage creates a settings storage from a backend.

func (*Storage) Get

func (s *Storage) Get() (*Settings, error)

Get returns the settings for the current instance.

func (*Storage) GetServer

func (s *Storage) GetServer() (*Server, error)

GetServer wraps StorageBackend.GetServer.

func (*Storage) Save

func (s *Storage) Save(set *Settings) error

Save saves the settings for the current instance.

func (*Storage) SaveServer

func (s *Storage) SaveServer(ser *Server) error

SaveServer wraps StorageBackend.SaveServer and adds some verification.

type StorageBackend

type StorageBackend interface {
	Get() (*Settings, error)
	Save(*Settings) error
	GetServer() (*Server, error)
	SaveServer(*Server) error

StorageBackend is a settings storage backend.

type Tus added in v2.24.0

type Tus struct {
	ChunkSize  uint64 `json:"chunkSize"`
	RetryCount uint16 `json:"retryCount"`

Tus contains the settings of the app.

type UserDefaults

type UserDefaults struct {
	Scope        string            `json:"scope"`
	Locale       string            `json:"locale"`
	ViewMode     users.ViewMode    `json:"viewMode"`
	SingleClick  bool              `json:"singleClick"`
	Sorting      files.Sorting     `json:"sorting"`
	Perm         users.Permissions `json:"perm"`
	Commands     []string          `json:"commands"`
	HideDotfiles bool              `json:"hideDotfiles"`
	DateFormat   bool              `json:"dateFormat"`

UserDefaults is a type that holds the default values for some fields on User.

func (*UserDefaults) Apply

func (d *UserDefaults) Apply(u *users.User)

Apply applies the default options to a user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL