Skip to content

Commit

Permalink
fix(123pan): use local sort (close #6820)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jul 21, 2024
1 parent 2d57529 commit cbd4bef
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions drivers/123/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ type Addition struct {
Username string `json:"username" required:"true"`
Password string `json:"password" required:"true"`
driver.RootID
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"`
AccessToken string
//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"`
AccessToken string
}

var config = driver.Config{
Name: "123Pan",
DefaultRoot: "0",
LocalSort: true,
}

func init() {
Expand Down
8 changes: 5 additions & 3 deletions drivers/123/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/alist-org/alist/v3/pkg/utils"
resty "github.com/go-resty/resty/v2"
jsoniter "github.com/json-iterator/go"
log "github.com/sirupsen/logrus"

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

log redeclared in this block

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

"github.com/sirupsen/logrus" imported as log and not used

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

log redeclared in this block

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

"github.com/sirupsen/logrus" imported as log and not used

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

log redeclared in this block

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

"github.com/sirupsen/logrus" imported as log and not used

Check failure on line 20 in drivers/123/util.go

View workflow job for this annotation

GitHub Actions / Build Docker

log redeclared in this block
)

// do others that not defined in Driver interface
Expand Down Expand Up @@ -248,8 +249,8 @@ func (d *Pan123) getFiles(parentId string, name string) ([]File, error) {
"driveId": "0",
"limit": "100",
"next": "0",
"orderBy": d.OrderBy,
"orderDirection": d.OrderDirection,
"orderBy": "file_id",
"orderDirection": "desc",
"parentFileId": parentId,
"trashed": "false",
"SearchData": "",
Expand All @@ -259,12 +260,13 @@ func (d *Pan123) getFiles(parentId string, name string) ([]File, error) {
"operateType": "4",
"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)
}, &resp)
if err != nil {
return nil, err
}
log.Debug(string(_res))
page++
res = append(res, resp.Data.InfoList...)
total = resp.Data.Total
Expand Down
6 changes: 3 additions & 3 deletions drivers/123_share/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ type Addition struct {
ShareKey string `json:"sharekey" required:"true"`
SharePwd string `json:"sharepassword"`
driver.RootID
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"`
AccessToken string `json:"accesstoken" type:"text"`
//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"`
AccessToken string `json:"accesstoken" type:"text"`
}

var config = driver.Config{
Expand Down
4 changes: 2 additions & 2 deletions drivers/123_share/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func (d *Pan123Share) getFiles(parentId string) ([]File, error) {
query := map[string]string{
"limit": "100",
"next": "0",
"orderBy": d.OrderBy,
"orderDirection": d.OrderDirection,
"orderBy": "file_id",
"orderDirection": "desc",
"parentFileId": parentId,
"Page": strconv.Itoa(page),
"shareKey": d.ShareKey,
Expand Down

0 comments on commit cbd4bef

Please sign in to comment.