Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions drivers/cloudreve_v4/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func (d *CloudreveV4) Init(ctx context.Context) error {
if d.ref != nil {
return nil
}
if d.isShare() {
return nil
}
if d.canLogin() {
return d.login()
}
Expand Down
8 changes: 8 additions & 0 deletions drivers/cloudreve_v4/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
CodeLoginRequired = http.StatusUnauthorized
CodePathNotExist = 40016 // Path not exist
CodeCredentialInvalid = 40020 // Failed to issue token
// IncorrectSharePassword = 40069 // Incorrect share password
)

var (
Expand Down Expand Up @@ -277,9 +278,16 @@ func (d *CloudreveV4) parseJWT(token string, jwt any) error {
return nil
}

func (d *CloudreveV4) isShare() bool {
return strings.HasSuffix(d.GetRootPath(), "@share")
}

// check if token is expired
// https://github.com/cloudreve/frontend/blob/ddfacc1c31c49be03beb71de4cc114c8811038d6/src/session/index.ts#L177-L200
func (d *CloudreveV4) isTokenExpired() bool {
if d.isShare() {
return false
}
if d.RefreshToken == "" {
// login again if username and password is set
if d.canLogin() {
Expand Down
Loading