diff --git a/README.md b/README.md
index ffefafa..aa051e9 100644
--- a/README.md
+++ b/README.md
@@ -77,6 +77,7 @@ Server-side config.js settings
| usessl | `true` or `false` | set to use ssl |
| urladdport | `true` or `false` | set to add port on oauth callback url |
| debug | `true` or `false` | set debug mode, show more logs |
+| usecdn | `true` or `false` | set to use CDN resources or not |
| version | `0.3.2` | currnet version, must match same var in client side `index.js` |
| alloworigin | `['localhost']` | domain name whitelist |
| sslkeypath | `./cert/client.key` | ssl key path |
diff --git a/app.js b/app.js
index 628f463..a19715f 100644
--- a/app.js
+++ b/app.js
@@ -136,9 +136,7 @@ app.set('views', __dirname + '/public');
//set render engine
app.engine('html', ejs.renderFile);
//get index
-app.get("/", function (req, res, next) {
- res.render("index.html");
-});
+app.get("/", response.showIndex);
//get status
app.get("/status", function (req, res, next) {
realtime.getStatus(function (data) {
diff --git a/config.js b/config.js
index cfd9f20..b04066d 100644
--- a/config.js
+++ b/config.js
@@ -11,6 +11,7 @@ var urladdport = true; //add port on getserverurl
var config = {
debug: true,
+ usecdn: false,
version: '0.3.2',
domain: domain,
alloworigin: ['add here to allow origin to cross'],
diff --git a/lib/response.js b/lib/response.js
index b8cfab1..1f7fbd5 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -34,6 +34,7 @@ var response = {
showFeatures: showFeatures,
showNote: showNote,
showPublishNote: showPublishNote,
+ showIndex: showIndex,
noteActions: noteActions,
publishNoteActions: publishNoteActions
};
@@ -55,6 +56,18 @@ function responseError(res, code, detail, msg) {
res.end();
}
+function showIndex(req, res, next) {
+ res.writeHead(200, {
+ 'Content-Type': 'text/html'
+ });
+ var template = config.indexpath;
+ var content = ejs.render(fs.readFileSync(template, 'utf8'), {
+ useCDN: config.usecdn
+ });
+ res.write(content);
+ res.end();
+}
+
function responseHackMD(res, noteId) {
if (noteId != config.featuresnotename) {
if (!Note.checkNoteIdValid(noteId)) {
diff --git a/public/index.html b/public/index.ejs
similarity index 87%
rename from public/index.html
rename to public/index.ejs
index 829c044..dbc5e26 100644
--- a/public/index.html
+++ b/public/index.ejs
@@ -15,13 +15,19 @@
-
+ <% if(useCDN) { %>
+
+
+ <% } else { %>
+
+
+
+ <% } %>
-
@@ -203,21 +209,32 @@
-
-
+ <% if(useCDN) { %>
+
+
+
-
-
+
+
+
+
+ <% } else { %>
+
+
+
+
+
+
+
+
+ <% } %>
-
-
-