fix: Fix the problem of failed Google drive backup (#9156)

Refs #9129
This commit is contained in:
ssongliu 2025-06-17 18:48:55 +08:00 committed by GitHub
parent 23a1fbdd4b
commit 4e2f24a8f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 2 deletions

View file

@ -393,7 +393,6 @@ func RefreshGoogleToken(grantType string, tokenType string, varMap map[string]in
if err := json.Unmarshal(resp.Body(), &respItem); err != nil {
return "", err
}
fmt.Println(respItem)
if tokenType == "accessToken" {
return respItem.AccessToken, nil
}

View file

@ -41,6 +41,8 @@ func NewCloudStorageClient(backupType string, vars map[string]interface{}) (Clou
return client.NewUpClient(vars)
case constant.ALIYUN:
return client.NewALIClient(vars)
case constant.GoogleDrive:
return client.NewGoogleDriveClient(vars)
default:
return nil, buserr.WithName("ErrNotSupportType", backupType)
}

View file

@ -32,7 +32,7 @@ const (
GoogleDrive = "GoogleDrive"
OneDriveRedirectURI = "http://localhost/login/authorized"
GoogleRedirectURI = "http://localhost:8080"
GoogleRedirectURI = "https://localhost:8080"
DaemonJsonPath = "/etc/docker/daemon.json"
)

View file

@ -17,6 +17,7 @@ func Init() {
migrations.InitGoogle,
migrations.AddTaskDB,
migrations.AddXpackHideMenu,
migrations.UpdateGoogle,
migrations.UpdateXpackHideMenu,
})
if err := m.Migrate(); err != nil {

View file

@ -440,3 +440,20 @@ var UpdateXpackHideMenu = &gormigrate.Migration{
return tx.Model(&model.Setting{}).Where("key = ?", "HideMenu").Update("value", string(updatedJSON)).Error
},
}
var UpdateGoogle = &gormigrate.Migration{
ID: "20250616-update-google",
Migrate: func(tx *gorm.DB) error {
if err := tx.Model(&model.Setting{}).
Where("key = ?", "GoogleID").
Update("value", "NTU2NTQ3NDYwMTQtY2Q0bGR0dDk2aGNsNWcxYWtwdmJhZTFmcjJlZ2Y0MXAuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20=").Error; err != nil {
return err
}
if err := tx.Model(&model.Setting{}).
Where("key = ?", "GoogleSc").
Update("value", "R09DU1BYLXRibXg0QVdVZ3d3Ykc2QW1XTHQ3YUdaZElVeE4=").Error; err != nil {
return err
}
return nil
},
}