Hide Dropbox and Google Drive in Import/ Export when disabled

This commit is contained in:
Jannik Lorenz 2016-04-23 12:58:24 +02:00
parent fa50745a8d
commit d7648e9cea
No known key found for this signature in database
GPG Key ID: 89A94DE844A6F488
5 changed files with 43 additions and 12 deletions

View File

@ -124,7 +124,8 @@ Third-party integration api key settings
| facebook, twitter, github, dropbox | `config.json` | for signin |
| imgur | `config.json` | for image upload |
| dropbox | `public/views/foot.ejs` | for chooser and saver |
| google drive | `public/js/common.js` | for export and import |
| google drive | `public/js/common.js`/ `config.json` (enable) | for export and import |
Operational Transformation
---

View File

@ -25,7 +25,7 @@ var db = config.db || {
};
// ssl path
var sslkeypath = config.sslkeypath || ''
var sslkeypath = config.sslkeypath || '';
var sslcertpath = config.sslcertpath || '';
var sslcapath = config.sslcapath || '';
var dhparampath = config.dhparampath || '';
@ -61,6 +61,7 @@ var twitter = config.twitter || false;
var github = config.github || false;
var dropbox = config.dropbox || false;
var imgur = config.imgur || false;
var googleDrive = config.googleDrive || false;
function getserverurl() {
var url = '';
@ -111,5 +112,6 @@ module.exports = {
twitter: twitter,
github: github,
dropbox: dropbox,
imgur: imgur
};
imgur: imgur,
googleDrive: googleDrive,
};

View File

@ -48,7 +48,7 @@ var response = {
showNote: showNote,
showPublishNote: showPublishNote,
showPublishSlide: showPublishSlide,
showIndex: showIndex,
showIndex: showIndex,
noteActions: noteActions,
publishNoteActions: publishNoteActions,
githubActions: githubActions
@ -72,7 +72,7 @@ function responseError(res, code, detail, msg) {
code: code,
detail: detail,
msg: msg,
useCDN: config.usecdn
useCDN: config.usecdn
});
res.write(content);
res.end();
@ -95,6 +95,7 @@ function showIndex(req, res, next) {
twitter: config.twitter,
github: config.github,
dropbox: config.dropbox,
googleDrive: config.googleDrive,
});
res.write(content);
res.end();
@ -125,6 +126,7 @@ function responseHackMD(res, note) {
twitter: config.twitter,
github: config.github,
dropbox: config.dropbox,
googleDrive: config.googleDrive,
});
var buf = html;
res.writeHead(200, {
@ -355,7 +357,7 @@ function publishNoteActions(req, res, next) {
res.redirect(config.serverurl + '/' + (note.alias ? note.alias : LZString.compressToBase64(note.id)));
break;
default:
res.redirect(config.serverurl + '/s/' + note.shortid);
res.redirect(config.serverurl + '/s/' + note.shortid);
break;
}
});
@ -370,7 +372,7 @@ function githubActions(req, res, next) {
githubActionGist(req, res, note);
break;
default:
res.redirect(config.serverurl + '/' + noteId);
res.redirect(config.serverurl + '/' + noteId);
break;
}
});
@ -470,4 +472,4 @@ var render = function (res, title, markdown) {
}));
};
module.exports = response;
module.exports = response;

View File

@ -71,8 +71,12 @@
<script src="<%- url %>/vendor/md-toc.js" defer></script>
<script src="<%- url %>/vendor/showup/showup.js" defer></script>
<script src="<%- url %>/vendor/randomColor.js" defer></script>
<% if(dropbox) { %>
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="change this" async defer></script>
<% } %>
<% if(googleDrive) { %>
<script src="https://www.google.com/jsapi" defer></script>
<% } %>
<script src="<%- url %>/js/google-drive-upload.js" defer></script>
<script src="<%- url %>/js/google-drive-picker.js" defer></script>
<script src="<%- url %>/js/common.js" defer></script>
@ -81,4 +85,6 @@
<script src="<%- url %>/js/history.js" defer></script>
<script src="<%- url %>/js/index.js" defer></script>
<script src="<%- url %>/js/syncscroll.js" defer></script>
<script src="https://apis.google.com/js/client:plusone.js?onload=onGoogleClientLoaded" defer></script>
<% if(googleDrive) { %>
<script src="https://apis.google.com/js/client:plusone.js?onload=onGoogleClientLoaded" defer></script>
<% } %>

View File

@ -1,7 +1,7 @@
<nav class="navbar navbar-default navbar-fixed-top unselectable hidden-print">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<span class="pull-right" style="margin-top: 17px; color: #777;">
<span class="pull-right" style="margin-top: 17px; color: #777;">
<div class="visible-xs">&nbsp;</div>
<div class="visible-sm">&nbsp;</div>
<div class="visible-md">&nbsp;</div>
@ -33,21 +33,31 @@
<li role="presentation"><a role="menuitem" class="ui-beta-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> Slide Mode</a>
</li>
<li class="divider"></li>
<% if(googleDrive || googleDrive || github) { %>
<li class="dropdown-header">Export</li>
<% if(typeof dropbox !== 'undefined' && dropbox) { %>
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
</li>
<% } %>
<% if(typeof googleDrive !== 'undefined' && googleDrive) { %>
<li role="presentation"><a role="menuitem" class="ui-save-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-upload fa-fw"></i> Google Drive</a>
</li>
<% } %>
<% if(typeof github !== 'undefined' && github) { %>
<li role="presentation"><a role="menuitem" class="ui-save-gist" tabindex="-1" href="#" target="_blank"><i class="fa fa-github fa-fw"></i> Gist</a>
</li>
<% } %>
<li class="divider"></li>
<% } %>
<li class="dropdown-header">Import</li>
<% if(typeof dropbox !== 'undefined' && dropbox) { %>
<li role="presentation"><a role="menuitem" class="ui-import-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
</li>
<% } %>
<% if(typeof googleDrive !== 'undefined' && googleDrive) { %>
<li role="presentation"><a role="menuitem" class="ui-import-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-download fa-fw"></i> Google Drive</a>
</li>
<% } %>
<li role="presentation"><a role="menuitem" class="ui-import-gist" href="#" data-toggle="modal" data-target="#gistImportModal"><i class="fa fa-github fa-fw"></i> Gist</a>
</li>
<li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a>
@ -118,21 +128,31 @@
<li role="presentation"><a role="menuitem" class="ui-beta-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> Slide Mode</a>
</li>
<li class="divider"></li>
<% if(googleDrive || googleDrive || github) { %>
<li class="dropdown-header">Export</li>
<% if(typeof dropbox !== 'undefined' && dropbox) { %>
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
</li>
<% } %>
<% if(typeof googleDrive !== 'undefined' && googleDrive) { %>
<li role="presentation"><a role="menuitem" class="ui-save-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-upload fa-fw"></i> Google Drive</a>
</li>
<% } %>
<% if(typeof github !== 'undefined' && github) { %>
<li role="presentation"><a role="menuitem" class="ui-save-gist" tabindex="-1" href="#" target="_blank"><i class="fa fa-github fa-fw"></i> Gist</a>
</li>
<% } %>
<li class="divider"></li>
<% } %>
<li class="dropdown-header">Import</li>
<% if(typeof dropbox !== 'undefined' && dropbox) { %>
<li role="presentation"><a role="menuitem" class="ui-import-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
</li>
<% } %>
<% if(typeof googleDrive !== 'undefined' && googleDrive) { %>
<li role="presentation"><a role="menuitem" class="ui-import-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-download fa-fw"></i> Google Drive</a>
</li>
<% } %>
<li role="presentation"><a role="menuitem" class="ui-import-gist" href="#" data-toggle="modal" data-target="#gistImportModal"><i class="fa fa-github fa-fw"></i> Gist</a>
</li>
<li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a>
@ -148,4 +168,4 @@
</ul>
</div>
</nav>
<div class="ui-spinner unselectable hidden-print"></div>
<div class="ui-spinner unselectable hidden-print"></div>