From cde660ee9f528324a3f07305c06cf0951ac0184c Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Fri, 12 Aug 2022 22:17:06 -0400 Subject: [PATCH] Use long-lived refresh token for the Dropbox backend The refresh token can be downloaded from https://duplicacy.com/dropbox_start --- src/duplicacy_dropboxstorage.go | 4 ++-- src/duplicacy_storage.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/duplicacy_dropboxstorage.go b/src/duplicacy_dropboxstorage.go index b8545cd..a7a1e98 100644 --- a/src/duplicacy_dropboxstorage.go +++ b/src/duplicacy_dropboxstorage.go @@ -21,11 +21,11 @@ type DropboxStorage struct { } // CreateDropboxStorage creates a dropbox storage object. -func CreateDropboxStorage(accessToken string, storageDir string, minimumNesting int, threads int) (storage *DropboxStorage, err error) { +func CreateDropboxStorage(refreshToken string, storageDir string, minimumNesting int, threads int) (storage *DropboxStorage, err error) { var clients []*dropbox.Files for i := 0; i < threads; i++ { - client := dropbox.NewFiles(dropbox.NewConfig(accessToken)) + client := dropbox.NewFiles(dropbox.NewConfig("", refreshToken, "https://duplicacy.com/dropbox_refresh")) clients = append(clients, client) } diff --git a/src/duplicacy_storage.go b/src/duplicacy_storage.go index e098026..a33859d 100644 --- a/src/duplicacy_storage.go +++ b/src/duplicacy_storage.go @@ -540,7 +540,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor } else if matched[1] == "dropbox" { storageDir := matched[3] + matched[5] - token := GetPassword(preference, "dropbox_token", "Enter Dropbox access token:", true, resetPassword) + token := GetPassword(preference, "dropbox_token", "Enter Dropbox refresh token:", true, resetPassword) dropboxStorage, err := CreateDropboxStorage(token, storageDir, 1, threads) if err != nil { LOG_ERROR("STORAGE_CREATE", "Failed to load the dropbox storage: %v", err)