aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud
diff options
context:
space:
mode:
authorAlexander Tkachev2019-07-15 00:44:12 +0700
committerMatan Bareket2019-07-30 14:51:41 -0400
commit2a56328d358307ae629c44d10e1f4a2ea8198672 (patch)
treee09778ddfa3290e435f77e1e81514acb69bc958a /backends/cloud
parent16b658814622b69163def3254e51556412b7e9fb (diff)
downloadscummvm-rg350-2a56328d358307ae629c44d10e1f4a2ea8198672.tar.gz
scummvm-rg350-2a56328d358307ae629c44d10e1f4a2ea8198672.tar.bz2
scummvm-rg350-2a56328d358307ae629c44d10e1f4a2ea8198672.zip
CLOUD: Update DropboxStorage to work with cloud.scummvm.org
Diffstat (limited to 'backends/cloud')
-rw-r--r--backends/cloud/dropbox/dropboxstorage.cpp20
-rw-r--r--backends/cloud/dropbox/dropboxstorage.h4
2 files changed, 7 insertions, 17 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp
index bf964ae51b..44ad9a1efa 100644
--- a/backends/cloud/dropbox/dropboxstorage.cpp
+++ b/backends/cloud/dropbox/dropboxstorage.cpp
@@ -42,10 +42,10 @@
namespace Cloud {
namespace Dropbox {
-#define DROPBOX_OAUTH2_TOKEN "https://scummvm.org/admin/cloud/cloud/dropbox/token/"
+#define DROPBOX_OAUTH2_TOKEN "https://cloud.scummvm.org/dropbox/token/"
#define DROPBOX_API_FILES_DOWNLOAD "https://content.dropboxapi.com/2/files/download"
-DropboxStorage::DropboxStorage(Common::String accessToken, Common::String userId): _token(accessToken), _uid(userId) {}
+DropboxStorage::DropboxStorage(Common::String accessToken, bool unused): _token(accessToken) {}
DropboxStorage::DropboxStorage(Common::String code) {
getAccessToken(code);
@@ -79,14 +79,12 @@ void DropboxStorage::codeFlowComplete(Networking::JsonResponse response) {
}
Common::JSONObject result = json->asObject();
- if (!Networking::CurlJsonRequest::jsonContainsString(result, "access_token", "DropboxStorage::codeFlowComplete") ||
- !Networking::CurlJsonRequest::jsonContainsString(result, "uid", "DropboxStorage::codeFlowComplete")) {
- warning("DropboxStorage: bad response, no token/uid passed");
+ if (!Networking::CurlJsonRequest::jsonContainsString(result, "access_token", "DropboxStorage::codeFlowComplete")) {
+ warning("DropboxStorage: bad response, no token passed");
debug(9, "%s", json->stringify(true).c_str());
CloudMan.removeStorage(this);
} else {
_token = result.getVal("access_token")->asString();
- _uid = result.getVal("uid")->asString();
ConfMan.removeKey("dropbox_code", ConfMan.kCloudDomain);
CloudMan.replaceStorage(this, kStorageDropboxId);
ConfMan.flushToDisk();
@@ -103,7 +101,6 @@ void DropboxStorage::codeFlowFailed(Networking::ErrorResponse error) {
void DropboxStorage::saveConfig(Common::String keyPrefix) {
ConfMan.set(keyPrefix + "access_token", _token, ConfMan.kCloudDomain);
- ConfMan.set(keyPrefix + "user_id", _uid, ConfMan.kCloudDomain);
}
Common::String DropboxStorage::name() const {
@@ -154,15 +151,8 @@ DropboxStorage *DropboxStorage::loadFromConfig(Common::String keyPrefix) {
return nullptr;
}
- if (!ConfMan.hasKey(keyPrefix + "user_id", ConfMan.kCloudDomain)) {
- warning("DropboxStorage: no user_id found");
- return nullptr;
- }
-
Common::String accessToken = ConfMan.get(keyPrefix + "access_token", ConfMan.kCloudDomain);
- Common::String userId = ConfMan.get(keyPrefix + "user_id", ConfMan.kCloudDomain);
-
- return new DropboxStorage(accessToken, userId);
+ return new DropboxStorage(accessToken, true);
}
} // End of namespace Dropbox
diff --git a/backends/cloud/dropbox/dropboxstorage.h b/backends/cloud/dropbox/dropboxstorage.h
index eec34d8bc5..7505edd461 100644
--- a/backends/cloud/dropbox/dropboxstorage.h
+++ b/backends/cloud/dropbox/dropboxstorage.h
@@ -31,10 +31,10 @@ namespace Cloud {
namespace Dropbox {
class DropboxStorage: public Cloud::Storage {
- Common::String _token, _uid;
+ Common::String _token;
/** This private constructor is called from loadFromConfig(). */
- DropboxStorage(Common::String token, Common::String uid);
+ DropboxStorage(Common::String token, bool unused);
void getAccessToken(Common::String code);
void codeFlowComplete(Networking::JsonResponse response);