chore: rename `xunlei` to `thunder`

pull/1831/head
Noah Hsu 2022-09-11 14:30:17 +08:00
parent 77a6aa487b
commit 8b72ac7f80
5 changed files with 20 additions and 20 deletions

View File

@ -17,10 +17,10 @@ import (
_ "github.com/alist-org/alist/v3/drivers/s3" _ "github.com/alist-org/alist/v3/drivers/s3"
_ "github.com/alist-org/alist/v3/drivers/sftp" _ "github.com/alist-org/alist/v3/drivers/sftp"
_ "github.com/alist-org/alist/v3/drivers/teambition" _ "github.com/alist-org/alist/v3/drivers/teambition"
_ "github.com/alist-org/alist/v3/drivers/thunder"
_ "github.com/alist-org/alist/v3/drivers/uss" _ "github.com/alist-org/alist/v3/drivers/uss"
_ "github.com/alist-org/alist/v3/drivers/virtual" _ "github.com/alist-org/alist/v3/drivers/virtual"
_ "github.com/alist-org/alist/v3/drivers/webdav" _ "github.com/alist-org/alist/v3/drivers/webdav"
_ "github.com/alist-org/alist/v3/drivers/xunlei"
_ "github.com/alist-org/alist/v3/drivers/yandex_disk" _ "github.com/alist-org/alist/v3/drivers/yandex_disk"
) )

View File

@ -1,4 +1,4 @@
package xunlei package thunder
import ( import (
"context" "context"
@ -22,7 +22,7 @@ import (
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
) )
type XunLei struct { type Thunder struct {
*XunLeiCommon *XunLeiCommon
model.Storage model.Storage
Addition Addition
@ -30,15 +30,15 @@ type XunLei struct {
identity string identity string
} }
func (x *XunLei) Config() driver.Config { func (x *Thunder) Config() driver.Config {
return config return config
} }
func (x *XunLei) GetAddition() driver.Additional { func (x *Thunder) GetAddition() driver.Additional {
return x.Addition return x.Addition
} }
func (x *XunLei) Init(ctx context.Context, storage model.Storage) (err error) { func (x *Thunder) Init(ctx context.Context, storage model.Storage) (err error) {
x.Storage = storage x.Storage = storage
if err = utils.Json.UnmarshalFromString(x.Storage.Addition, &x.Addition); err != nil { if err = utils.Json.UnmarshalFromString(x.Storage.Addition, &x.Addition); err != nil {
return err return err
@ -108,11 +108,11 @@ func (x *XunLei) Init(ctx context.Context, storage model.Storage) (err error) {
return nil return nil
} }
func (x *XunLei) Drop(ctx context.Context) error { func (x *Thunder) Drop(ctx context.Context) error {
return nil return nil
} }
type XunLeiExpert struct { type ThunderExpert struct {
*XunLeiCommon *XunLeiCommon
model.Storage model.Storage
ExpertAddition ExpertAddition
@ -120,15 +120,15 @@ type XunLeiExpert struct {
identity string identity string
} }
func (x *XunLeiExpert) Config() driver.Config { func (x *ThunderExpert) Config() driver.Config {
return configExpert return configExpert
} }
func (x *XunLeiExpert) GetAddition() driver.Additional { func (x *ThunderExpert) GetAddition() driver.Additional {
return x.ExpertAddition return x.ExpertAddition
} }
func (x *XunLeiExpert) Init(ctx context.Context, storage model.Storage) (err error) { func (x *ThunderExpert) Init(ctx context.Context, storage model.Storage) (err error) {
x.Storage = storage x.Storage = storage
if err = utils.Json.UnmarshalFromString(x.Storage.Addition, &x.ExpertAddition); err != nil { if err = utils.Json.UnmarshalFromString(x.Storage.Addition, &x.ExpertAddition); err != nil {
return err return err
@ -216,11 +216,11 @@ func (x *XunLeiExpert) Init(ctx context.Context, storage model.Storage) (err err
return nil return nil
} }
func (x *XunLeiExpert) Drop(ctx context.Context) error { func (x *ThunderExpert) Drop(ctx context.Context) error {
return nil return nil
} }
func (x *XunLeiExpert) SetTokenResp(token *TokenResp) { func (x *ThunderExpert) SetTokenResp(token *TokenResp) {
x.XunLeiCommon.SetTokenResp(token) x.XunLeiCommon.SetTokenResp(token)
if token != nil { if token != nil {
x.ExpertAddition.RefreshToken = token.RefreshToken x.ExpertAddition.RefreshToken = token.RefreshToken

View File

@ -1,4 +1,4 @@
package xunlei package thunder
import ( import (
"crypto/md5" "crypto/md5"
@ -79,21 +79,21 @@ func (i *Addition) GetIdentity() string {
} }
var config = driver.Config{ var config = driver.Config{
Name: "XunLei", Name: "Thunder",
LocalSort: true, LocalSort: true,
OnlyProxy: true, OnlyProxy: true,
} }
var configExpert = driver.Config{ var configExpert = driver.Config{
Name: "XunLeiExpert", Name: "ThunderExpert",
LocalSort: true, LocalSort: true,
} }
func init() { func init() {
op.RegisterDriver(config, func() driver.Driver { op.RegisterDriver(config, func() driver.Driver {
return &XunLei{} return &Thunder{}
}) })
op.RegisterDriver(configExpert, func() driver.Driver { op.RegisterDriver(configExpert, func() driver.Driver {
return &XunLeiExpert{} return &ThunderExpert{}
}) })
} }

View File

@ -1,4 +1,4 @@
package xunlei package thunder
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package xunlei package thunder
import ( import (
"fmt" "fmt"