style: shorten name operations to op

This commit is contained in:
Noah Hsu
2022-08-31 21:01:15 +08:00
parent 9ec6d5be7a
commit 7ac1d14eeb
35 changed files with 110 additions and 110 deletions

View File

@ -48,7 +48,7 @@ func (d *AliDrive) Init(ctx context.Context, storage model.Storage) error {
return err
}
// TODO login / refresh token
//operations.MustSaveDriverStorage(d)
//op.MustSaveDriverStorage(d)
err = d.refreshToken()
if err != nil {
return err

View File

@ -2,7 +2,7 @@ package local
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
)
type Addition struct {
@ -23,5 +23,5 @@ func New() driver.Driver {
}
func init() {
operations.RegisterDriver(config, New)
op.RegisterDriver(config, New)
}

View File

@ -6,7 +6,7 @@ import (
"net/http"
"github.com/alist-org/alist/v3/drivers/base"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/go-resty/resty/v2"
)
@ -30,7 +30,7 @@ func (d *AliDrive) refreshToken() error {
return fmt.Errorf("failed to refresh token: %s", e.Message)
}
d.RefreshToken, d.AccessToken = resp.RefreshToken, resp.AccessToken
operations.MustSaveDriverStorage(d)
op.MustSaveDriverStorage(d)
return nil
}

View File

@ -18,7 +18,7 @@ import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/alist-org/alist/v3/server/common"
"github.com/disintegration/imaging"
@ -49,7 +49,7 @@ func (d *Local) Init(ctx context.Context, storage model.Storage) error {
}
}
}
operations.MustSaveDriverStorage(d)
op.MustSaveDriverStorage(d)
return err
}

View File

@ -2,7 +2,7 @@ package local
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
)
type Addition struct {
@ -23,5 +23,5 @@ func New() driver.Driver {
}
func init() {
operations.RegisterDriver(config, New)
op.RegisterDriver(config, New)
}

View File

@ -2,7 +2,7 @@ package onedrive
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
)
type Addition struct {
@ -27,5 +27,5 @@ func New() driver.Driver {
}
func init() {
operations.RegisterDriver(config, New)
op.RegisterDriver(config, New)
}

View File

@ -14,7 +14,7 @@ import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/go-resty/resty/v2"
jsoniter "github.com/json-iterator/go"
@ -92,7 +92,7 @@ func (d *Onedrive) _refreshToken() error {
return errs.EmptyToken
}
d.RefreshToken, d.AccessToken = resp.RefreshToken, resp.AccessToken
operations.MustSaveDriverStorage(d)
op.MustSaveDriverStorage(d)
return nil
}

View File

@ -2,7 +2,7 @@ package local
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
)
type Addition struct {
@ -22,5 +22,5 @@ func New() driver.Driver {
}
func init() {
operations.RegisterDriver(config, New)
op.RegisterDriver(config, New)
}

View File

@ -5,7 +5,7 @@ import (
"net/http"
"github.com/alist-org/alist/v3/drivers/base"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/go-resty/resty/v2"
jsoniter "github.com/json-iterator/go"
)
@ -46,7 +46,7 @@ func (d *PikPak) refreshToken() error {
}).Post(url)
if err != nil {
d.Status = err.Error()
operations.MustSaveDriverStorage(d)
op.MustSaveDriverStorage(d)
return err
}
if e.ErrorCode != 0 {
@ -55,14 +55,14 @@ func (d *PikPak) refreshToken() error {
return d.login()
}
d.Status = e.Error
operations.MustSaveDriverStorage(d)
op.MustSaveDriverStorage(d)
return errors.New(e.Error)
}
data := res.Body()
d.Status = "work"
d.RefreshToken = jsoniter.Get(data, "refresh_token").ToString()
d.AccessToken = jsoniter.Get(data, "access_token").ToString()
operations.MustSaveDriverStorage(d)
op.MustSaveDriverStorage(d)
return nil
}

View File

@ -29,7 +29,7 @@ func (d *Template) Init(ctx context.Context, storage model.Storage) error {
return err
}
// TODO login / refresh token
//operations.MustSaveDriverStorage(d)
//op.MustSaveDriverStorage(d)
return err
}

View File

@ -2,7 +2,7 @@ package local
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
)
type Addition struct {
@ -29,5 +29,5 @@ func New() driver.Driver {
}
func init() {
operations.RegisterDriver(config, New)
op.RegisterDriver(config, New)
}

View File

@ -2,7 +2,7 @@ package virtual
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
)
type Addition struct {
@ -26,5 +26,5 @@ func New() driver.Driver {
}
func init() {
operations.RegisterDriver(config, New)
op.RegisterDriver(config, New)
}