web_api

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ChecksumMd5    = "md5"
	ChecksumSha1   = "sha1"
	ChecksumSha256 = "sha256"
	ChecksumSha512 = "sha512"
)
View Source
const (
	ShareUnitDays    = "days"
	ShareUnitHours   = "hours"
	ShareUnitMinutes = "minutes"
	ShareUnitSeconds = "seconds"
)
View Source
const (
	AuthHeadKey = "X-Auth"
)
View Source
const (
	SharePasswordHeadKey = "X-SHARE-PASSWORD"
)

Variables

This section is empty.

Functions

func ApiBase

func ApiBase() string

func ApiLogin

func ApiLogin() string

func ApiPublic

func ApiPublic() string

func ApiPublicDL

func ApiPublicDL() string

ApiPublicDL to download file for share if share file has password can use file_browser_client.SharesGet by password add token

func ApiRaw

func ApiRaw() string

func ApiResources

func ApiResources() string

func ApiShare

func ApiShare() string

func ApiShares

func ApiShares() string

func BaseUrl

func BaseUrl() string

func CheckFalseShareConfig

func CheckFalseShareConfig(config ShareConfig) bool

CheckFalseShareConfig config pass will return false

func ChecksumsDefine

func ChecksumsDefine() []string

func SetApiBase

func SetApiBase(baseUrl string)

func ShareUnitDefine

func ShareUnitDefine() []string

func ShareUrlBase

func ShareUrlBase() string

Types

type FileInfo

type FileInfo struct {
	// at file browser path
	Path string `json:"path"`
	// Name file name
	Name string `json:"name"`
	// unit byte
	Size int64 `json:"size"`
	// Extension name of extension
	Extension string `json:"extension"`
	// Modified time utc string
	Modified string `json:"modified"`
	//
	Mode os.FileMode `json:"mode"`
	// Type [ blob text ] text will send content
	Type      string   `json:"type"`
	Subtitles []string `json:"subtitles,omitempty"`
	Content   string   `json:"content,omitempty"`
	// Checksums
	// key will be [ md5 sha1 sha256 sha512 ]
	Checksums map[string]string `json:"checksums,omitempty"`
	Token     string            `json:"token,omitempty"`
}

type LoginRequest

type LoginRequest struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	Recaptcha string `json:"recaptcha"`
}

type Resources

type Resources struct {
	Sorting ResourcesSorting `json:"sorting"`
	// IsDir true item Items NumDirs NumFiles
	// false no Items NumDirs NumFiles
	IsDir     bool       `json:"isDir"`
	IsSymlink bool       `json:"isSymlink"`
	Items     []FileInfo `json:"items"`
	NumDirs   int        `json:"numDirs"`
	NumFiles  int        `json:"numFiles"`
	// at file browser path
	Path string `json:"path"`
	// Name file name
	Name string `json:"name"`
	// unit byte
	Size int64 `json:"size"`
	// Extension name of extension
	Extension string `json:"extension"`
	// Modified time utc string
	Modified string `json:"modified"`
	//
	Mode os.FileMode `json:"mode"`
	// Type [ blob text ] text will send content
	Type      string   `json:"type"`
	Subtitles []string `json:"subtitles,omitempty"`
	Content   string   `json:"content,omitempty"`
	// Checksums
	// key will be [ md5 sha1 sha256 sha512 ]
	Checksums map[string]string `json:"checksums,omitempty"`
	Token     string            `json:"token,omitempty"`
}

type ResourcesSorting

type ResourcesSorting struct {
	By  string `json:"by"`
	Asc bool   `json:"asc"`
}

type ShareConfig

type ShareConfig struct {
	Password string `json:"password,omitempty"`
	Expires  string `json:"expires,omitempty"`
	Unit     string `json:"unit,omitempty"`
}

ShareConfig @doc https://github.com/filebrowser/filebrowser/blob/master/share/share.go

type ShareLink struct {
	// Hash
	// share hash
	Hash string `json:"hash" storm:"id,index"`
	// Path
	// this path start / , is filebrowser user root start.
	Path   string `json:"path" storm:"index"`
	UserID uint   `json:"userID"`
	// Expire
	// time of expire is utc seconds
	Expire int64 `json:"expire"`
	// PasswordHash
	// password hash
	PasswordHash string `json:"password_hash,omitempty"`
	// Token is a random value that will only be set when PasswordHash is set. It is
	// URL-Safe and is used to download links in password-protected shares via a
	// query arg.
	Token string `json:"token,omitempty"`
}

ShareLink Link is the information needed to build a shareable link.

Jump to

Keyboard shortcuts

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