🎨 change proxy interface
This commit is contained in:
@ -6,9 +6,9 @@ import (
|
||||
"github.com/Xhofe/alist/drivers/base"
|
||||
"github.com/Xhofe/alist/model"
|
||||
"github.com/Xhofe/alist/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/robfig/cron/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
@ -205,8 +205,8 @@ func (driver Onedrive) Path(path string, account *model.Account) (*model.File, [
|
||||
return nil, files, nil
|
||||
}
|
||||
|
||||
func (driver Onedrive) Proxy(c *gin.Context, account *model.Account) {
|
||||
c.Request.Header.Del("Origin")
|
||||
func (driver Onedrive) Proxy(r *http.Request, account *model.Account) {
|
||||
r.Header.Del("Origin")
|
||||
}
|
||||
|
||||
func (driver Onedrive) Preview(path string, account *model.Account) (interface{}, error) {
|
||||
|
@ -81,7 +81,7 @@ type OneTokenErr struct {
|
||||
|
||||
func (driver Onedrive) RefreshToken(account *model.Account) error {
|
||||
err := driver.refreshToken(account)
|
||||
if err != nil && err.Error() == "empty refresh_token" {
|
||||
if err != nil && err == base.ErrEmptyToken {
|
||||
return driver.refreshToken(account)
|
||||
}
|
||||
return err
|
||||
@ -109,8 +109,8 @@ func (driver Onedrive) refreshToken(account *model.Account) error {
|
||||
account.Status = "work"
|
||||
}
|
||||
if resp.RefreshToken == "" {
|
||||
account.Status = "empty refresh_token"
|
||||
return errors.New("empty refresh_token")
|
||||
account.Status = base.ErrEmptyToken.Error()
|
||||
return base.ErrEmptyToken
|
||||
}
|
||||
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user