handles

package
v4.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: AGPL-3.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CANCEL aborts the operation when a conflict is detected
	CANCEL = "cancel"

	// OVERWRITE replaces the existing file/folder with the new one
	OVERWRITE = "overwrite"

	// SKIP ignores the current file/folder and continues with the next item
	SKIP = "skip"
)

File operation conflict resolution strategies

View Source
const (
	PlatformGithub    = "Github"
	PlatformMicrosoft = "Microsoft"
	PlatformGoogle    = "Google"
	PlatformDingtalk  = "Dingtalk"
	PlatformCasdoor   = "Casdoor"
	PlatformOIDC      = "OIDC"
)

支持的SSO平台

View Source
const (
	MethodGetSSOID = "get_sso_id"
	MethodGetToken = "sso_get_token"
)

SSO方法类型

View Source
const (
	// 会话数据头名称
	HeaderSessionData = "Session"
	// 用户名查询参数
	QueryUsername = "username"
	// 错误消息
	ErrWebAuthnNotEnabled = "WebAuthn 未启用"
	// 成功消息
	MsgRegisteredSuccess = "注册成功"
	MsgDeletedSuccess    = "删除成功"
)

WebAuthn 相关常量

Variables

This section is empty.

Functions

func AddMyPublicKey

func AddMyPublicKey(c *gin.Context)

func AddOfflineDownload

func AddOfflineDownload(c *gin.Context)

AddOfflineDownload 添加离线下载任务

func ArchiveDown

func ArchiveDown(c *gin.Context)

ArchiveDown 下载归档文件中的内容

func ArchiveExtensions

func ArchiveExtensions(c *gin.Context)

ArchiveExtensions 获取支持的归档扩展名

func ArchiveInternalExtract

func ArchiveInternalExtract(c *gin.Context)

ArchiveInternalExtract 内部提取归档文件内容

func ArchiveProxy

func ArchiveProxy(c *gin.Context)

ArchiveProxy 代理归档文件中的内容

func BeginAuthnLogin

func BeginAuthnLogin(c *gin.Context)

BeginAuthnLogin 开始 WebAuthn 登录流程 支持两种模式: 1. 用户名登录:通过查询参数提供用户名 2. 可发现凭证登录:不提供用户名,由客户端选择凭证

func BeginAuthnRegistration

func BeginAuthnRegistration(c *gin.Context)

BeginAuthnRegistration 开始 WebAuthn 注册流程 为当前用户生成注册选项

func BuildIndex

func BuildIndex(c *gin.Context)

func Cancel2FAById

func Cancel2FAById(c *gin.Context)

func ClearIndex

func ClearIndex(c *gin.Context)

func CreateMeta

func CreateMeta(c *gin.Context)

CreateMeta creates a new metadata configuration

func CreateStorage

func CreateStorage(c *gin.Context)

func CreateUser

func CreateUser(c *gin.Context)

func CurrentUser

func CurrentUser(c *gin.Context)

CurrentUser 返回当前认证用户的信息

func DefaultSettings added in v4.2.3

func DefaultSettings(c *gin.Context)

func DelUserCache

func DelUserCache(c *gin.Context)

func DeleteAuthnLogin

func DeleteAuthnLogin(c *gin.Context)

DeleteAuthnLogin 删除 WebAuthn 登录凭证

func DeleteMeta

func DeleteMeta(c *gin.Context)

DeleteMeta deletes a metadata configuration by ID

func DeleteMyPublicKey

func DeleteMyPublicKey(c *gin.Context)

func DeletePublicKey

func DeletePublicKey(c *gin.Context)

func DeleteSetting

func DeleteSetting(c *gin.Context)

DeleteSetting 删除设置项

func DeleteStorage

func DeleteStorage(c *gin.Context)

func DeleteUser

func DeleteUser(c *gin.Context)

func DisableStorage

func DisableStorage(c *gin.Context)

func Down

func Down(c *gin.Context)

Down 处理文件下载请求 根据存储配置决定是直接重定向还是通过代理下载

func EnableStorage

func EnableStorage(c *gin.Context)

func Favicon

func Favicon(c *gin.Context)

Favicon handles the favicon request by redirecting to the configured favicon URL

func FinishAuthnLogin

func FinishAuthnLogin(c *gin.Context)

FinishAuthnLogin 完成 WebAuthn 登录流程 验证客户端提供的凭证,成功后生成登录令牌

func FinishAuthnRegistration

func FinishAuthnRegistration(c *gin.Context)

FinishAuthnRegistration 完成 WebAuthn 注册流程 验证并保存客户端提供的凭证

func FsArchiveDecompress

func FsArchiveDecompress(c *gin.Context)

FsArchiveDecompress 解压缩归档文件

func FsArchiveList

func FsArchiveList(c *gin.Context)

FsArchiveList 获取归档文件内容列表

func FsArchiveMeta

func FsArchiveMeta(c *gin.Context)

FsArchiveMeta 获取归档文件元数据

func FsBatchRename

func FsBatchRename(c *gin.Context)

FsBatchRename 处理批量重命名请求

func FsCopy

func FsCopy(c *gin.Context)

FsCopy 文件复制处理函数

func FsDirs

func FsDirs(c *gin.Context)

FsDirs 获取目录列表

func FsForm

func FsForm(c *gin.Context)

FsForm 处理表单上传文件请求

func FsGet

func FsGet(c *gin.Context)

FsGet 获取文件信息

func FsList

func FsList(c *gin.Context)

FsList 获取文件列表

func FsMkdir

func FsMkdir(c *gin.Context)

FsMkdir 创建目录处理函数

func FsMove

func FsMove(c *gin.Context)

FsMove 文件移动处理函数

func FsOther

func FsOther(c *gin.Context)

FsOther 处理其他文件系统操作

func FsRecursiveMove

func FsRecursiveMove(c *gin.Context)

FsRecursiveMove 处理递归移动文件请求

func FsRegexRename

func FsRegexRename(c *gin.Context)

FsRegexRename 处理正则表达式重命名请求

func FsRemove

func FsRemove(c *gin.Context)

FsRemove 文件删除处理函数

func FsRemoveEmptyDirectory

func FsRemoveEmptyDirectory(c *gin.Context)

FsRemoveEmptyDirectory 删除空目录处理函数

func FsRename

func FsRename(c *gin.Context)

FsRename 文件重命名处理函数

func FsStream

func FsStream(c *gin.Context)

FsStream 处理流式上传文件请求

func Generate2FA

func Generate2FA(c *gin.Context)

Generate2FA 为当前用户创建新的 2FA 密钥和 QR 码

func GetAuthnCredentials

func GetAuthnCredentials(c *gin.Context)

GetAuthnCredentials 获取用户的 WebAuthn 凭证列表

func GetDriverInfo

func GetDriverInfo(c *gin.Context)

GetDriverInfo returns detailed information about a specific storage driver The driver name must be provided as a query parameter

func GetMeta

func GetMeta(c *gin.Context)

GetMeta retrieves a specific metadata configuration by ID

func GetOIDCClient

func GetOIDCClient(c *gin.Context, useCompatibility bool, redirectUri, method string) (*oauth2.Config, error)

GetOIDCClient 获取OIDC客户端配置

func GetProgress

func GetProgress(c *gin.Context)

func GetSetting

func GetSetting(c *gin.Context)

GetSetting 获取设置项

func GetStorage

func GetStorage(c *gin.Context)

func GetUser

func GetUser(c *gin.Context)
func Link(c *gin.Context)

Link 返回真实链接,仅供代理程序使用,可能包含cookie,因此仅允许管理员使用

func ListDriverInfo

func ListDriverInfo(c *gin.Context)

ListDriverInfo returns information about all available storage drivers This includes their configuration options and capabilities

func ListDriverNames

func ListDriverNames(c *gin.Context)

ListDriverNames returns a list of all available storage driver names This is useful for UI components that need to display driver selection options

func ListMetas

func ListMetas(c *gin.Context)

ListMetas returns a paginated list of metadata configurations

func ListMyPublicKey

func ListMyPublicKey(c *gin.Context)

func ListPublicKeys

func ListPublicKeys(c *gin.Context)

func ListSettings

func ListSettings(c *gin.Context)

ListSettings 列出设置项

func ListStorages

func ListStorages(c *gin.Context)

func ListUsers

func ListUsers(c *gin.Context)

func LoadAllStorages

func LoadAllStorages(c *gin.Context)

func LogOut

func LogOut(c *gin.Context)

LogOut 使当前用户的身份验证令牌失效

func Login

func Login(c *gin.Context)

Login 已弃用 - 请使用 LoginHash 处理明文密码登录(会被哈希处理)

func LoginHash

func LoginHash(c *gin.Context)

LoginHash 处理预哈希密码登录

func LoginLdap

func LoginLdap(c *gin.Context)

func OIDCLoginCallback

func OIDCLoginCallback(c *gin.Context)

OIDCLoginCallback 处理OIDC登录回调

func OfflineDownloadTools

func OfflineDownloadTools(c *gin.Context)

OfflineDownloadTools 获取可用的离线下载工具列表

func Plist

func Plist(c *gin.Context)

Plist generates an iOS plist file for app installation The link_name parameter is expected to be a base64 encoded string containing URL and name information

func Proxy

func Proxy(c *gin.Context)

Proxy 处理需要代理的文件下载请求

func PublicSettings

func PublicSettings(c *gin.Context)

PublicSettings 获取公开设置

func ResetToken

func ResetToken(c *gin.Context)

ResetToken 重置系统令牌

func Robots

func Robots(c *gin.Context)

Robots returns the configured robots.txt content

func SSOLoginCallback

func SSOLoginCallback(c *gin.Context)

SSOLoginCallback 处理SSO登录回调

func SSOLoginRedirect

func SSOLoginRedirect(c *gin.Context)

SSOLoginRedirect 处理SSO登录重定向 根据不同的SSO平台,构建相应的授权URL并重定向

func SaveSettings

func SaveSettings(c *gin.Context)

SaveSettings 保存多个设置项

func Search(c *gin.Context)

Search handles file/folder search requests with permission filtering

func Set115

func Set115(c *gin.Context)

Set115 设置115云离线下载

func Set115Open added in v4.2.3

func Set115Open(c *gin.Context)

func SetAria2

func SetAria2(c *gin.Context)

SetAria2 设置Aria2离线下载

func SetPikPak

func SetPikPak(c *gin.Context)

SetPikPak 设置PikPak离线下载

func SetQbittorrent

func SetQbittorrent(c *gin.Context)

SetQbittorrent 设置qBittorrent离线下载

func SetThunder

func SetThunder(c *gin.Context)

SetThunder 设置迅雷离线下载

func SetThunderBrowser

func SetThunderBrowser(c *gin.Context)

SetThunderBrowser 设置迅雷浏览器离线下载

func SetThunderX added in v4.3.0

func SetThunderX(c *gin.Context)

func SetTransmission

func SetTransmission(c *gin.Context)

SetTransmission 设置Transmission离线下载

func SetupTaskRoute

func SetupTaskRoute(g *gin.RouterGroup)

SetupTaskRoute 设置所有任务相关路由

func StopIndex

func StopIndex(c *gin.Context)

func UpdateCurrent

func UpdateCurrent(c *gin.Context)

UpdateCurrent 更新当前用户的个人资料信息

func UpdateIndex

func UpdateIndex(c *gin.Context)

func UpdateMeta

func UpdateMeta(c *gin.Context)

UpdateMeta updates an existing metadata configuration

func UpdateStorage

func UpdateStorage(c *gin.Context)

func UpdateUser

func UpdateUser(c *gin.Context)

func Verify2FA

func Verify2FA(c *gin.Context)

Verify2FA 验证 2FA 代码并为当前用户启用 2FA

Types

type AddOfflineDownloadReq

type AddOfflineDownloadReq struct {
	Urls         []string `json:"urls" binding:"required"`
	Path         string   `json:"path" binding:"required"`
	Tool         string   `json:"tool" binding:"required"`
	DeletePolicy string   `json:"delete_policy"`
}

AddOfflineDownloadReq 添加离线下载请求

type ArchiveContentResp

type ArchiveContentResp struct {
	ObjResp
	Children []ArchiveContentResp `json:"children"` // 子项
}

ArchiveContentResp 归档内容响应

type ArchiveDecompressReq

type ArchiveDecompressReq struct {
	SrcDir        string        `json:"src_dir" form:"src_dir" binding:"required"`
	DstDir        string        `json:"dst_dir" form:"dst_dir" binding:"required"`
	Name          StringOrArray `json:"name" form:"name" binding:"required"`
	ArchivePass   string        `json:"archive_pass" form:"archive_pass"`
	InnerPath     string        `json:"inner_path" form:"inner_path"`
	CacheFull     bool          `json:"cache_full" form:"cache_full"`
	PutIntoNewDir bool          `json:"put_into_new_dir" form:"put_into_new_dir"`
}

ArchiveDecompressReq 归档文件解压请求参数

type ArchiveListReq

type ArchiveListReq struct {
	ArchiveMetaReq
	model.PageReq
	InnerPath string `json:"inner_path" form:"inner_path"`
}

ArchiveListReq 归档文件列表请求参数

type ArchiveListResp

type ArchiveListResp struct {
	Content []ObjResp `json:"content"` // 内容列表
	Total   int64     `json:"total"`   // 总数
}

ArchiveListResp 归档文件列表响应

type ArchiveMetaReq

type ArchiveMetaReq struct {
	Path        string `json:"path" form:"path" binding:"required"`
	Password    string `json:"password" form:"password"`
	Refresh     bool   `json:"refresh" form:"refresh"`
	ArchivePass string `json:"archive_pass" form:"archive_pass"`
}

ArchiveMetaReq 归档文件元数据请求参数

type ArchiveMetaResp

type ArchiveMetaResp struct {
	Comment     string               `json:"comment"`        // 归档文件注释
	IsEncrypted bool                 `json:"encrypted"`      // 是否加密
	Content     []ArchiveContentResp `json:"content"`        // 归档内容
	Sort        *model.Sort          `json:"sort,omitempty"` // 排序信息
	RawURL      string               `json:"raw_url"`        // 原始URL
	Sign        string               `json:"sign"`           // 签名
}

ArchiveMetaResp 归档文件元数据响应

type BatchRenameReq

type BatchRenameReq struct {
	SrcDir        string `json:"src_dir" binding:"required"` // 源目录
	RenameObjects []struct {
		SrcName string `json:"src_name" binding:"required"` // 原文件名
		NewName string `json:"new_name" binding:"required"` // 新文件名
	} `json:"rename_objects" binding:"required"` // 重命名对象列表
}

BatchRenameReq 批量重命名请求参数

type BatchTaskRequest

type BatchTaskRequest []string

BatchTaskRequest 批量任务请求

type DeleteAuthnRequest

type DeleteAuthnRequest struct {
	ID string `json:"id" binding:"required"` // 凭证ID
}

DeleteAuthnRequest WebAuthn 凭证删除请求

type DirReq

type DirReq struct {
	Path      string `json:"path" form:"path" binding:"required"`
	Password  string `json:"password" form:"password"`
	ForceRoot bool   `json:"force_root" form:"force_root"`
}

DirReq 目录请求参数

type DirResp

type DirResp struct {
	Name     string    `json:"name"`
	Modified time.Time `json:"modified"`
}

DirResp 目录响应结构

type FsGetReq

type FsGetReq struct {
	Path     string `json:"path" form:"path" binding:"required"`
	Password string `json:"password" form:"password"`
}

FsGetReq 获取文件请求参数

type FsGetResp

type FsGetResp struct {
	ObjResp
	RawURL   string    `json:"raw_url"`
	Readme   string    `json:"readme"`
	Header   string    `json:"header"`
	Provider string    `json:"provider"`
	Related  []ObjResp `json:"related"`
}

FsGetResp 获取文件响应结构

type FsListResp

type FsListResp struct {
	Content  []ObjResp `json:"content"`
	Total    int64     `json:"total"`
	Readme   string    `json:"readme"`
	Header   string    `json:"header"`
	Write    bool      `json:"write"`
	Provider string    `json:"provider"`
}

FsListResp 文件列表响应结构

type FsOtherReq

type FsOtherReq struct {
	model.FsOtherArgs
	Password string `json:"password" form:"password"`
}

FsOtherReq 其他文件系统操作请求参数

type ListReq

type ListReq struct {
	model.PageReq
	Path     string `json:"path" form:"path" binding:"required"`
	Password string `json:"password" form:"password"`
	Refresh  bool   `json:"refresh"`
}

ListReq 文件列表请求参数

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
	OtpCode  string `json:"otp_code"`
}

LoginRequest 登录请求参数

type MkdirOrLinkReq

type MkdirOrLinkReq struct {
	Path string `json:"path" form:"path" binding:"required"`
}

MkdirOrLinkReq 创建目录或获取链接请求

type MoveCopyReq

type MoveCopyReq struct {
	SrcDir    string   `json:"src_dir" binding:"required"`
	DstDir    string   `json:"dst_dir" binding:"required"`
	Names     []string `json:"names" binding:"required"`
	Overwrite bool     `json:"overwrite"`
}

MoveCopyReq 移动或复制请求

type ObjResp

type ObjResp struct {
	Id          string                     `json:"id"`
	Path        string                     `json:"path"`
	Name        string                     `json:"name"`
	Size        int64                      `json:"size"`
	IsDir       bool                       `json:"is_dir"`
	Modified    time.Time                  `json:"modified"`
	Created     time.Time                  `json:"created"`
	Sign        string                     `json:"sign"`
	Thumb       string                     `json:"thumb"`
	Type        int                        `json:"type"`
	HashInfoStr string                     `json:"hashinfo"`
	HashInfo    map[*utils.HashType]string `json:"hash_info"`
}

ObjResp 对象响应结构

type RecursiveMoveReq

type RecursiveMoveReq struct {
	SrcDir         string `json:"src_dir" binding:"required"`         // 源目录
	DstDir         string `json:"dst_dir" binding:"required"`         // 目标目录
	ConflictPolicy string `json:"conflict_policy" binding:"required"` // 冲突处理策略
}

RecursiveMoveReq 递归移动请求参数

type RegexRenameReq

type RegexRenameReq struct {
	SrcDir       string `json:"src_dir" binding:"required"`        // 源目录
	SrcNameRegex string `json:"src_name_regex" binding:"required"` // 源文件名正则表达式
	NewNameRegex string `json:"new_name_regex" binding:"required"` // 新文件名正则表达式
}

RegexRenameReq 正则表达式重命名请求参数

type RemoveEmptyDirectoryReq

type RemoveEmptyDirectoryReq struct {
	SrcDir string `json:"src_dir" binding:"required"`
}

RemoveEmptyDirectoryReq 删除空目录请求

type RemoveReq

type RemoveReq struct {
	Dir   string   `json:"dir" binding:"required"`
	Names []string `json:"names" binding:"required"`
}

RemoveReq 删除文件请求

type RenameReq

type RenameReq struct {
	Path      string `json:"path" binding:"required"`
	Name      string `json:"name" binding:"required"`
	Overwrite bool   `json:"overwrite"`
}

RenameReq 重命名请求

type SSHKeyAddReq

type SSHKeyAddReq struct {
	Title string `json:"title" binding:"required"`
	Key   string `json:"key" binding:"required"`
}

type SearchRequest

type SearchRequest struct {
	model.SearchReq
	Password string `json:"password"`
}

SearchRequest extends the base search request with password for accessing protected folders

type SearchResponse

type SearchResponse struct {
	model.SearchNode
	Type int `json:"type"` // File type for UI rendering
}

SearchResponse extends SearchNode with additional type information for UI rendering

type Set115OpenReq added in v4.2.3

type Set115OpenReq struct {
	TempDir string `json:"temp_dir" form:"temp_dir"`
}

type Set115Req

type Set115Req struct {
	TempDir string `json:"temp_dir" form:"temp_dir"`
}

Set115Req 115云设置请求

type SetAria2Req

type SetAria2Req struct {
	Uri    string `json:"uri" form:"uri" binding:"required"`
	Secret string `json:"secret" form:"secret"`
}

SetAria2Req Aria2设置请求

type SetPikPakReq

type SetPikPakReq struct {
	TempDir string `json:"temp_dir" form:"temp_dir"`
}

SetPikPakReq PikPak设置请求

type SetQbittorrentReq

type SetQbittorrentReq struct {
	Url      string `json:"url" form:"url" binding:"required"`
	Seedtime string `json:"seedtime" form:"seedtime"`
}

SetQbittorrentReq qBittorrent设置请求

type SetThunderBrowserReq

type SetThunderBrowserReq struct {
	TempDir string `json:"temp_dir" form:"temp_dir"`
}

SetThunderBrowserReq 迅雷浏览器设置请求

type SetThunderReq

type SetThunderReq struct {
	TempDir string `json:"temp_dir" form:"temp_dir"`
}

SetThunderReq 迅雷设置请求

type SetThunderXReq added in v4.3.0

type SetThunderXReq struct {
	TempDir string `json:"temp_dir" form:"temp_dir"`
}

type SetTransmissionReq

type SetTransmissionReq struct {
	Uri      string `json:"uri" form:"uri" binding:"required"`
	Seedtime string `json:"seedtime" form:"seedtime"`
}

SetTransmissionReq Transmission设置请求

type StringOrArray

type StringOrArray []string

StringOrArray 可以是字符串或字符串数组的类型

func (*StringOrArray) UnmarshalJSON

func (s *StringOrArray) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现JSON反序列化接口

type TaskInfo

type TaskInfo struct {
	ID          string      `json:"id"`           // 任务ID
	Name        string      `json:"name"`         // 任务名称
	Creator     string      `json:"creator"`      // 创建者用户名
	CreatorRole int         `json:"creator_role"` // 创建者角色
	State       tache.State `json:"state"`        // 任务状态
	Status      string      `json:"status"`       // 任务状态描述
	Progress    float64     `json:"progress"`     // 任务进度(0-100)
	StartTime   *time.Time  `json:"start_time"`   // 开始时间
	EndTime     *time.Time  `json:"end_time"`     // 结束时间
	TotalBytes  int64       `json:"total_bytes"`  // 总字节数
	Error       string      `json:"error"`        // 错误信息
}

TaskInfo 任务信息结构体

type UpdateIndexReq

type UpdateIndexReq struct {
	Paths    []string `json:"paths"`
	MaxDepth int      `json:"max_depth"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	SsoID    string `json:"sso_id"`
}

UpdateUserRequest 更新用户请求参数

type UserResponse

type UserResponse struct {
	model.User
	HasOTP bool `json:"otp"` // 指示是否启用了 2FA
}

UserResponse 扩展 User 模型,用于 API 响应

type Verify2FARequest

type Verify2FARequest struct {
	Code   string `json:"code" binding:"required"`
	Secret string `json:"secret" binding:"required"`
}

Verify2FARequest 验证并启用 2FA 的请求参数

type WebAuthnCredential

type WebAuthnCredential struct {
	ID          []byte `json:"id"`          // 凭证ID
	FingerPrint string `json:"fingerprint"` // 指纹(AAGUID的十六进制表示)
}

WebAuthnCredential WebAuthn 凭证信息

Jump to

Keyboard shortcuts

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