File size: 914 Bytes
7107f0b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package ftp
import (
"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/op"
"github.com/axgle/mahonia"
)
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)
}
type Addition struct {
Address string `json:"address" required:"true"`
Encoding string `json:"encoding" required:"true"`
Username string `json:"username" required:"true"`
Password string `json:"password" required:"true"`
driver.RootPath
}
var config = driver.Config{
Name: "FTP",
LocalSort: true,
OnlyLocal: true,
DefaultRoot: "/",
}
func init() {
op.RegisterDriver(func() driver.Driver {
return &FTP{}
})
}
|