Added option for Dropbox restricted permissions
This commit is contained in:
parent
339615c820
commit
c413fcf1c5
@ -131,8 +131,12 @@ define([
|
||||
utils.setInputRadio("radio-settings-mode", storage.mode || '_ace_');
|
||||
// Commit message
|
||||
utils.setInputValue("#input-settings-publish-commit-msg", settings.commitMsg);
|
||||
// Gdrive multi-accounts
|
||||
utils.setInputValue("#input-settings-gdrive-multiaccount", settings.gdriveMultiAccount);
|
||||
// Gdrive full access
|
||||
utils.setInputChecked("#input-settings-gdrive-full-access", settings.gdriveFullAccess);
|
||||
// Dropbox full access
|
||||
utils.setInputChecked("#input-settings-dropbox-full-access", settings.dropboxFullAccess);
|
||||
// Template
|
||||
utils.setInputValue("#textarea-settings-publish-template", settings.template);
|
||||
// PDF template
|
||||
@ -171,8 +175,12 @@ define([
|
||||
var mode = utils.getInputRadio("radio-settings-mode");
|
||||
// Commit message
|
||||
newSettings.commitMsg = utils.getInputTextValue("#input-settings-publish-commit-msg", event);
|
||||
// Gdrive multi-accounts
|
||||
newSettings.gdriveMultiAccount = utils.getInputIntValue("#input-settings-gdrive-multiaccount");
|
||||
// Gdrive full access
|
||||
newSettings.gdriveFullAccess = utils.getInputChecked("#input-settings-gdrive-full-access");
|
||||
// Drobox full access
|
||||
newSettings.dropboxFullAccess = utils.getInputChecked("#input-settings-dropbox-full-access");
|
||||
// Template
|
||||
newSettings.template = utils.getInputTextValue("#textarea-settings-publish-template", event);
|
||||
// PDF template
|
||||
@ -190,6 +198,9 @@ define([
|
||||
eventMgr.onSaveSettings(newSettings.extensionSettings, event);
|
||||
|
||||
if(!event.isPropagationStopped()) {
|
||||
if(settings.dropboxFullAccess !== newSettings.dropboxFullAccess) {
|
||||
storage.removeItem('dropbox.lastChangeId');
|
||||
}
|
||||
$.extend(settings, newSettings);
|
||||
storage.settings = JSON.stringify(settings);
|
||||
storage.themeV3 = theme;
|
||||
@ -924,7 +935,7 @@ define([
|
||||
});
|
||||
$(".action-import-docs-settings-confirm").click(function() {
|
||||
storage.clear();
|
||||
var allowedKeys = /^file\.|^focusMode$|^folder\.|^publish\.|^settings$|^sync\.|^google\.\d+\.|^themeV3$|^mode$|^version$|^welcomeTour$/;
|
||||
var allowedKeys = /^file\.|^focusMode$|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^themeV3$|^mode$|^version$|^welcomeTour$/;
|
||||
_.each(newstorage, function(value, key) {
|
||||
if(allowedKeys.test(key)) {
|
||||
storage[key] = value;
|
||||
|
@ -6,9 +6,10 @@ define([
|
||||
"core",
|
||||
"storage",
|
||||
"logger",
|
||||
"settings",
|
||||
"eventMgr",
|
||||
"classes/AsyncTask",
|
||||
], function($, _, constants, core, storage, logger, eventMgr, AsyncTask) {
|
||||
], function($, _, constants, core, storage, logger, settings, eventMgr, AsyncTask) {
|
||||
|
||||
var client;
|
||||
var authenticated = false;
|
||||
@ -39,8 +40,8 @@ define([
|
||||
timeout: constants.AJAX_TIMEOUT
|
||||
}).done(function() {
|
||||
client = new Dropbox.Client({
|
||||
key: constants.DROPBOX_APP_KEY,
|
||||
secret: constants.DROPBOX_APP_SECRET
|
||||
key: settings.dropboxFullAccess === true ? constants.DROPBOX_APP_KEY : constants.DROPBOX_RESTRICTED_APP_KEY,
|
||||
secret: settings.dropboxFullAccess === true ? constants.DROPBOX_APP_SECRET : constants.DROPBOX_RESTRICTED_APP_SECRET
|
||||
});
|
||||
client.authDriver(new Dropbox.AuthDriver.Popup({
|
||||
receiverUrl: constants.BASE_URL + "html/dropbox-oauth-receiver.html",
|
||||
|
@ -12,7 +12,9 @@ define([
|
||||
maxWidth: 960,
|
||||
defaultContent: "\n\n\n> Written with [StackEdit](" + constants.MAIN_URL + ").",
|
||||
commitMsg: "Published with " + constants.MAIN_URL,
|
||||
gdriveMultiAccount: 1,
|
||||
gdriveFullAccess: true,
|
||||
dropboxFullAccess: true,
|
||||
template: [
|
||||
'<!DOCTYPE html>\n',
|
||||
'<html>\n',
|
||||
|
Loading…
Reference in New Issue
Block a user