Skip to content

Commit

Permalink
Fixes #84 - Added a way for the web client to configure sync via Drop…
Browse files Browse the repository at this point in the history
…box as well
  • Loading branch information
palant committed Mar 8, 2018
1 parent 32d046b commit 13a6328
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
26 changes: 11 additions & 15 deletions data/panel/syncSetup.js
Expand Up @@ -26,25 +26,21 @@ if (isWebClient)
let provider = node.getAttribute("data-provider");
sync.getManualAuthURL(provider).then(url =>
{
node.hidden = !url;
if (url)
node.href = url;
node.target = "_blank";
node.addEventListener("click", () =>
{
node.href = url;
node.target = "_blank";
node.addEventListener("click", () =>
require("./syncAuthorize").show().then(code =>
{
require("./syncAuthorize").show().then(code =>
return sync.manualAuthorization(provider, code).then(() =>
{
return sync.manualAuthorization(provider, code).then(() =>
{
setActivePanel("sync-state");
}).catch(showUnknownError);
}).catch(error =>
{
// User cancelled, ignore
});
setActivePanel("sync-state");
}).catch(showUnknownError);
}).catch(error =>
{
// User cancelled, ignore
});
}
});
}).catch(showUnknownError);
}
}
Expand Down
12 changes: 11 additions & 1 deletion lib/sync-providers/dropbox.js
Expand Up @@ -15,6 +15,7 @@ const endpoints = {
};
const clientId = "mah5dtksdflznfc";
const redirectUri = "https://www.dropbox.com/1/oauth2/redirect_receiver";
const redirectUriManual = "https://www.dropbox.com/1/oauth2/display_token";

function getEndPoint(name, params)
{
Expand Down Expand Up @@ -111,7 +112,16 @@ exports.authorize = function()

exports.getManualAuthURL = function()
{
return null;
return getEndPoint("auth", {
response_type: "token",
client_id: clientId,
redirect_uri: redirectUriManual
});
};

exports.processAuthCode = function(code)
{
return Promise.resolve(code);
};

exports.get = function(path, token)
Expand Down

0 comments on commit 13a6328

Please sign in to comment.