diff --git a/html/index.html b/html/index.html
index e585c604..43f08cb9 100644
--- a/html/index.html
+++ b/html/index.html
@@ -8,11 +8,11 @@
{{ title }}
-
-
+
+
@@ -31,7 +31,7 @@
-
+
diff --git a/lib/client.js b/lib/client.js
index 698748ac..c1329243 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -171,7 +171,7 @@ var Util, DOM, CloudFunc, join;
});
};
- CloudCmd.PREFIX = prefix;
+ CloudCmd.PREFIX = prefix;
CloudCmd.LIBDIR = prefix + '/lib/';
CloudCmd.LIBDIRCLIENT = prefix + '/lib/client/';
diff --git a/lib/client/cloudcmd.js b/lib/client/cloudcmd.js
index 58240272..03d7af01 100644
--- a/lib/client/cloudcmd.js
+++ b/lib/client/cloudcmd.js
@@ -47,7 +47,7 @@ var CloudCmd;
urlFiles = getJoinURL(files);
if (!prefix)
- prefix = '/cloudcmd';
+ prefix = '';
createScript(prefix + urlFiles, function() {
CloudCmd.init(prefix);
diff --git a/lib/client/dom.js b/lib/client/dom.js
index 8ff8f9d6..45fe1e41 100644
--- a/lib/client/dom.js
+++ b/lib/client/dom.js
@@ -1065,6 +1065,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
this.setHistory = function(data, pTitle, url) {
var ret = window.history;
+ url = CloudCmd.PREFIX + url;
+
if (ret)
history.pushState(data, pTitle, url);
diff --git a/lib/cloudcmd.js b/lib/cloudcmd.js
index 4abbfc9c..a0e181a8 100644
--- a/lib/cloudcmd.js
+++ b/lib/cloudcmd.js
@@ -37,7 +37,7 @@
module.exports = function(params) {
var keys,
p = params || {},
- prefix = p.prefix || '/cloudcmd';
+ prefix = p.prefix || '';
if (params) {
keys = Object.keys(params);
@@ -47,6 +47,9 @@
});
}
+ if (p.socket)
+ module.exports.listen(p.socket);
+
return cloudcmd(prefix);
};
@@ -110,7 +113,9 @@
root : root
}),
rest,
- route,
+ route({
+ prefix: prefix
+ }),
join({
dir : DIR_ROOT,
diff --git a/lib/server/route.js b/lib/server/route.js
index 8335c15c..0bd4bc32 100644
--- a/lib/server/route.js
+++ b/lib/server/route.js
@@ -36,13 +36,22 @@
Template = {},
+ Prefix,
FS = CloudFunc.FS;
- module.exports = function(req, res, next) {
+ module.exports = function(params) {
+ var p = params || {};
+
+ Prefix = p.prefix || '';
+
+ return middle;
+ };
+
+ function middle(req, res, next) {
readFiles(function() {
route(req, res, next);
});
- };
+ }
/**
* additional processing of index file
@@ -77,7 +86,8 @@
data = rendy(data, {
title : CloudFunc.getTitle(),
- fm : left + right
+ fm : left + right,
+ prefix : Prefix
});
return data;