diff --git a/drivers/teambition/driver.go b/drivers/teambition/driver.go index d4fcc401badf..b84521250b65 100644 --- a/drivers/teambition/driver.go +++ b/drivers/teambition/driver.go @@ -47,7 +47,7 @@ func (d *Teambition) Link(ctx context.Context, file model.Obj, args model.LinkAr } return &model.Link{URL: url}, nil } - return nil, errors.New("can't convert obj to URL") + return nil, errors.New("无法将对象转换为链接") } func (d *Teambition) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error { diff --git a/drivers/teambition/meta.go b/drivers/teambition/meta.go index 45a6a47286cd..a3ab5385e6d4 100644 --- a/drivers/teambition/meta.go +++ b/drivers/teambition/meta.go @@ -6,9 +6,10 @@ import ( ) type Addition struct { - Region string `json:"region" type:"select" options:"china,international" required:"true"` - Cookie string `json:"cookie" required:"true"` - ProjectID string `json:"project_id" required:"true"` + Region string `json:"region" type:"select" options:"china,international" required:"true"` + Cookie string `json:"cookie" required:"true"` + ProjectID string `json:"project_id" required:"true"` + UseProxyGet bool `json:"use_proxy_get" required:"false" default:"true"` driver.RootID OrderBy string `json:"order_by" type:"select" options:"fileName,fileSize,updated,created" default:"fileName"` OrderDirection string `json:"order_direction" type:"select" options:"Asc,Desc" default:"Asc"` diff --git a/go.sum b/go.sum index 5abe5aefd6b4..61ed9bba0bc0 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,6 @@ github.com/andreburgaud/crypt2go v1.2.0/go.mod h1:kKRqlrX/3Q9Ki7HdUsoh0cX1Urq14/ github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/aws/aws-sdk-go v1.38.20/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.44.327 h1:ZS8oO4+7MOBLhkdwIhgtVeDzCeWOlTfKJS7EgggbIEY= -github.com/aws/aws-sdk-go v1.44.327/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go v1.46.7 h1:IjvAWeiJZlbETOemOwvheN5L17CvKvKW0T1xOC6d3Sc= github.com/aws/aws-sdk-go v1.46.7/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= diff --git a/internal/errs/driver.go b/internal/errs/driver.go index 4b6b5cac48e2..7d0ed431844a 100644 --- a/internal/errs/driver.go +++ b/internal/errs/driver.go @@ -3,5 +3,5 @@ package errs import "errors" var ( - EmptyToken = errors.New("empty token") + EmptyToken = errors.New("Token为空") ) diff --git a/internal/errs/errors.go b/internal/errs/errors.go index b48718778a6f..f64042284ed6 100644 --- a/internal/errs/errors.go +++ b/internal/errs/errors.go @@ -7,17 +7,17 @@ import ( ) var ( - NotImplement = errors.New("not implement") - NotSupport = errors.New("not support") - RelativePath = errors.New("access using relative path is not allowed") + NotImplement = errors.New("未实现") + NotSupport = errors.New("不支持") + RelativePath = errors.New("不允许使用相对路径访问") - MoveBetweenTwoStorages = errors.New("can't move files between two storages, try to copy") - UploadNotSupported = errors.New("upload not supported") + MoveBetweenTwoStorages = errors.New("无法跨存储移动, 尝试复制") + UploadNotSupported = errors.New("不支持上传") - MetaNotFound = errors.New("meta not found") - StorageNotFound = errors.New("storage not found") - StreamIncomplete = errors.New("upload/download stream incomplete, possible network issue") - StreamPeekFail = errors.New("StreamPeekFail") + MetaNotFound = errors.New("元数据未找到") + StorageNotFound = errors.New("存储未找到") + StreamIncomplete = errors.New("上传/下载流不完整, 可能是网络问题") + StreamPeekFail = errors.New("流查看失败") ) // NewErr wrap constant error with an extra message diff --git a/internal/errs/object.go b/internal/errs/object.go index 00e8232ff95b..72234b7e0b86 100644 --- a/internal/errs/object.go +++ b/internal/errs/object.go @@ -7,9 +7,9 @@ import ( ) var ( - ObjectNotFound = errors.New("object not found") - NotFolder = errors.New("not a folder") - NotFile = errors.New("not a file") + ObjectNotFound = errors.New("找不到对象") + NotFolder = errors.New("这不是一个文件夹") + NotFile = errors.New("这不是一个文件") ) func IsObjectNotFound(err error) bool { diff --git a/internal/errs/operate.go b/internal/errs/operate.go index 92fbd6a1a49d..9e6dbae06677 100644 --- a/internal/errs/operate.go +++ b/internal/errs/operate.go @@ -3,5 +3,5 @@ package errs import "errors" var ( - PermissionDenied = errors.New("permission denied") + PermissionDenied = errors.New("无权限") ) diff --git a/internal/errs/search.go b/internal/errs/search.go index 9c864f4d2414..7ee555bf3a68 100644 --- a/internal/errs/search.go +++ b/internal/errs/search.go @@ -3,5 +3,5 @@ package errs import "fmt" var ( - SearchNotAvailable = fmt.Errorf("search not available") + SearchNotAvailable = fmt.Errorf("搜索不可用") ) diff --git a/internal/errs/user.go b/internal/errs/user.go index 9e2d5b26cd4d..22a0380613fc 100644 --- a/internal/errs/user.go +++ b/internal/errs/user.go @@ -3,8 +3,8 @@ package errs import "errors" var ( - EmptyUsername = errors.New("username is empty") - EmptyPassword = errors.New("password is empty") - WrongPassword = errors.New("password is incorrect") - DeleteAdminOrGuest = errors.New("cannot delete admin or guest") + EmptyUsername = errors.New("用户名为空") + EmptyPassword = errors.New("密码为空") + WrongPassword = errors.New("密码不正确") + DeleteAdminOrGuest = errors.New("无法删除admin用户或者guest用户") ) diff --git a/server/common/auth.go b/server/common/auth.go index b6a79b752aa6..be06afa3789b 100644 --- a/server/common/auth.go +++ b/server/common/auth.go @@ -38,18 +38,18 @@ func ParseToken(tokenString string) (*UserClaims, error) { if err != nil { if ve, ok := err.(*jwt.ValidationError); ok { if ve.Errors&jwt.ValidationErrorMalformed != 0 { - return nil, errors.New("that's not even a token") + return nil, errors.New("Token不可用") } else if ve.Errors&jwt.ValidationErrorExpired != 0 { - return nil, errors.New("token is expired") + return nil, errors.New("Token已过期") } else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 { - return nil, errors.New("token not active yet") + return nil, errors.New("Token尚未激活") } else { - return nil, errors.New("couldn't handle this token") + return nil, errors.New("无法处理此Token") } } } if claims, ok := token.Claims.(*UserClaims); ok && token.Valid { return claims, nil } - return nil, errors.New("couldn't handle this token") + return nil, errors.New("无法处理此Token") } diff --git a/server/handles/auth.go b/server/handles/auth.go index 209bdd3a2b80..1c2ec18f6140 100644 --- a/server/handles/auth.go +++ b/server/handles/auth.go @@ -52,7 +52,7 @@ func loginHash(c *gin.Context, req *LoginReq) { ip := c.ClientIP() count, ok := loginCache.Get(ip) if ok && count >= defaultTimes { - common.ErrorStrResp(c, "Too many unsuccessful sign-in attempts have been made using an incorrect username or password, Try again later.", 429) + common.ErrorStrResp(c, "你的登录请求已被服务器拦截, 请稍后再试", 429) loginCache.Expire(ip, defaultDuration) return }