mirror of https://github.com/Xhofe/alist
fix(thunder_browser): fix space parameter not handled correctly in some cases & update some parameters (#6952)
parent
d4285b7c6c
commit
f2727095d9
|
@ -15,8 +15,8 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ type XunLeiBrowserCommon struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xc *XunLeiBrowserCommon) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
|
func (xc *XunLeiBrowserCommon) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
|
||||||
return xc.getFiles(ctx, dir.GetID(), args.ReqPath)
|
return xc.getFiles(ctx, dir, args.ReqPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xc *XunLeiBrowserCommon) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
|
func (xc *XunLeiBrowserCommon) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) {
|
||||||
|
@ -317,17 +317,10 @@ func (xc *XunLeiBrowserCommon) Link(ctx context.Context, file model.Obj, args mo
|
||||||
|
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"_magic": "2021",
|
"_magic": "2021",
|
||||||
"space": "SPACE_BROWSER",
|
"space": file.(*Files).GetSpace(),
|
||||||
"thumbnail_size": "SIZE_LARGE",
|
"thumbnail_size": "SIZE_LARGE",
|
||||||
"with": "url",
|
"with": "url",
|
||||||
}
|
}
|
||||||
// 对 "迅雷云盘" 内的文件 特殊处理
|
|
||||||
if file.GetPath() == ThunderDriveFileID {
|
|
||||||
params = map[string]string{}
|
|
||||||
} else if file.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
// 对 "超级保险箱" 内的文件 特殊处理
|
|
||||||
params["space"] = "SPACE_BROWSER_SAFE"
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := xc.Request(FILE_API_URL+"/{fileID}", http.MethodGet, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL+"/{fileID}", http.MethodGet, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
|
@ -361,22 +354,9 @@ func (xc *XunLeiBrowserCommon) MakeDir(ctx context.Context, parentDir model.Obj,
|
||||||
"kind": FOLDER,
|
"kind": FOLDER,
|
||||||
"name": dirName,
|
"name": dirName,
|
||||||
"parent_id": parentDir.GetID(),
|
"parent_id": parentDir.GetID(),
|
||||||
"space": "SPACE_BROWSER",
|
"space": parentDir.(*Files).GetSpace(),
|
||||||
}
|
|
||||||
if parentDir.GetPath() == ThunderDriveFileID {
|
|
||||||
js = base.Json{
|
|
||||||
"kind": FOLDER,
|
|
||||||
"name": dirName,
|
|
||||||
"parent_id": parentDir.GetID(),
|
|
||||||
}
|
|
||||||
} else if parentDir.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
js = base.Json{
|
|
||||||
"kind": FOLDER,
|
|
||||||
"name": dirName,
|
|
||||||
"parent_id": parentDir.GetID(),
|
|
||||||
"space": "SPACE_BROWSER_SAFE",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := xc.Request(FILE_API_URL, http.MethodPost, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL, http.MethodPost, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
r.SetBody(&js)
|
r.SetBody(&js)
|
||||||
|
@ -386,33 +366,14 @@ func (xc *XunLeiBrowserCommon) MakeDir(ctx context.Context, parentDir model.Obj,
|
||||||
|
|
||||||
func (xc *XunLeiBrowserCommon) Move(ctx context.Context, srcObj, dstDir model.Obj) error {
|
func (xc *XunLeiBrowserCommon) Move(ctx context.Context, srcObj, dstDir model.Obj) error {
|
||||||
|
|
||||||
srcSpace := "SPACE_BROWSER"
|
|
||||||
dstSpace := "SPACE_BROWSER"
|
|
||||||
|
|
||||||
// 对 "超级保险箱" 内的文件 特殊处理
|
|
||||||
if srcObj.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
srcSpace = "SPACE_BROWSER_SAFE"
|
|
||||||
}
|
|
||||||
if dstDir.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
dstSpace = "SPACE_BROWSER_SAFE"
|
|
||||||
}
|
|
||||||
|
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"_from": dstSpace,
|
"_from": srcObj.(*Files).GetSpace(),
|
||||||
}
|
}
|
||||||
js := base.Json{
|
js := base.Json{
|
||||||
"to": base.Json{"parent_id": dstDir.GetID(), "space": dstSpace},
|
"to": base.Json{"parent_id": dstDir.GetID(), "space": dstDir.(*Files).GetSpace()},
|
||||||
"space": srcSpace,
|
"space": srcObj.(*Files).GetSpace(),
|
||||||
"ids": []string{srcObj.GetID()},
|
"ids": []string{srcObj.GetID()},
|
||||||
}
|
}
|
||||||
// 对 "迅雷云盘" 内的文件 特殊处理
|
|
||||||
if srcObj.GetPath() == ThunderDriveFileID {
|
|
||||||
params = map[string]string{}
|
|
||||||
js = base.Json{
|
|
||||||
"to": base.Json{"parent_id": dstDir.GetID()},
|
|
||||||
"ids": []string{srcObj.GetID()},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := xc.Request(FILE_API_URL+":batchMove", http.MethodPost, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL+":batchMove", http.MethodPost, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
|
@ -425,16 +386,7 @@ func (xc *XunLeiBrowserCommon) Move(ctx context.Context, srcObj, dstDir model.Ob
|
||||||
func (xc *XunLeiBrowserCommon) Rename(ctx context.Context, srcObj model.Obj, newName string) error {
|
func (xc *XunLeiBrowserCommon) Rename(ctx context.Context, srcObj model.Obj, newName string) error {
|
||||||
|
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"space": "SPACE_BROWSER",
|
"space": srcObj.(*Files).GetSpace(),
|
||||||
}
|
|
||||||
// 对 "迅雷云盘" 内的文件 特殊处理
|
|
||||||
if srcObj.GetPath() == ThunderDriveFileID {
|
|
||||||
params = map[string]string{}
|
|
||||||
} else if srcObj.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
// 对 "超级保险箱" 内的文件 特殊处理
|
|
||||||
params = map[string]string{
|
|
||||||
"space": "SPACE_BROWSER_SAFE",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := xc.Request(FILE_API_URL+"/{fileID}", http.MethodPatch, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL+"/{fileID}", http.MethodPatch, func(r *resty.Request) {
|
||||||
|
@ -448,33 +400,14 @@ func (xc *XunLeiBrowserCommon) Rename(ctx context.Context, srcObj model.Obj, new
|
||||||
|
|
||||||
func (xc *XunLeiBrowserCommon) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
|
func (xc *XunLeiBrowserCommon) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
|
||||||
|
|
||||||
srcSpace := "SPACE_BROWSER"
|
|
||||||
dstSpace := "SPACE_BROWSER"
|
|
||||||
|
|
||||||
// 对 "超级保险箱" 内的文件 特殊处理
|
|
||||||
if srcObj.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
srcSpace = "SPACE_BROWSER_SAFE"
|
|
||||||
}
|
|
||||||
if dstDir.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
dstSpace = "SPACE_BROWSER_SAFE"
|
|
||||||
}
|
|
||||||
|
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"_from": dstSpace,
|
"_from": srcObj.(*Files).GetSpace(),
|
||||||
}
|
}
|
||||||
js := base.Json{
|
js := base.Json{
|
||||||
"to": base.Json{"parent_id": dstDir.GetID(), "space": dstSpace},
|
"to": base.Json{"parent_id": dstDir.GetID(), "space": dstDir.(*Files).GetSpace()},
|
||||||
"space": srcSpace,
|
"space": srcObj.(*Files).GetSpace(),
|
||||||
"ids": []string{srcObj.GetID()},
|
"ids": []string{srcObj.GetID()},
|
||||||
}
|
}
|
||||||
// 对 "迅雷云盘" 内的文件 特殊处理
|
|
||||||
if srcObj.GetPath() == ThunderDriveFileID {
|
|
||||||
params = map[string]string{}
|
|
||||||
js = base.Json{
|
|
||||||
"to": base.Json{"parent_id": dstDir.GetID()},
|
|
||||||
"ids": []string{srcObj.GetID()},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := xc.Request(FILE_API_URL+":batchCopy", http.MethodPost, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL+":batchCopy", http.MethodPost, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
|
@ -488,30 +421,17 @@ func (xc *XunLeiBrowserCommon) Remove(ctx context.Context, obj model.Obj) error
|
||||||
|
|
||||||
js := base.Json{
|
js := base.Json{
|
||||||
"ids": []string{obj.GetID()},
|
"ids": []string{obj.GetID()},
|
||||||
"space": "SPACE_BROWSER",
|
"space": obj.(*Files).GetSpace(),
|
||||||
}
|
}
|
||||||
// 对 "迅雷云盘" 内的文件 特殊处理
|
|
||||||
if obj.GetPath() == ThunderDriveFileID {
|
|
||||||
js = base.Json{
|
|
||||||
"ids": []string{obj.GetID()},
|
|
||||||
}
|
|
||||||
} else if obj.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
// 对 "超级保险箱" 内的文件 特殊处理
|
|
||||||
js = base.Json{
|
|
||||||
"ids": []string{obj.GetID()},
|
|
||||||
"space": "SPACE_BROWSER_SAFE",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 先判断是否是特殊情况
|
// 先判断是否是特殊情况
|
||||||
if obj.GetPath() == ThunderDriveFileID {
|
if obj.(*Files).GetSpace() == ThunderDriveSpace {
|
||||||
_, err := xc.Request(FILE_API_URL+"/{fileID}/trash", http.MethodPatch, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL+"/{fileID}/trash", http.MethodPatch, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
r.SetPathParam("fileID", obj.GetID())
|
r.SetPathParam("fileID", obj.GetID())
|
||||||
r.SetBody("{}")
|
r.SetBody("{}")
|
||||||
}, nil)
|
}, nil)
|
||||||
return err
|
return err
|
||||||
} else if obj.GetPath() == ThunderBrowserDriveSafeFileID {
|
} else if obj.(*Files).GetSpace() == ThunderBrowserDriveSafeSpace || obj.(*Files).GetSpace() == ThunderDriveSafeSpace {
|
||||||
_, err := xc.Request(FILE_API_URL+":batchDelete", http.MethodPost, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL+":batchDelete", http.MethodPost, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
r.SetBody(&js)
|
r.SetBody(&js)
|
||||||
|
@ -557,29 +477,7 @@ func (xc *XunLeiBrowserCommon) Put(ctx context.Context, dstDir model.Obj, stream
|
||||||
"size": stream.GetSize(),
|
"size": stream.GetSize(),
|
||||||
"hash": gcid,
|
"hash": gcid,
|
||||||
"upload_type": UPLOAD_TYPE_RESUMABLE,
|
"upload_type": UPLOAD_TYPE_RESUMABLE,
|
||||||
"space": "SPACE_BROWSER",
|
"space": dstDir.(*Files).GetSpace(),
|
||||||
}
|
|
||||||
// 对 "迅雷云盘" 内的文件 特殊处理
|
|
||||||
if dstDir.GetPath() == ThunderDriveFileID {
|
|
||||||
js = base.Json{
|
|
||||||
"kind": FILE,
|
|
||||||
"parent_id": dstDir.GetID(),
|
|
||||||
"name": stream.GetName(),
|
|
||||||
"size": stream.GetSize(),
|
|
||||||
"hash": gcid,
|
|
||||||
"upload_type": UPLOAD_TYPE_RESUMABLE,
|
|
||||||
}
|
|
||||||
} else if dstDir.GetPath() == ThunderBrowserDriveSafeFileID {
|
|
||||||
// 对 "超级保险箱" 内的文件 特殊处理
|
|
||||||
js = base.Json{
|
|
||||||
"kind": FILE,
|
|
||||||
"parent_id": dstDir.GetID(),
|
|
||||||
"name": stream.GetName(),
|
|
||||||
"size": stream.GetSize(),
|
|
||||||
"hash": gcid,
|
|
||||||
"upload_type": UPLOAD_TYPE_RESUMABLE,
|
|
||||||
"space": "SPACE_BROWSER_SAFE",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp UploadTaskResponse
|
var resp UploadTaskResponse
|
||||||
|
@ -610,58 +508,35 @@ func (xc *XunLeiBrowserCommon) Put(ctx context.Context, dstDir model.Obj, stream
|
||||||
Bucket: aws.String(param.Bucket),
|
Bucket: aws.String(param.Bucket),
|
||||||
Key: aws.String(param.Key),
|
Key: aws.String(param.Key),
|
||||||
Expires: aws.Time(param.Expiration),
|
Expires: aws.Time(param.Expiration),
|
||||||
Body: stream,
|
Body: io.TeeReader(stream, driver.NewProgress(stream.GetSize(), up)),
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xc *XunLeiBrowserCommon) getFiles(ctx context.Context, folderId string, path string) ([]model.Obj, error) {
|
func (xc *XunLeiBrowserCommon) getFiles(ctx context.Context, dir model.Obj, path string) ([]model.Obj, error) {
|
||||||
files := make([]model.Obj, 0)
|
files := make([]model.Obj, 0)
|
||||||
var pageToken string
|
var pageToken string
|
||||||
for {
|
for {
|
||||||
var fileList FileList
|
var fileList FileList
|
||||||
folderSpace := "SPACE_BROWSER"
|
folderSpace := ""
|
||||||
|
switch dirF := dir.(type) {
|
||||||
|
case *Files:
|
||||||
|
folderSpace = dirF.GetSpace()
|
||||||
|
default:
|
||||||
|
// 处理 根目录的情况
|
||||||
|
folderSpace = ThunderBrowserDriveSpace
|
||||||
|
}
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"parent_id": folderId,
|
"parent_id": dir.GetID(),
|
||||||
"page_token": pageToken,
|
"page_token": pageToken,
|
||||||
"space": folderSpace,
|
"space": folderSpace,
|
||||||
"filters": `{"trashed":{"eq":false}}`,
|
"filters": `{"trashed":{"eq":false}}`,
|
||||||
|
"with": "url",
|
||||||
"with_audit": "true",
|
"with_audit": "true",
|
||||||
"thumbnail_size": "SIZE_LARGE",
|
"thumbnail_size": "SIZE_LARGE",
|
||||||
}
|
}
|
||||||
var fileType int8
|
|
||||||
// 处理特殊目录 “迅雷云盘” 设置特殊的 params 以便正常访问
|
|
||||||
pattern1 := fmt.Sprintf(`^/.*/%s(/.*)?$`, ThunderDriveFolderName)
|
|
||||||
thunderDriveMatch, _ := regexp.MatchString(pattern1, path)
|
|
||||||
// 处理特殊目录 “超级保险箱” 设置特殊的 params 以便正常访问
|
|
||||||
pattern2 := fmt.Sprintf(`^/.*/%s(/.*)?$`, ThunderBrowserDriveSafeFolderName)
|
|
||||||
thunderBrowserDriveSafeMatch, _ := regexp.MatchString(pattern2, path)
|
|
||||||
|
|
||||||
// 如果是 "迅雷云盘" 内的
|
|
||||||
if folderId == ThunderDriveFileID || thunderDriveMatch {
|
|
||||||
params = map[string]string{
|
|
||||||
"space": "",
|
|
||||||
"__type": "drive",
|
|
||||||
"refresh": "true",
|
|
||||||
"__sync": "true",
|
|
||||||
"parent_id": folderId,
|
|
||||||
"page_token": pageToken,
|
|
||||||
"with_audit": "true",
|
|
||||||
"limit": "100",
|
|
||||||
"filters": `{"phase":{"eq":"PHASE_TYPE_COMPLETE"},"trashed":{"eq":false}}`,
|
|
||||||
}
|
|
||||||
// 如果不是 "迅雷云盘"的"根目录"
|
|
||||||
if folderId == ThunderDriveFileID {
|
|
||||||
params["parent_id"] = ""
|
|
||||||
}
|
|
||||||
fileType = ThunderDriveType
|
|
||||||
} else if thunderBrowserDriveSafeMatch {
|
|
||||||
// 如果是 "超级保险箱" 内的
|
|
||||||
fileType = ThunderBrowserDriveSafeType
|
|
||||||
params["space"] = "SPACE_BROWSER_SAFE"
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := xc.Request(FILE_API_URL, http.MethodGet, func(r *resty.Request) {
|
_, err := xc.Request(FILE_API_URL, http.MethodGet, func(r *resty.Request) {
|
||||||
r.SetContext(ctx)
|
r.SetContext(ctx)
|
||||||
|
@ -670,24 +545,13 @@ func (xc *XunLeiBrowserCommon) getFiles(ctx context.Context, folderId string, pa
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// 对文件夹也进行处理
|
|
||||||
fileList.FolderType = fileType
|
|
||||||
|
|
||||||
for i := 0; i < len(fileList.Files); i++ {
|
for i := range fileList.Files {
|
||||||
file := &fileList.Files[i]
|
|
||||||
// 标记 文件夹内的文件
|
|
||||||
file.FileType = fileList.FolderType
|
|
||||||
// 解决 "迅雷云盘" 重复出现问题————迅雷后端发送错误
|
// 解决 "迅雷云盘" 重复出现问题————迅雷后端发送错误
|
||||||
if file.Name == ThunderDriveFolderName && file.ID == "" && file.FolderType == ThunderDriveFolderType && folderId != "" {
|
if fileList.Files[i].FolderType == ThunderDriveFolderType && fileList.Files[i].ID == "" && fileList.Files[i].Space == "" && dir.GetID() != "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// 处理特殊目录 “迅雷云盘” 设置特殊的文件夹ID
|
files = append(files, &fileList.Files[i])
|
||||||
if file.Name == ThunderDriveFolderName && file.ID == "" && file.FolderType == ThunderDriveFolderType {
|
|
||||||
file.ID = ThunderDriveFileID
|
|
||||||
} else if file.Name == ThunderBrowserDriveSafeFolderName && file.FolderType == ThunderBrowserDriveSafeFolderType {
|
|
||||||
file.FileType = ThunderBrowserDriveSafeType
|
|
||||||
}
|
|
||||||
files = append(files, file)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileList.NextPageToken == "" {
|
if fileList.NextPageToken == "" {
|
||||||
|
|
|
@ -25,7 +25,7 @@ type ExpertAddition struct {
|
||||||
SafePassword string `json:"safe_password" required:"true" help:"super safe password"` // 超级保险箱密码
|
SafePassword string `json:"safe_password" required:"true" help:"super safe password"` // 超级保险箱密码
|
||||||
|
|
||||||
// 签名方法1
|
// 签名方法1
|
||||||
Algorithms string `json:"algorithms" required:"true" help:"sign type is algorithms,this is required" default:"p+ExqPV,LwdwKlprzv7cQBQmxN5,vc08P1NwUBnbGsl58LzTW,VVNeXaXmZ8HH1SJEnp6YpVFSFU,pNAOJ,CNChvyDehAmUR1TDodfOusBAx,MS98NnX4Np8nxvEh6Ulv+SMMKMzKvD34C7lGWbb,9MpFF21GnVOYku0NM9Y/hzsK471UCUZ2o+,EY1QfeA06fXlw9wZNoZaXEED5zZPvNWI,,sciE,FIPqgQDUUW1e0GkiBFd5w7mCQ,zW,75XFdEO0Gi"`
|
Algorithms string `json:"algorithms" required:"true" help:"sign type is algorithms,this is required" default:"uWRwO7gPfdPB/0NfPtfQO+71,F93x+qPluYy6jdgNpq+lwdH1ap6WOM+nfz8/V,0HbpxvpXFsBK5CoTKam,dQhzbhzFRcawnsZqRETT9AuPAJ+wTQso82mRv,SAH98AmLZLRa6DB2u68sGhyiDh15guJpXhBzI,unqfo7Z64Rie9RNHMOB,7yxUdFADp3DOBvXdz0DPuKNVT35wqa5z0DEyEvf,RBG,ThTWPG5eC0UBqlbQ+04nZAptqGCdpv9o55A"`
|
||||||
// 签名方法2
|
// 签名方法2
|
||||||
CaptchaSign string `json:"captcha_sign" required:"true" help:"sign type is captcha_sign,this is required"`
|
CaptchaSign string `json:"captcha_sign" required:"true" help:"sign type is captcha_sign,this is required"`
|
||||||
Timestamp string `json:"timestamp" required:"true" help:"sign type is captcha_sign,this is required"`
|
Timestamp string `json:"timestamp" required:"true" help:"sign type is captcha_sign,this is required"`
|
||||||
|
@ -37,7 +37,7 @@ type ExpertAddition struct {
|
||||||
DeviceID string `json:"device_id" required:"false" default:""`
|
DeviceID string `json:"device_id" required:"false" default:""`
|
||||||
ClientID string `json:"client_id" required:"true" default:"ZUBzD9J_XPXfn7f7"`
|
ClientID string `json:"client_id" required:"true" default:"ZUBzD9J_XPXfn7f7"`
|
||||||
ClientSecret string `json:"client_secret" required:"true" default:"yESVmHecEe6F0aou69vl-g"`
|
ClientSecret string `json:"client_secret" required:"true" default:"yESVmHecEe6F0aou69vl-g"`
|
||||||
ClientVersion string `json:"client_version" required:"true" default:"1.0.8.2215"`
|
ClientVersion string `json:"client_version" required:"true" default:"1.10.0.2633"`
|
||||||
PackageName string `json:"package_name" required:"true" default:"com.xunlei.browser"`
|
PackageName string `json:"package_name" required:"true" default:"com.xunlei.browser"`
|
||||||
|
|
||||||
// 不影响登录,影响下载速度
|
// 不影响登录,影响下载速度
|
||||||
|
|
|
@ -114,8 +114,8 @@ type Files struct {
|
||||||
ModifiedTime CustomTime `json:"modified_time"`
|
ModifiedTime CustomTime `json:"modified_time"`
|
||||||
IconLink string `json:"icon_link"`
|
IconLink string `json:"icon_link"`
|
||||||
ThumbnailLink string `json:"thumbnail_link"`
|
ThumbnailLink string `json:"thumbnail_link"`
|
||||||
// Md5Checksum string `json:"md5_checksum"`
|
Md5Checksum string `json:"md5_checksum"`
|
||||||
Hash string `json:"hash"`
|
Hash string `json:"hash"`
|
||||||
// Links map[string]Link `json:"links"`
|
// Links map[string]Link `json:"links"`
|
||||||
// Phase string `json:"phase"`
|
// Phase string `json:"phase"`
|
||||||
// Audit struct {
|
// Audit struct {
|
||||||
|
@ -153,12 +153,22 @@ type Files struct {
|
||||||
OriginalURL string `json:"original_url"`
|
OriginalURL string `json:"original_url"`
|
||||||
//Params struct{} `json:"params"`
|
//Params struct{} `json:"params"`
|
||||||
//OriginalFileIndex int `json:"original_file_index"`
|
//OriginalFileIndex int `json:"original_file_index"`
|
||||||
//Space string `json:"space"`
|
Space string `json:"space"`
|
||||||
//Apps []interface{} `json:"apps"`
|
//Apps []interface{} `json:"apps"`
|
||||||
//Writable bool `json:"writable"`
|
//Writable bool `json:"writable"`
|
||||||
FolderType string `json:"folder_type"`
|
FolderType string `json:"folder_type"`
|
||||||
//Collection interface{} `json:"collection"`
|
//Collection interface{} `json:"collection"`
|
||||||
FileType int8
|
SortName string `json:"sort_name"`
|
||||||
|
UserModifiedTime CustomTime `json:"user_modified_time"`
|
||||||
|
//SpellName []interface{} `json:"spell_name"`
|
||||||
|
//FileCategory string `json:"file_category"`
|
||||||
|
//Tags []interface{} `json:"tags"`
|
||||||
|
//ReferenceEvents []interface{} `json:"reference_events"`
|
||||||
|
//ReferenceResource interface{} `json:"reference_resource"`
|
||||||
|
//Params0 struct {
|
||||||
|
// PlatformIcon string `json:"platform_icon"`
|
||||||
|
// SmallThumbnail string `json:"small_thumbnail"`
|
||||||
|
//} `json:"params,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Files) GetHash() utils.HashInfo {
|
func (c *Files) GetHash() utils.HashInfo {
|
||||||
|
@ -172,16 +182,19 @@ func (c *Files) ModTime() time.Time { return c.ModifiedTime.Time }
|
||||||
func (c *Files) IsDir() bool { return c.Kind == FOLDER }
|
func (c *Files) IsDir() bool { return c.Kind == FOLDER }
|
||||||
func (c *Files) GetID() string { return c.ID }
|
func (c *Files) GetID() string { return c.ID }
|
||||||
func (c *Files) GetPath() string {
|
func (c *Files) GetPath() string {
|
||||||
// 对特殊文件进行特殊处理
|
|
||||||
if c.FileType == ThunderDriveType {
|
|
||||||
return ThunderDriveFileID
|
|
||||||
} else if c.FileType == ThunderBrowserDriveSafeType {
|
|
||||||
return ThunderBrowserDriveSafeFileID
|
|
||||||
}
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
func (c *Files) Thumb() string { return c.ThumbnailLink }
|
func (c *Files) Thumb() string { return c.ThumbnailLink }
|
||||||
|
|
||||||
|
func (c *Files) GetSpace() string {
|
||||||
|
if c.Space != "" {
|
||||||
|
return c.Space
|
||||||
|
} else {
|
||||||
|
// "迅雷云盘" 文件夹内 Space 为空
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 上传
|
* 上传
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -23,29 +23,24 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var Algorithms = []string{
|
var Algorithms = []string{
|
||||||
"p+ExqPV",
|
"uWRwO7gPfdPB/0NfPtfQO+71",
|
||||||
"LwdwKlprzv7cQBQmxN5",
|
"F93x+qPluYy6jdgNpq+lwdH1ap6WOM+nfz8/V",
|
||||||
"vc08P1NwUBnbGsl58LzTW",
|
"0HbpxvpXFsBK5CoTKam",
|
||||||
"VVNeXaXmZ8HH1SJEnp6YpVFSFU",
|
"dQhzbhzFRcawnsZqRETT9AuPAJ+wTQso82mRv",
|
||||||
"pNAOJ",
|
"SAH98AmLZLRa6DB2u68sGhyiDh15guJpXhBzI",
|
||||||
"CNChvyDehAmUR1TDodfOusBAx",
|
"unqfo7Z64Rie9RNHMOB",
|
||||||
"MS98NnX4Np8nxvEh6Ulv+SMMKMzKvD34C7lGWbb",
|
"7yxUdFADp3DOBvXdz0DPuKNVT35wqa5z0DEyEvf",
|
||||||
"9MpFF21GnVOYku0NM9Y/hzsK471UCUZ2o+",
|
"RBG",
|
||||||
"EY1QfeA06fXlw9wZNoZaXEED5zZPvNWI",
|
"ThTWPG5eC0UBqlbQ+04nZAptqGCdpv9o55A",
|
||||||
"",
|
|
||||||
"sciE",
|
|
||||||
"FIPqgQDUUW1e0GkiBFd5w7mCQ",
|
|
||||||
"zW",
|
|
||||||
"75XFdEO0Gi",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ClientID = "ZUBzD9J_XPXfn7f7"
|
ClientID = "ZUBzD9J_XPXfn7f7"
|
||||||
ClientSecret = "yESVmHecEe6F0aou69vl-g"
|
ClientSecret = "yESVmHecEe6F0aou69vl-g"
|
||||||
ClientVersion = "1.0.8.2215"
|
ClientVersion = "1.10.0.2633"
|
||||||
PackageName = "com.xunlei.browser"
|
PackageName = "com.xunlei.browser"
|
||||||
DownloadUserAgent = "AndroidDownloadManager/13 (Linux; U; Android 13; M2004J7AC Build/SP1A.210812.016)"
|
DownloadUserAgent = "AndroidDownloadManager/13 (Linux; U; Android 13; M2004J7AC Build/SP1A.210812.016)"
|
||||||
SdkVersion = "2.0.3.262"
|
SdkVersion = "233100"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -62,12 +57,10 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ThunderDriveFileID = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
|
ThunderDriveSpace = ""
|
||||||
ThunderBrowserDriveSafeFileID = "YYYYYYYYYYYYYYYYYYYYYYYYYY"
|
ThunderDriveSafeSpace = "SPACE_SAFE"
|
||||||
ThunderDriveFolderName = "迅雷云盘"
|
ThunderBrowserDriveSpace = "SPACE_BROWSER"
|
||||||
ThunderBrowserDriveSafeFolderName = "超级保险箱"
|
ThunderBrowserDriveSafeSpace = "SPACE_BROWSER_SAFE"
|
||||||
ThunderDriveType = 1
|
|
||||||
ThunderBrowserDriveSafeType = 2
|
|
||||||
ThunderDriveFolderType = "DEFAULT_ROOT"
|
ThunderDriveFolderType = "DEFAULT_ROOT"
|
||||||
ThunderBrowserDriveSafeFolderType = "BROWSER_SAFE"
|
ThunderBrowserDriveSafeFolderType = "BROWSER_SAFE"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue