Skip to content

Commit

Permalink
feat(Seafile): add token login (#6324 close #5302)
Browse files Browse the repository at this point in the history
  • Loading branch information
tukipona authored Apr 10, 2024
1 parent cd5a8a0 commit c3c5181
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/seafile/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ type Addition struct {
driver.RootPath

Address string `json:"address" required:"true"`
UserName string `json:"username" required:"true"`
Password string `json:"password" required:"true"`
UserName string `json:"username" required:"false"`
Password string `json:"password" required:"false"`
Token string `json:"token" required:"false"`
RepoId string `json:"repoId" required:"false"`
RepoPwd string `json:"repoPwd" required:"false"`
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/seafile/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
)

func (d *Seafile) getToken() error {
if d.Token != "" {
d.authorization = fmt.Sprintf("Token %s", d.Token)
return nil
}
var authResp AuthTokenResp
res, err := base.RestyClient.R().
SetResult(&authResp).
Expand Down

0 comments on commit c3c5181

Please sign in to comment.