elfinder

package module
v0.0.143 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVERSION    = 2.1050
	UPLOADMAXSIZE = "10M"
)

Variables

View Source
var DefaultVolume = LocalFileVolume{Id: GenerateID(rootPath), /* contains filtered or unexported fields */}

Functions

func CreateHash

func CreateHash(volumeId, path string) string

func Decode64

func Decode64(s string) (string, error)

func Encode64

func Encode64(s string) string

func GenerateID

func GenerateID(path string) string

func GenerateTargetsMD5Key

func GenerateTargetsMD5Key(targets ...string) string

func ReadWritePem

func ReadWritePem(pem os.FileMode) (readable, writable byte)

Types

type ChunkRange

type ChunkRange struct {
	Offset    int64
	Length    int64
	TotalSize int64
}

type ELFRequest

type ELFRequest struct {
	Cmd        string   `form:"cmd"`
	Init       bool     `form:"init"`
	Tree       bool     `form:"tree"`
	Name       string   `form:"name"`
	Target     string   `form:"target"`
	Targets    []string `form:"targets[]"`
	Dirs       []string `form:"dirs[]"`
	Mode       string   `form:"mode"`
	Bg         string   `form:"bg"`
	Width      int      `form:"width"`
	Height     int      `form:"height"`
	X          int      `form:"x"`
	Y          int      `form:"y"`
	Degree     int      `form:"degree"`
	Quality    int      `form:"quality"`
	Renames    []string `form:"renames[]"`
	Suffix     string   `form:"suffix"`
	Intersect  []string `form:"intersect[]"`
	Chunk      string   `form:"chunk"`
	UploadPath []string `form:"upload_path[]"`
	Cid        int      `form:"cid"`
	Content    string   `form:"content"`
	Dst        string   `form:"dst"`
	Src        string   `form:"src"`
	Cut        bool     `form:"cut"`
	Type       string   `form:"type"`
	MakeDir    bool     `form:"makedir"`
	Range      string   `form:"range"`
	Download   string   `form:"download"`
	QueryKey   string   `form:"q"`
	Mimes      []string `form:"mimes[]"`
}

type ElFinderConnector

type ElFinderConnector struct {
	Volumes map[string]Volume
	// contains filtered or unexported fields
}

func NewElFinderConnector

func NewElFinderConnector(vs Volumes) *ElFinderConnector

func NewElFinderConnectorWithOption

func NewElFinderConnectorWithOption(vs Volumes, option map[string]string) *ElFinderConnector

func (*ElFinderConnector) ServeHTTP

func (elf *ElFinderConnector) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type ElfResponse

type ElfResponse struct {
	Api        float64   `json:"api,omitempty"`        // The version number of the protocol, must be >= 2.1, ATTENTION - return api ONLY for init request!
	Cwd        FileDir   `json:"cwd,omitempty"`        // Current Working Directory - information about the current directory. Information about File/Directory
	Files      []FileDir `json:"files"`                // array of objects - files and directories in current directory. If parameter tree == true, then added to the folder of the directory tree to a given depth. The order of files is not important. Note you must include the top-level volume objects here as well (i.e. cwd is repeated here, in addition to other volumes)
	NetDrivers []string  `json:"netDrivers,omitempty"` // Network protocols list which can be mounted on the fly (using netmount command). Now only ftp supported.
	Options    options   `json:"options,omitempty"`
	UplMaxFile string    `json:"uplMaxFile,omitempty"` // Allowed upload max number of file per request. For example 20
	UplMaxSize string    `json:"uplMaxSize,omitempty"` // Allowed upload max size per request. For example "32M"

	Tree []FileDir `json:"tree"` // for tree

	Dim string `json:"dim,omitempty"` // for images

	Added   []FileDir         `json:"added"`             // for upload, mkdir, rename
	Warning []string          `json:"warning,omitempty"` // for upload
	Changed []FileDir         `json:"changed,omitempty"` // for mkdir
	Hashes  map[string]string `json:"hashes,omitempty"`  // for mkdir
	List    []string          `json:"list,omitempty"`    // for ls
	Size    int64             `json:"size,omitempty"`    // for size
	Zipdl   map[string]string `json:"zipdl,omitempty"`   // zipdl

	Name        string `json:"_name,omitempty"`
	Chunkmerged string `json:"_chunkmerged,omitempty"`

	Removed []string `json:"removed,omitempty"` // for remove, rename

	Images map[string]string `json:"images,omitempty"` // for tmb

	Content string `json:"content,omitempty"` // for get

	Url string `json:"url,omitempty"` // for url

	Error interface{} `json:"error,omitempty"`
}

type FileDir

type FileDir struct {
	Name     string                 `json:"name,omitempty"`  // name of file/dir. Required
	Hash     string                 `json:"hash,omitempty"`  //  hash of current file/dir path, first symbol must be letter, symbols before _underline_ - volume id, Required.
	Phash    string                 `json:"phash,omitempty"` // hash of parent directory. Required except roots dirs.
	Mime     string                 `json:"mime,omitempty"`  // mime type. Required.
	Ts       int64                  `json:"ts,omitempty"`    // file modification time in unix timestamp. Required.
	Size     int64                  `json:"size,omitempty"`  // file size in bytes
	Dirs     byte                   `json:"dirs,omitempty"`  // Only for directories. Marks if directory has child directories inside it. 0 (or not set) - no, 1 - yes. Do not need to calculate amount.
	Read     byte                   `json:"read,omitempty"`  // is readable
	Write    byte                   `json:"write,omitempty"` // is writable
	Isroot   byte                   `json:"isroot,omitempty"`
	Locked   byte                   `json:"locked,omitempty"`   // is file locked. If locked that object cannot be deleted, renamed or moved
	Tmb      string                 `json:"tmb,omitempty"`      // Only for images. Thumbnail file name, if file do not have thumbnail yet, but it can be generated than it must have value "1"
	Alias    string                 `json:"alias,omitempty"`    // For symlinks only. Symlink target path.
	Thash    string                 `json:"thash,omitempty"`    // For symlinks only. Symlink target hash.
	Dim      string                 `json:"dim,omitempty"`      // For images - file dimensions. Optionally.
	Isowner  bool                   `json:"isowner,omitempty"`  // has ownership. Optionally.
	Cssclr   string                 `json:"cssclr,omitempty"`   // CSS class name for holder icon. Optionally. It can include to options.
	Volumeid string                 `json:"volumeid,omitempty"` // Volume id. For directory only. It can include to options.
	Netkey   string                 `json:"netkey,omitempty"`   // Netmount volume unique key, Required for netmount volume. It can include to options.
	Options  options                `json:"options,omitempty"`  // For volume root only. This value is same to cwd.options.
	Debug    map[string]interface{} `json:"debug,omitempty"`    // For volume root only. This value is same to cwd.options.
}

type LocalFileVolume

type LocalFileVolume struct {
	Id string
	// contains filtered or unexported fields
}

func NewLocalVolume

func NewLocalVolume(path string) *LocalFileVolume

func (*LocalFileVolume) GetFile

func (f *LocalFileVolume) GetFile(path string) (reader io.ReadCloser, err error)

func (*LocalFileVolume) ID

func (f *LocalFileVolume) ID() string

func (*LocalFileVolume) Info

func (f *LocalFileVolume) Info(path string) (FileDir, error)

func (*LocalFileVolume) List

func (f *LocalFileVolume) List(path string) []FileDir

func (*LocalFileVolume) MakeDir

func (f *LocalFileVolume) MakeDir(dir, newDirname string) (FileDir, error)

func (*LocalFileVolume) MakeFile

func (f *LocalFileVolume) MakeFile(dir, newFilename string) (FileDir, error)

func (*LocalFileVolume) MergeChunk

func (f *LocalFileVolume) MergeChunk(cid, total int, dirPath, uploadPath, filename string) (FileDir, error)

func (*LocalFileVolume) Parents

func (f *LocalFileVolume) Parents(path string, dep int) []FileDir

func (*LocalFileVolume) Paste

func (f *LocalFileVolume) Paste(dir, filename, suffix string, reader io.ReadCloser) (FileDir, error)

func (*LocalFileVolume) Remove

func (f *LocalFileVolume) Remove(path string) error

func (*LocalFileVolume) Rename

func (f *LocalFileVolume) Rename(oldNamePath, newName string) (FileDir, error)

func (*LocalFileVolume) RootFileDir

func (f *LocalFileVolume) RootFileDir() FileDir

func (*LocalFileVolume) Search

func (f *LocalFileVolume) Search(path, key string, mimes ...string) (files []FileDir, err error)

func (*LocalFileVolume) UploadChunk

func (f *LocalFileVolume) UploadChunk(cid int, dirPath, uploadPath, filename string, rangeData ChunkRange, reader io.Reader) error

func (*LocalFileVolume) UploadFile

func (f *LocalFileVolume) UploadFile(dirPath, uploadPath, filename string, reader io.Reader) (FileDir, error)

type Volume

type Volume interface {
	ID() string
	Info(path string) (FileDir, error)
	List(path string) []FileDir
	Parents(path string, dep int) []FileDir
	GetFile(path string) (reader io.ReadCloser, err error)
	UploadFile(dir, uploadPath, filename string, reader io.Reader) (FileDir, error)
	UploadChunk(cid int, dirPath, uploadPath, filename string, rangeData ChunkRange, reader io.Reader) error
	MergeChunk(cid, total int, dirPath, uploadPath, filename string) (FileDir, error)
	MakeDir(dir, newDirname string) (FileDir, error)
	MakeFile(dir, newFilename string) (FileDir, error)
	Rename(oldNamePath, newname string) (FileDir, error)
	Remove(path string) error
	Paste(dir, filename, suffix string, reader io.ReadCloser) (FileDir, error)
	RootFileDir() FileDir
	Search(path, key string, mimes ...string) ([]FileDir, error)
}

type Volumes

type Volumes []Volume

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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