diff --git a/src/duplicacy_b2client.go b/src/duplicacy_b2client.go index 5f13dc5..ff9687a 100644 --- a/src/duplicacy_b2client.go +++ b/src/duplicacy_b2client.go @@ -329,6 +329,7 @@ func (client *B2Client) AuthorizeAccount(threadIndex int) (err error, allowed bo if client.DownloadURL == "" { client.DownloadURL = output.DownloadURL } + LOG_INFO("BACKBLAZE_URL", "download URL is: %s", client.DownloadURL) client.IsAuthorized = true client.LastAuthorizationTime = time.Now().Unix() diff --git a/src/duplicacy_storage.go b/src/duplicacy_storage.go index 3652e4a..c9ab70d 100644 --- a/src/duplicacy_storage.go +++ b/src/duplicacy_storage.go @@ -530,7 +530,24 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor accountID := GetPassword(preference, "b2_id", "Enter Backblaze account or application id:", true, resetPassword) applicationKey := GetPassword(preference, "b2_key", "Enter corresponding Backblaze application key:", true, resetPassword) - downloadURL := preference.Keys["b2_download_url"] + + b2Storage, err := CreateB2Storage(accountID, applicationKey, "", bucket, storageDir, threads) + if err != nil { + LOG_ERROR("STORAGE_CREATE", "Failed to load the Backblaze B2 storage at %s: %v", storageURL, err) + return nil + } + SavePassword(preference, "b2_id", accountID) + SavePassword(preference, "b2_key", applicationKey) + return b2Storage + } else if matched[1] == "b2-custom" { + b2customUrlRegex := regexp.MustCompile(`^b2-custom://([^/]+)/([^/]+)(/(.+))?`) + matched := b2customUrlRegex.FindStringSubmatch(storageURL) + downloadURL := "https://" + matched[1] + bucket := matched[2] + storageDir := matched[4] + + accountID := GetPassword(preference, "b2_id", "Enter Backblaze account or application id:", true, resetPassword) + applicationKey := GetPassword(preference, "b2_key", "Enter corresponding Backblaze application key:", true, resetPassword) b2Storage, err := CreateB2Storage(accountID, applicationKey, downloadURL, bucket, storageDir, threads) if err != nil {