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