mirror of https://github.com/Xhofe/alist
fix(123pan): use local sort (close #6820)
parent
2d57529e77
commit
cbd4bef814
|
@ -9,14 +9,15 @@ type Addition struct {
|
||||||
Username string `json:"username" required:"true"`
|
Username string `json:"username" required:"true"`
|
||||||
Password string `json:"password" required:"true"`
|
Password string `json:"password" required:"true"`
|
||||||
driver.RootID
|
driver.RootID
|
||||||
OrderBy string `json:"order_by" type:"select" options:"file_name,size,update_at" default:"file_name"`
|
//OrderBy string `json:"order_by" type:"select" options:"file_id,file_name,size,update_at" default:"file_name"`
|
||||||
OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
|
//OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
|
||||||
AccessToken string
|
AccessToken string
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = driver.Config{
|
var config = driver.Config{
|
||||||
Name: "123Pan",
|
Name: "123Pan",
|
||||||
DefaultRoot: "0",
|
DefaultRoot: "0",
|
||||||
|
LocalSort: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"github.com/alist-org/alist/v3/pkg/utils"
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
resty "github.com/go-resty/resty/v2"
|
resty "github.com/go-resty/resty/v2"
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// do others that not defined in Driver interface
|
// do others that not defined in Driver interface
|
||||||
|
@ -248,8 +249,8 @@ func (d *Pan123) getFiles(parentId string, name string) ([]File, error) {
|
||||||
"driveId": "0",
|
"driveId": "0",
|
||||||
"limit": "100",
|
"limit": "100",
|
||||||
"next": "0",
|
"next": "0",
|
||||||
"orderBy": d.OrderBy,
|
"orderBy": "file_id",
|
||||||
"orderDirection": d.OrderDirection,
|
"orderDirection": "desc",
|
||||||
"parentFileId": parentId,
|
"parentFileId": parentId,
|
||||||
"trashed": "false",
|
"trashed": "false",
|
||||||
"SearchData": "",
|
"SearchData": "",
|
||||||
|
@ -259,12 +260,13 @@ func (d *Pan123) getFiles(parentId string, name string) ([]File, error) {
|
||||||
"operateType": "4",
|
"operateType": "4",
|
||||||
"inDirectSpace": "false",
|
"inDirectSpace": "false",
|
||||||
}
|
}
|
||||||
_, err := d.request(FileList, http.MethodGet, func(req *resty.Request) {
|
_res, err := d.request(FileList, http.MethodGet, func(req *resty.Request) {
|
||||||
req.SetQueryParams(query)
|
req.SetQueryParams(query)
|
||||||
}, &resp)
|
}, &resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
log.Debug(string(_res))
|
||||||
page++
|
page++
|
||||||
res = append(res, resp.Data.InfoList...)
|
res = append(res, resp.Data.InfoList...)
|
||||||
total = resp.Data.Total
|
total = resp.Data.Total
|
||||||
|
|
|
@ -9,8 +9,8 @@ type Addition struct {
|
||||||
ShareKey string `json:"sharekey" required:"true"`
|
ShareKey string `json:"sharekey" required:"true"`
|
||||||
SharePwd string `json:"sharepassword"`
|
SharePwd string `json:"sharepassword"`
|
||||||
driver.RootID
|
driver.RootID
|
||||||
OrderBy string `json:"order_by" type:"select" options:"file_name,size,update_at" default:"file_name"`
|
//OrderBy string `json:"order_by" type:"select" options:"file_name,size,update_at" default:"file_name"`
|
||||||
OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
|
//OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
|
||||||
AccessToken string `json:"accesstoken" type:"text"`
|
AccessToken string `json:"accesstoken" type:"text"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ func (d *Pan123Share) getFiles(parentId string) ([]File, error) {
|
||||||
query := map[string]string{
|
query := map[string]string{
|
||||||
"limit": "100",
|
"limit": "100",
|
||||||
"next": "0",
|
"next": "0",
|
||||||
"orderBy": d.OrderBy,
|
"orderBy": "file_id",
|
||||||
"orderDirection": d.OrderDirection,
|
"orderDirection": "desc",
|
||||||
"parentFileId": parentId,
|
"parentFileId": parentId,
|
||||||
"Page": strconv.Itoa(page),
|
"Page": strconv.Itoa(page),
|
||||||
"shareKey": d.ShareKey,
|
"shareKey": d.ShareKey,
|
||||||
|
|
Loading…
Reference in New Issue