handlers

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// dirs
	UploadDir = "uploadings"
	FsDir     = "files"
	FsRootDir = "files"

	UserIDParam    = "uid"
	UserParam      = "user"
	PwdParam       = "pwd"
	NewPwdParam    = "newpwd"
	RoleParam      = "role"
	ExpireParam    = "expire"
	CaptchaIDParam = "capid"
	TokenCookie    = "tk"
	LastID         = "lid"

	// DownloadChunkSize can not be greater than limiter's token count
	// downloadSpeedLimit can not be lower than DownloadChunkSize
	DownloadChunkSize = 100 * 1024

	ErrAccessDenied = errors.New("access denied")
	ErrUnauthorized = errors.New("unauthorized")
)

Functions

func CheckStatusCode added in v0.10.4

func CheckStatusCode(code int)

Check if the status code is valid, panic if not.

func ErrResp

func ErrResp(c *gin.Context, code int, err error) (int, interface{})

func FsRootPath

func FsRootPath(userName, relFilePath string) string

func GetUserId added in v0.10.1

func GetUserId(ctx *gin.Context) (uint64, error)

func GetUserInfo

func GetUserInfo(tokenStr string, tokenEncDec cryptoutil.ITokenEncDec) (map[string]string, error)

func NewMsgResp

func NewMsgResp(code int, msg string) (int, interface{})

func Resp

func Resp(code int) (int, interface{})

func UploadFolder

func UploadFolder(userName string) string

func UploadPath

func UploadPath(userName, relFilePath string) string

Types

type MsgResp

type MsgResp struct {
	Msg string `json:"msg"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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