summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--lib/config.js4
-rw-r--r--lib/response.js16
-rw-r--r--public/js/common.js6
-rw-r--r--public/js/index.js29
-rw-r--r--public/views/foot.ejs5
-rw-r--r--public/views/header.ejs4
-rw-r--r--public/views/index.ejs38
8 files changed, 71 insertions, 35 deletions
diff --git a/README.md b/README.md
index 9f5fbb1c..beece7d8 100644
--- a/README.md
+++ b/README.md
@@ -123,8 +123,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, dropbox | `public/js/common.js` | for export and import |
+
Operational Transformation
---
diff --git a/lib/config.js b/lib/config.js
index c138b459..cdaec31c 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -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 || '';
@@ -114,4 +114,4 @@ module.exports = {
gitlab: gitlab,
dropbox: dropbox,
imgur: imgur
-}; \ No newline at end of file
+};
diff --git a/lib/response.js b/lib/response.js
index 2114c99b..bbc08e80 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -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,7 +95,7 @@ function showIndex(req, res, next) {
twitter: config.twitter,
github: config.github,
gitlab: config.gitlab,
- dropbox: config.dropbox,
+ dropbox: config.dropbox
});
res.write(content);
res.end();
@@ -126,7 +126,11 @@ function responseHackMD(res, note) {
twitter: config.twitter,
github: config.github,
gitlab: config.gitlab,
+<<<<<<< HEAD
+ dropbox: config.dropbox
+=======
dropbox: config.dropbox,
+>>>>>>> 930afdc33738a487bd9e596c5d35bc9f686eaaa1
});
var buf = html;
res.writeHead(200, {
@@ -357,7 +361,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;
}
});
@@ -372,7 +376,7 @@ function githubActions(req, res, next) {
githubActionGist(req, res, note);
break;
default:
- res.redirect(config.serverurl + '/' + noteId);
+ res.redirect(config.serverurl + '/' + noteId);
break;
}
});
@@ -472,4 +476,4 @@ var render = function (res, title, markdown) {
}));
};
-module.exports = response; \ No newline at end of file
+module.exports = response;
diff --git a/public/js/common.js b/public/js/common.js
index c623cd24..33b30689 100644
--- a/public/js/common.js
+++ b/public/js/common.js
@@ -4,8 +4,10 @@ var urlpath = ''; // sub url path, like: www.example.com/<urlpath>
//settings
var debug = false;
-var GOOGLE_API_KEY = 'change this';
-var GOOGLE_CLIENT_ID = 'change this';
+var GOOGLE_API_KEY = '';
+var GOOGLE_CLIENT_ID = '';
+
+var DROPBOX_APP_KEY = '';
var port = window.location.port;
var serverurl = window.location.protocol + '//' + (domain ? domain : window.location.hostname) + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : '');
diff --git a/public/js/index.js b/public/js/index.js
index 7e692bee..0193b6bc 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1064,6 +1064,35 @@ function showMessageModal(title, header, href, text, success) {
modal.modal('show');
}
+// check if dropbox app key is set and load scripts
+if (DROPBOX_APP_KEY) {
+ $('<script>')
+ .attr('type', 'text/javascript')
+ .attr('src', 'https://www.dropbox.com/static/api/2/dropins.js')
+ .attr('id', 'dropboxjs')
+ .attr('data-app-key', DROPBOX_APP_KEY)
+ .appendTo('body');
+} else {
+ ui.toolbar.import.dropbox.hide();
+ ui.toolbar.export.dropbox.hide();
+}
+
+// check if google api key and client id are set and load scripts
+if (GOOGLE_API_KEY && GOOGLE_CLIENT_ID) {
+ $('<script>')
+ .attr('type', 'text/javascript')
+ .attr('src', 'https://www.google.com/jsapi')
+ .appendTo('body');
+
+ $('<script>')
+ .attr('type', 'text/javascript')
+ .attr('src', 'https://apis.google.com/js/client:plusone.js?onload=onGoogleClientLoaded')
+ .appendTo('body');
+} else {
+ ui.toolbar.import.googleDrive.hide();
+ ui.toolbar.export.googleDrive.hide();
+}
+
//button actions
//share
ui.toolbar.publish.attr("href", noteurl + "/publish");
diff --git a/public/views/foot.ejs b/public/views/foot.ejs
index 9cd4ba03..7adb8c72 100644
--- a/public/views/foot.ejs
+++ b/public/views/foot.ejs
@@ -71,8 +71,6 @@
<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>
-<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="change this" async defer></script>
-<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>
@@ -80,5 +78,4 @@
<script src="<%- url %>/js/render.js" defer></script>
<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> \ No newline at end of file
+<script src="<%- url %>/js/syncscroll.js" defer></script> \ No newline at end of file
diff --git a/public/views/header.ejs b/public/views/header.ejs
index 6629d3a4..8610b861 100644
--- a/public/views/header.ejs
+++ b/public/views/header.ejs
@@ -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>
@@ -164,4 +164,4 @@
</ul>
</div>
</nav>
-<div class="ui-spinner unselectable hidden-print"></div> \ No newline at end of file
+<div class="ui-spinner unselectable hidden-print"></div>
diff --git a/public/views/index.ejs b/public/views/index.ejs
index 69b525e9..7648211f 100644
--- a/public/views/index.ejs
+++ b/public/views/index.ejs
@@ -15,7 +15,7 @@
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
<!-- Bootstrap core CSS -->
- <% if(useCDN) { %>
+ <% if(useCDN) { %>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
@@ -58,8 +58,10 @@
<p class="lead">
Realtime collaborative markdown notes on all platforms.
</p>
+ <% if(facebook || twitter || github || dropbox) { %>
<a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="display:none;">Sign In</a>
<div class="ui-or" style="display:none;">Or</div>
+ <% }%>
<p class="lead">
<a href="<%- url %>/new" class="btn btn-lg btn-default">New note</a>
</p>
@@ -70,6 +72,7 @@
</div>
<div id="history" class="section" style="display:none;">
+ <% if(facebook || twitter || github || dropbox) { %>
<div class="ui-signin">
<h4>
<a type="button" class="btn btn-success" data-toggle="modal" data-target=".signin-modal">Sign In</a> to get own history!
@@ -81,6 +84,7 @@
<a href="<%- url %>/new" class="btn btn-default">New note</a> Or
<a href="#" class="btn btn-danger ui-logout">Sign Out</a>
</div>
+ <% }%>
<hr>
<form class="form-inline">
<div class="form-group" style="vertical-align: bottom;">
@@ -179,25 +183,25 @@
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
- <% if(useCDN) { %>
- <script src="//code.jquery.com/jquery-1.11.3.min.js" defer></script>
- <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" defer></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js" defer></script>
+ <% if(useCDN) { %>
+ <script src="//code.jquery.com/jquery-1.11.3.min.js" defer></script>
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/jquery.gsap.min.js" defer></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js" defer></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment-with-locales.min.js" defer></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js" defer></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/js-url/2.0.2/url.min.js" defer></script>
- <% } else { %>
- <script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script>
- <script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment-with-locales.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/js-url/2.0.2/url.min.js" defer></script>
+ <% } else { %>
+ <script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script>
+ <script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
<script src="<%- url %>/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
<script src="<%- url %>/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
- <script src="<%- url %>/vendor/select2/select2.min.js" defer></script>
- <script src="<%- url %>/vendor/moment/min/moment-with-locales.min.js" defer></script>
+ <script src="<%- url %>/vendor/select2/select2.min.js" defer></script>
+ <script src="<%- url %>/vendor/moment/min/moment-with-locales.min.js" defer></script>
<script src="<%- url %>/vendor/handlebars/handlebars.min.js" defer></script>
- <script src="<%- url %>/vendor/js-url/url.min.js" defer></script>
- <% } %>
+ <script src="<%- url %>/vendor/js-url/url.min.js" defer></script>
+ <% } %>
<script src="<%- url %>/vendor/js.cookie.js" defer></script>
<script src="<%- url %>/vendor/list.min.js" defer></script>
<script src="<%- url %>/vendor/FileSaver.min.js" defer></script>
@@ -208,4 +212,4 @@
<script src="<%- url %>/js/cover.js" defer></script>
</body>
-</html> \ No newline at end of file
+</html>