Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/drivers/ftp/meta.go
1986 views
1
package ftp
2
3
import (
4
"github.com/alist-org/alist/v3/internal/driver"
5
"github.com/alist-org/alist/v3/internal/op"
6
"github.com/axgle/mahonia"
7
)
8
9
func encode(str string, encoding string) string {
10
if encoding == "" {
11
return str
12
}
13
encoder := mahonia.NewEncoder(encoding)
14
return encoder.ConvertString(str)
15
}
16
17
func decode(str string, encoding string) string {
18
if encoding == "" {
19
return str
20
}
21
decoder := mahonia.NewDecoder(encoding)
22
return decoder.ConvertString(str)
23
}
24
25
type Addition struct {
26
Address string `json:"address" required:"true"`
27
Encoding string `json:"encoding" required:"true"`
28
Username string `json:"username" required:"true"`
29
Password string `json:"password" required:"true"`
30
driver.RootPath
31
}
32
33
var config = driver.Config{
34
Name: "FTP",
35
LocalSort: true,
36
OnlyLocal: true,
37
DefaultRoot: "/",
38
}
39
40
func init() {
41
op.RegisterDriver(func() driver.Driver {
42
return &FTP{}
43
})
44
}
45
46