Documentation ¶
Index ¶
- Constants
- func CreateRootDirIfNot(ctx *gin.Context, client *ent.Client) (*ent.Dirs, error)
- func ErrorBadRequest(c *gin.Context, message string)
- func ErrorConflict(c *gin.Context, message string)
- func ErrorInternalServerError(c *gin.Context)
- func ErrorJSONResponse(c *gin.Context, status int, message string)
- func ErrorNoPermission(c *gin.Context, message string)
- func ErrorNotFound(c *gin.Context, message string)
- func ErrorUnauthorized(c *gin.Context, message string)
- func GetDeviceID(ctx *gin.Context) string
- func GetUserID(ctx *gin.Context) uint64
- func IPFSAddr() string
- func JWTIssues() string
- func JWTSecret() string
- func QueryFileByHash(ctx *gin.Context, client *ent.Client, hash string) (*ent.Files, error)
- func QueryUserDirByID(ctx *gin.Context, client *ent.Client, id uint64) (*ent.Dirs, error)
- func QueryUserSavedByFileID(ctx *gin.Context, client *ent.Client, id uint64) (*ent.Saves, error)
- func RedisAddr() string
- func RedisPassword() string
- func Success(c *gin.Context, resp any)
- type AddFileResponse
- type AddSavedForm
- type Client
- type CreateSavesQuery
- type CreateUserForm
- type DelSavedParams
- type Device
- type DevicesServer
- type Dir
- type DirServer
- type EditSavedParams
- type ErrorResponse
- type File
- type GetSavedParams
- type IPFSServer
- type LinkDirForm
- type LinkDirParams
- type ListDirQuery
- type Localhost
- type LoginForm
- type MKDirForm
- type MKDirQuery
- type MVDirParams
- type RMDirParams
- type RenameDirParams
- type Saved
- type SavedServer
- type Server
- func (s *Server) CreateSaves() error
- func (s *Server) CreateUser() error
- func (s *Server) DelSaved() error
- func (s *Server) DeleteDevice() error
- func (s *Server) EditSaved() error
- func (s *Server) GetDevices() error
- func (s *Server) GetSaved() error
- func (s *Server) GetSaves() error
- func (s *Server) IPFSAddFiles() error
- func (s *Server) LinkDir() error
- func (s *Server) ListDir() error
- func (s *Server) ListDirs() error
- func (s *Server) Login() error
- func (s *Server) MKDir() error
- func (s *Server) MVDir() error
- func (s *Server) RMDir() error
- func (s *Server) RenameDir() error
- func (s *Server) UnlinkDir() error
- func (s *Server) ValidateJWT() error
- type Subdir
- type UnlinkDirParams
- type UsersServer
- type Web3Storage
Constants ¶
View Source
const ( DefaultRedisAddr = "localhost:6379" DefaultRedisPassword = "" )
View Source
const ( DefaultRootDirName = "root" InvalidDirName = "Invalid dir name" DirExists = "Dir is exists" DisableRootDirCreation = "Root dir creation is not allowed" DisableRootDirRenaming = "Root dir renaming is not allowed" DisableRootDirDeletion = "Disable root dir deletion" )
View Source
const ( InternalServerError = "InternalServerError" NoPermission = "no permission" )
View Source
const ( DirAlreadyLinked = "dir already linked" DirNotLinked = "dir not linked" )
View Source
const ( UsernameAlreadyExists = "Username already exists" UserDoesNotExist = "User does not exist" PasswordVerificationFailed = "Password verification failed" )
View Source
const ( NoAuthorizationHeader = "no authorization header" TokenAuthenticationFailure = "token authentication failure" TokenInvalid = "invalid authorization" )
View Source
const ( ContextUserIDKEY = "UserID" ContextDeviceIDKEY = "DeviceID" )
View Source
const (
DeviceNotFound = "device not found"
)
Variables ¶
This section is empty.
Functions ¶
func CreateRootDirIfNot ¶
func ErrorBadRequest ¶
func ErrorConflict ¶
func ErrorNoPermission ¶
func ErrorNotFound ¶
func ErrorUnauthorized ¶
func GetDeviceID ¶
func QueryFileByHash ¶
func QueryUserDirByID ¶
func QueryUserSavedByFileID ¶
func RedisPassword ¶
func RedisPassword() string
Types ¶
type AddFileResponse ¶
type AddSavedForm ¶
type CreateSavesQuery ¶
type CreateSavesQuery struct {
DirID uint64 `form:"dir_id" json:"dir_id" binding:"numeric"`
}
type CreateUserForm ¶
type CreateUserForm struct { Username string `form:"username" json:"username" binding:"required,min=4,max=32"` Password string `form:"password" json:"password" binding:"required,min=6,max=32"` }
CreateUserForm create user form.
type DelSavedParams ¶
type DelSavedParams struct {
ID uint64 `uri:"id" binding:"numeric,required"`
}
type DevicesServer ¶
type EditSavedParams ¶
type EditSavedParams struct {
ID uint64 `form:"id" json:"id" binding:"numeric"`
}
type ErrorResponse ¶
type GetSavedParams ¶
type GetSavedParams struct {
ID uint64 `form:"id" json:"id" binding:"numeric"`
}
type IPFSServer ¶
type IPFSServer interface {
IPFSAddFiles() error
}
type LinkDirForm ¶
type LinkDirForm struct {
DirID uint64 `form:"dir_id" json:"dir_id" binding:"numeric"`
}
type LinkDirParams ¶
type LinkDirParams struct {
ID uint64 `form:"id" json:"id" binding:"numeric"`
}
type ListDirQuery ¶
type ListDirQuery struct {
DirID uint64 `form:"dir_id" binding:"numeric"`
}
type LoginForm ¶
type LoginForm struct { Username string `form:"username" json:"username" binding:"required,min=4,max=32"` Password string `form:"password" json:"password" binding:"required,min=6,max=32"` }
LoginForm login form.
type MKDirForm ¶
type MKDirForm struct {
Name string `form:"name" json:"name" binding:"required,min=1,max=225"`
}
type MKDirQuery ¶
type MKDirQuery struct {
DirID uint64 `form:"dir_id" binding:"numeric"`
}
type MVDirParams ¶
type RMDirParams ¶
type RMDirParams struct {
ID uint64 `uri:"id" binding:"required,numeric"`
}
type RenameDirParams ¶
type RenameDirParams struct {
ID uint64 `uri:"id" binding:"required,numeric"`
}
type Saved ¶
type SavedServer ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CreateSaves ¶
func (*Server) CreateUser ¶
func (*Server) DeleteDevice ¶
func (*Server) GetDevices ¶
func (*Server) IPFSAddFiles ¶
func (*Server) ValidateJWT ¶
type UnlinkDirParams ¶
type UnlinkDirParams struct {
ID uint64 `uri:"id" binding:"numeric,required"`
}
type UsersServer ¶
type UsersServer interface { // Login is a function that handles user authentication. // // It does not take any parameters. // It returns an error if there is an issue with the authentication process. Login() error // CreateUser creates a user. // // It returns an error if there was a problem creating the user. CreateUser() error }
type Web3Storage ¶
type Web3Storage struct {
BaseURL string
}
func (*Web3Storage) Post ¶
func (w *Web3Storage) Post(path string) (*resty.Response, error)
Click to show internal directories.
Click to hide internal directories.