From c3c518184706e195ea14d127b726c73bad4a4a49 Mon Sep 17 00:00:00 2001 From: tukipona <161995125+tukipona@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:50:30 +0800 Subject: [PATCH] feat(Seafile): add token login (#6324 close #5302) --- drivers/seafile/meta.go | 5 +++-- drivers/seafile/util.go | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/seafile/meta.go b/drivers/seafile/meta.go index 9d84aee1..fd5255f5 100644 --- a/drivers/seafile/meta.go +++ b/drivers/seafile/meta.go @@ -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"` } diff --git a/drivers/seafile/util.go b/drivers/seafile/util.go index 68195310..89b7b0fc 100644 --- a/drivers/seafile/util.go +++ b/drivers/seafile/util.go @@ -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).