alist/drivers/ftp/meta.go

45 lines
914 B
Go
Raw Permalink Normal View History

2022-09-03 14:07:08 +00:00
package ftp
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/op"
"github.com/axgle/mahonia"
2022-09-03 14:07:08 +00:00
)
func encode(str string, encoding string) string {
if encoding == "" {
return str
}
encoder := mahonia.NewEncoder(encoding)
return encoder.ConvertString(str)
}
func decode(str string, encoding string) string {
if encoding == "" {
return str
}
decoder := mahonia.NewDecoder(encoding)
return decoder.ConvertString(str)
}
2022-09-03 14:07:08 +00:00
type Addition struct {
Address string `json:"address" required:"true"`
Encoding string `json:"encoding" required:"true"`
2022-09-03 14:07:08 +00:00
Username string `json:"username" required:"true"`
Password string `json:"password" required:"true"`
2022-09-04 05:07:53 +00:00
driver.RootPath
2022-09-03 14:07:08 +00:00
}
var config = driver.Config{
Name: "FTP",
2022-09-04 04:43:52 +00:00
LocalSort: true,
OnlyLocal: true,
DefaultRoot: "/",
2022-09-03 14:07:08 +00:00
}
func init() {
op.RegisterDriver(func() driver.Driver {
return &FTP{}
})
2022-09-03 14:07:08 +00:00
}