Merge branch 'janniklorenz-master'

This commit is contained in:
Cheng-Han, Wu 2016-05-15 09:56:15 +08:00
commit a816420302
6 changed files with 65 additions and 29 deletions

View File

@ -124,7 +124,8 @@ Third-party integration api key settings
| facebook, twitter, github, dropbox | `config.json` | for signin | | facebook, twitter, github, dropbox | `config.json` | for signin |
| imgur | `config.json` | for image upload | | imgur | `config.json` | for image upload |
| dropbox | `public/views/foot.ejs` | for chooser and saver | | 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 Operational Transformation
--- ---

View File

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

View File

@ -72,7 +72,8 @@ function responseError(res, code, detail, msg) {
code: code, code: code,
detail: detail, detail: detail,
msg: msg, msg: msg,
useCDN: config.usecdn useCDN: config.usecdn,
googleDrive: config.googleDrive,
}); });
res.write(content); res.write(content);
res.end(); res.end();
@ -95,6 +96,7 @@ function showIndex(req, res, next) {
twitter: config.twitter, twitter: config.twitter,
github: config.github, github: config.github,
dropbox: config.dropbox, dropbox: config.dropbox,
googleDrive: config.googleDrive,
}); });
res.write(content); res.write(content);
res.end(); res.end();
@ -125,6 +127,7 @@ function responseHackMD(res, note) {
twitter: config.twitter, twitter: config.twitter,
github: config.github, github: config.github,
dropbox: config.dropbox, dropbox: config.dropbox,
googleDrive: config.googleDrive,
}); });
var buf = html; var buf = html;
res.writeHead(200, { res.writeHead(200, {

View File

@ -71,8 +71,12 @@
<script src="<%- url %>/vendor/md-toc.js" defer></script> <script src="<%- url %>/vendor/md-toc.js" defer></script>
<script src="<%- url %>/vendor/showup/showup.js" defer></script> <script src="<%- url %>/vendor/showup/showup.js" defer></script>
<script src="<%- url %>/vendor/randomColor.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> <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="https://www.google.com/jsapi" defer></script>
<% } %>
<script src="<%- url %>/js/google-drive-upload.js" 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/google-drive-picker.js" defer></script>
<script src="<%- url %>/js/common.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/history.js" defer></script>
<script src="<%- url %>/js/index.js" defer></script> <script src="<%- url %>/js/index.js" defer></script>
<script src="<%- url %>/js/syncscroll.js" defer></script> <script src="<%- url %>/js/syncscroll.js" defer></script>
<% if(googleDrive) { %>
<script src="https://apis.google.com/js/client:plusone.js?onload=onGoogleClientLoaded" defer></script> <script src="https://apis.google.com/js/client:plusone.js?onload=onGoogleClientLoaded" defer></script>
<% } %>

View File

@ -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 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>
<li class="divider"></li> <li class="divider"></li>
<% if((googleDrive == "true") || (typeof dropbox !== 'undefined' && dropbox) || (typeof github !== 'undefined' && github)) { %>
<li class="dropdown-header">Export</li> <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 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> </li>
<% } %>
<% if(googleDrive == "true") { %>
<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 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> </li>
<% } %>
<% if(typeof github !== 'undefined' && github) { %> <% 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 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>
<% } %> <% } %>
<li class="divider"></li> <li class="divider"></li>
<% } %>
<li class="dropdown-header">Import</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 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> </li>
<% } %>
<% if(googleDrive == "true") { %>
<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 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>
<% } %>
<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 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>
<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> <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 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>
<li class="divider"></li> <li class="divider"></li>
<% if((googleDrive == "true") || (typeof dropbox !== 'undefined' && dropbox) || (typeof github !== 'undefined' && github)) { %>
<li class="dropdown-header">Export</li> <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 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> </li>
<% } %>
<% if(googleDrive == "true") { %>
<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 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> </li>
<% } %>
<% if(typeof github !== 'undefined' && github) { %> <% 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 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>
<% } %> <% } %>
<li class="divider"></li> <li class="divider"></li>
<% } %>
<li class="dropdown-header">Import</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 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> </li>
<% } %>
<% if(googleDrive == "true") { %>
<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 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>
<% } %>
<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 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>
<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> <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>

View File

@ -58,8 +58,10 @@
<p class="lead"> <p class="lead">
Realtime collaborative markdown notes on all platforms. Realtime collaborative markdown notes on all platforms.
</p> </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> <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> <div class="ui-or" style="display:none;">Or</div>
<% }%>
<p class="lead"> <p class="lead">
<a href="<%- url %>/new" class="btn btn-lg btn-default">New note</a> <a href="<%- url %>/new" class="btn btn-lg btn-default">New note</a>
</p> </p>
@ -70,6 +72,7 @@
</div> </div>
<div id="history" class="section" style="display:none;"> <div id="history" class="section" style="display:none;">
<% if(facebook || twitter || github || dropbox) { %>
<div class="ui-signin"> <div class="ui-signin">
<h4> <h4>
<a type="button" class="btn btn-success" data-toggle="modal" data-target=".signin-modal">Sign In</a> to get own history! <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="<%- url %>/new" class="btn btn-default">New note</a> Or
<a href="#" class="btn btn-danger ui-logout">Sign Out</a> <a href="#" class="btn btn-danger ui-logout">Sign Out</a>
</div> </div>
<% }%>
<hr> <hr>
<form class="form-inline"> <form class="form-inline">
<div class="form-group" style="vertical-align: bottom;"> <div class="form-group" style="vertical-align: bottom;">