Skip to content

Commit

Permalink
Merge branch 'AlistGo:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
arrio464 authored Jan 30, 2025
2 parents a257b2e + b9f397d commit 4e4e7bb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
47 changes: 24 additions & 23 deletions drivers/139/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package _139

import (
"context"
"encoding/base64"
"fmt"
"io"
"net/http"
"path"
"strconv"
"strings"
"time"

"github.com/alist-org/alist/v3/drivers/base"
Expand Down Expand Up @@ -69,29 +71,28 @@ func (d *Yun139) Init(ctx context.Context) error {
default:
return errs.NotImplement
}
// if d.ref != nil {
// return nil
// }
// decode, err := base64.StdEncoding.DecodeString(d.Authorization)
// if err != nil {
// return err
// }
// decodeStr := string(decode)
// splits := strings.Split(decodeStr, ":")
// if len(splits) < 2 {
// return fmt.Errorf("authorization is invalid, splits < 2")
// }
// d.Account = splits[1]
// _, err = d.post("/orchestration/personalCloud/user/v1.0/qryUserExternInfo", base.Json{
// "qryUserExternInfoReq": base.Json{
// "commonAccountInfo": base.Json{
// "account": d.getAccount(),
// "accountType": 1,
// },
// },
// }, nil)
// return err
return nil
if d.ref != nil {
return nil
}
decode, err := base64.StdEncoding.DecodeString(d.Authorization)
if err != nil {
return err
}
decodeStr := string(decode)
splits := strings.Split(decodeStr, ":")
if len(splits) < 2 {
return fmt.Errorf("authorization is invalid, splits < 2")
}
d.Account = splits[1]
_, err = d.post("/orchestration/personalCloud/user/v1.0/qryUserExternInfo", base.Json{
"qryUserExternInfoReq": base.Json{
"commonAccountInfo": base.Json{
"account": d.getAccount(),
"accountType": 1,
},
},
}, nil)
return err
}

func (d *Yun139) InitReference(storage driver.Driver) error {
Expand Down
4 changes: 4 additions & 0 deletions drivers/febbox/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package febbox
import (
"encoding/json"
"errors"
"fmt"
"github.com/alist-org/alist/v3/drivers/base"
"github.com/alist-org/alist/v3/internal/op"
"github.com/go-resty/resty/v2"
Expand Down Expand Up @@ -135,6 +136,9 @@ func (d *FebBox) getDownloadLink(id string, ip string) (string, error) {
if err = json.Unmarshal(res, &fileDownloadResp); err != nil {
return "", err
}
if len(fileDownloadResp.Data) == 0 {
return "", fmt.Errorf("can not get download link, code:%d, msg:%s", fileDownloadResp.Code, fileDownloadResp.Msg)
}

return fileDownloadResp.Data[0].DownloadURL, nil
}
Expand Down

0 comments on commit 4e4e7bb

Please sign in to comment.