mirror of https://github.com/Xhofe/alist
chore: fix typos (#2122)
* refactor: fix typos * Update help.go Co-authored-by: Noah Hsu <i@nn.ci>pull/2128/head
parent
dd4674e486
commit
f0cc0a76a9
|
@ -146,16 +146,16 @@ func IsNumber(str string) bool {
|
|||
|
||||
var findFromReg = regexp.MustCompile(`data : '(.+?)'`) // 查找from字符串
|
||||
|
||||
// 解析html中的from
|
||||
// 解析html中的form
|
||||
func htmlFormToMap(html string) (map[string]string, error) {
|
||||
froms := findFromReg.FindStringSubmatch(html)
|
||||
if len(froms) != 2 {
|
||||
forms := findFromReg.FindStringSubmatch(html)
|
||||
if len(forms) != 2 {
|
||||
return nil, fmt.Errorf("not find file sgin")
|
||||
}
|
||||
return fromToMap(froms[1]), nil
|
||||
return formToMap(forms[1]), nil
|
||||
}
|
||||
|
||||
func fromToMap(from string) map[string]string {
|
||||
func formToMap(from string) map[string]string {
|
||||
var param = make(map[string]string)
|
||||
for _, kv := range strings.Split(from, "&") {
|
||||
kv := strings.SplitN(kv, "=", 2)[:2]
|
||||
|
|
|
@ -119,7 +119,7 @@ func (ca *CookieAuth) getSPCookie(conf *SuccessResponse) (CookieResponse, error)
|
|||
Jar: jar,
|
||||
}
|
||||
|
||||
// Send the previously aquired Token as a Post parameter
|
||||
// Send the previously acquired Token as a Post parameter
|
||||
if _, err = client.Post(u.String(), "text/xml", strings.NewReader(conf.Succ.Token)); err != nil {
|
||||
return CookieResponse{}, err
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ func (id *Client) PauseAll() (g string, err error)
|
|||
`aria2.pauseAll()` This method is equal to calling `aria2.pause()` for every active/waiting download. This methods returns OK for success.
|
||||
|
||||
```
|
||||
func (id *Client) PurgeDowloadResult() (g string, err error)
|
||||
func (id *Client) PurgeDownloadResult() (g string, err error)
|
||||
```
|
||||
|
||||
`aria2.purgeDownloadResult()` This method purges completed/error/removed downloads to free memory. This method returns OK.
|
||||
|
|
|
@ -28,7 +28,7 @@ type httpCaller struct {
|
|||
once sync.Once
|
||||
}
|
||||
|
||||
func newHTTPCaller(ctx context.Context, u *url.URL, timeout time.Duration, notifer Notifier) *httpCaller {
|
||||
func newHTTPCaller(ctx context.Context, u *url.URL, timeout time.Duration, notifier Notifier) *httpCaller {
|
||||
c := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
MaxIdleConnsPerHost: 1,
|
||||
|
@ -45,8 +45,8 @@ func newHTTPCaller(ctx context.Context, u *url.URL, timeout time.Duration, notif
|
|||
var wg sync.WaitGroup
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
h := &httpCaller{uri: u.String(), c: c, cancel: cancel, wg: &wg}
|
||||
if notifer != nil {
|
||||
h.setNotifier(ctx, *u, notifer)
|
||||
if notifier != nil {
|
||||
h.setNotifier(ctx, *u, notifier)
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ func (h *httpCaller) Close() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (h *httpCaller) setNotifier(ctx context.Context, u url.URL, notifer Notifier) (err error) {
|
||||
func (h *httpCaller) setNotifier(ctx context.Context, u url.URL, notifier Notifier) (err error) {
|
||||
u.Scheme = "ws"
|
||||
conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
|
||||
if err != nil {
|
||||
|
@ -101,17 +101,17 @@ func (h *httpCaller) setNotifier(ctx context.Context, u url.URL, notifer Notifie
|
|||
}
|
||||
switch request.Method {
|
||||
case "aria2.onDownloadStart":
|
||||
notifer.OnDownloadStart(request.Params)
|
||||
notifier.OnDownloadStart(request.Params)
|
||||
case "aria2.onDownloadPause":
|
||||
notifer.OnDownloadPause(request.Params)
|
||||
notifier.OnDownloadPause(request.Params)
|
||||
case "aria2.onDownloadStop":
|
||||
notifer.OnDownloadStop(request.Params)
|
||||
notifier.OnDownloadStop(request.Params)
|
||||
case "aria2.onDownloadComplete":
|
||||
notifer.OnDownloadComplete(request.Params)
|
||||
notifier.OnDownloadComplete(request.Params)
|
||||
case "aria2.onDownloadError":
|
||||
notifer.OnDownloadError(request.Params)
|
||||
notifier.OnDownloadError(request.Params)
|
||||
case "aria2.onBtDownloadComplete":
|
||||
notifer.OnBtDownloadComplete(request.Params)
|
||||
notifier.OnBtDownloadComplete(request.Params)
|
||||
default:
|
||||
log.Printf("unexpected notification: %s", request.Method)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ func TestJoin(t *testing.T) {
|
|||
func eq(t *testing.T, expected string, s0 string, s1 string) {
|
||||
s := Join(s0, s1)
|
||||
if s != expected {
|
||||
t.Error("For", "'"+s0+"','"+s1+"'", "expeted", "'"+expected+"'", "got", "'"+s+"'")
|
||||
t.Error("For", "'"+s0+"','"+s1+"'", "expected", "'"+expected+"'", "got", "'"+s+"'")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ func CreateNestedFile(path string) (*os.File, error) {
|
|||
if !Exists(basePath) {
|
||||
err := os.MkdirAll(basePath, 0700)
|
||||
if err != nil {
|
||||
log.Errorf("can't create foler,%s", err)
|
||||
log.Errorf("can't create folder, %s", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue