Documentation
¶
Index ¶
- Constants
- Variables
- func AddAPIToken(user, token string) error
- func ChangeEmail(uid, naddress string) error
- func ChangeNickname(uid, nick string) error
- func ChangePassword(uid, oldpw, newpw string) error
- func DeleteAPIToken(user string) error
- func DeleteFiles(uid string, files []string) error
- func EmailUsed(email string) (bool, error)
- func GenerateToken(email string) (string, error)
- func IDUsed(id string) (bool, error)
- func OpenDB(dsn string) (*sql.DB, error)
- func OwnFiles(id []string, uid int) ([]string, error)
- func RandomID() (string, error)
- func Register(nickname, email, password string) (int64, error)
- func ResetEmailPassword(email, password string) error
- func UpdateFileInfo(id, user, password, comment string, permission int) error
- func UpdateStorage(uid string) (int64, error)
- func UploadFile(rid, uid string, size int64, fileType, filePass, comment string, ...) error
- func VerifyUserEmail(uid string) error
- type APIToken
- type File
- type FileData
- type Info
- type InfoEmail
- type ServerInfo
- type StorageInfo
- type Users
Constants ¶
View Source
const DefaultTimeout = 3 * time.Second
Variables ¶
View Source
var Conn *sql.DB
View Source
var ErrBadPW error = errors.New("invalid password")
View Source
var ErrNotFound error = errors.New("not found")
View Source
var PageLen = 10
Functions ¶
func AddAPIToken ¶
func ChangeEmail ¶
func ChangeNickname ¶
func ChangePassword ¶
func DeleteAPIToken ¶
func DeleteFiles ¶
func GenerateToken ¶
func ResetEmailPassword ¶
func UpdateFileInfo ¶
func UpdateStorage ¶
func UploadFile ¶
func VerifyUserEmail ¶
Types ¶
type APIToken ¶
type APIToken struct { Token string `json:"token"` UserID string `json:"user"` CreatedAt string `json:"created_at"` }
func TokenUserData ¶
func UserAPIToken ¶
type File ¶
type File struct { ID string `json:"id"` User int `json:"user"` FileSize int64 `json:"file_size"` FileType string `json:"file_type"` FilePass string `json:"file_pass"` FileComment string `json:"file_comment"` Permissions int `json:"permissions"` CreatedAt string `json:"created_at"` }
func GetPrivateFile ¶
type FileData ¶
type Info ¶
type InfoEmail ¶
type ServerInfo ¶
type ServerInfo struct { Users int `json:"users"` Storage string `json:"storage"` Total int `json:"total_files"` }
func ServerStatsInfo ¶
func ServerStatsInfo() (ServerInfo, error)
type StorageInfo ¶
type StorageInfo struct { Users int `json:"users"` Storage string `json:"storage"` FileCount struct { Total int `json:"total"` Public int `json:"public"` Private int `json:"private"` Unlisted int `json:"unlisted"` } `json:"files"` }
func ServerStorageInfo ¶
func ServerStorageInfo() (StorageInfo, error)
Click to show internal directories.
Click to hide internal directories.