feat(Seafile): add token login (#6324 close #5302)

pull/6339/head
tukipona 2024-04-10 21:50:30 +08:00 committed by GitHub
parent cd5a8a011d
commit c3c5181847
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -9,8 +9,9 @@ type Addition struct {
driver.RootPath driver.RootPath
Address string `json:"address" required:"true"` Address string `json:"address" required:"true"`
UserName string `json:"username" required:"true"` UserName string `json:"username" required:"false"`
Password string `json:"password" required:"true"` Password string `json:"password" required:"false"`
Token string `json:"token" required:"false"`
RepoId string `json:"repoId" required:"false"` RepoId string `json:"repoId" required:"false"`
RepoPwd string `json:"repoPwd" required:"false"` RepoPwd string `json:"repoPwd" required:"false"`
} }

View File

@ -14,6 +14,10 @@ import (
) )
func (d *Seafile) getToken() error { func (d *Seafile) getToken() error {
if d.Token != "" {
d.authorization = fmt.Sprintf("Token %s", d.Token)
return nil
}
var authResp AuthTokenResp var authResp AuthTokenResp
res, err := base.RestyClient.R(). res, err := base.RestyClient.R().
SetResult(&authResp). SetResult(&authResp).