-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
153 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package drivers | ||
|
||
import ( | ||
_ "github.com/alist-org/alist/v3/drivers/local" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,93 @@ | ||
package local | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"github.com/alist-org/alist/v3/internal/driver" | ||
"github.com/alist-org/alist/v3/internal/model" | ||
"github.com/alist-org/alist/v3/pkg/utils" | ||
) | ||
|
||
type Driver struct { | ||
model.Account | ||
Addition | ||
} | ||
|
||
func (d Driver) Config() driver.Config { | ||
return config | ||
} | ||
|
||
func (d *Driver) Init(ctx context.Context, account model.Account) error { | ||
addition := d.Account.Addition | ||
err := utils.Json.UnmarshalFromString(addition, d.Addition) | ||
if err != nil { | ||
return errors.New("error") | ||
} | ||
return nil | ||
} | ||
|
||
func (d *Driver) Update(ctx context.Context, account model.Account) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Drop(ctx context.Context) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) GetAccount() model.Account { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) File(ctx context.Context, path string) (*driver.FileInfo, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) List(ctx context.Context, path string) ([]driver.FileInfo, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Link(ctx context.Context, args driver.LinkArgs) (*driver.Link, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) MakeDir(ctx context.Context, path string) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Move(ctx context.Context, src, dst string) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Rename(ctx context.Context, src, dst string) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Copy(ctx context.Context, src, dst string) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Remove(ctx context.Context, path string) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
func (d *Driver) Put(ctx context.Context, stream driver.FileStream, parentPath string) error { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
var _ driver.Driver = (*Driver)(nil) | ||
|
||
func init() { | ||
driver.RegisterDriver(config.Name, New) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package local | ||
|
||
import "github.com/alist-org/alist/v3/internal/driver" | ||
|
||
type Addition struct { | ||
RootFolder string `json:"root_folder" type:"string" desc:"root folder path" default:"/"` | ||
} | ||
|
||
var config = driver.Config{ | ||
Name: "Local", | ||
OnlyLocal: true, | ||
LocalSort: true, | ||
} | ||
|
||
func New() driver.Driver { | ||
return &Driver{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
package driver | ||
|
||
type Addition interface { | ||
type Additional interface { | ||
} | ||
|
||
type Item struct { | ||
Name string `json:"name"` | ||
Type string `json:"type"` | ||
Default string `json:"default"` | ||
Values string `json:"values"` | ||
Required bool `json:"required"` | ||
Desc string `json:"desc"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ package driver | |
type Config struct { | ||
Name string | ||
LocalSort bool | ||
OnlyLocal bool | ||
OnlyProxy bool | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package driver | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
type New func() Driver | ||
|
||
var driversMap = map[string]New{} | ||
|
||
func RegisterDriver(name string, new New) { | ||
log.Infof("register driver: [%s]", name) | ||
driversMap[name] = new | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package operations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters