Commit 4cedbe11 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

changed calls in spacedeck_routes.js to hardcodedly call /spacedeck/<stuff>

parent 5cf97b91
...@@ -11,7 +11,7 @@ var SpacedeckRoutes = { ...@@ -11,7 +11,7 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/spaces/:id", path: "/spacedeck/spaces/:id",
handler: function(params, on_success) { handler: function(params, on_success) {
this.load_space(params.id, on_success); this.load_space(params.id, on_success);
}.bind(this) }.bind(this)
...@@ -20,7 +20,7 @@ var SpacedeckRoutes = { ...@@ -20,7 +20,7 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/s/:hash", path: "/spacedeck/s/:hash",
handler: function(params, on_success) { handler: function(params, on_success) {
var parts = params.hash.split("-"); var parts = params.hash.split("-");
if (path.length > 0) { if (path.length > 0) {
...@@ -35,10 +35,10 @@ var SpacedeckRoutes = { ...@@ -35,10 +35,10 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/confirm/:token", path: "/spacedeck/confirm/:token",
handler: function(params) { handler: function(params) {
if (!this.logged_in) { if (!this.logged_in) {
this.redirect_to("/login"); this.redirect_to("/spacedeck/login");
} else { } else {
this.confirm_account(params.token); this.confirm_account(params.token);
} }
...@@ -48,13 +48,13 @@ var SpacedeckRoutes = { ...@@ -48,13 +48,13 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/password-confirm/:token", path: "/spacedeck/password-confirm/:token",
handler: function(params) { handler: function(params) {
console.log(params.token); console.log(params.token);
if (this.logged_in) { if (this.logged_in) {
this.redirect_to("/spaces"); this.redirect_to("/spacedeck/spaces");
} else { } else {
this.reset_token = params.token; this.reset_token = params.token;
this.active_view = "password-confirm"; this.active_view = "password-confirm";
...@@ -66,7 +66,7 @@ var SpacedeckRoutes = { ...@@ -66,7 +66,7 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/password-reset", path: "/spacedeck/password-reset",
handler: function(params, test) { handler: function(params, test) {
if (this.logged_in) { if (this.logged_in) {
} else { } else {
...@@ -78,20 +78,20 @@ var SpacedeckRoutes = { ...@@ -78,20 +78,20 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/accept/:membership_id", path: "/spacedeck/accept/:membership_id",
handler: function(params, test) { handler: function(params, test) {
if (this.logged_in) { if (this.logged_in) {
var invitation_token = get_query_param("code"); var invitation_token = get_query_param("code");
accept_invitation(params.membership_id, invitation_token , function(m) { accept_invitation(params.membership_id, invitation_token , function(m) {
window._spacedeck_location_change = true; window._spacedeck_location_change = true;
location.href = "/spaces/"+m.space._id; location.href = "/spacedeck/spaces/"+m.space._id;
}.bind(this), function(xhr) { }.bind(this), function(xhr) {
smoke.alert("Error ("+xhr.status+")", function() { smoke.alert("Error ("+xhr.status+")", function() {
this.redirect_to("/spaces"); this.redirect_to("/spacedeck/spaces");
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
} else { } else {
this.redirect_to("/login"); this.redirect_to("/spacedeck/login");
} }
}.bind(this) }.bind(this)
} }
...@@ -99,7 +99,7 @@ var SpacedeckRoutes = { ...@@ -99,7 +99,7 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/signup", path: "/spacedeck/signup",
handler: function(params) { handler: function(params) {
var invitation_token = get_query_param("code"); var invitation_token = get_query_param("code");
...@@ -108,7 +108,7 @@ var SpacedeckRoutes = { ...@@ -108,7 +108,7 @@ var SpacedeckRoutes = {
} }
if (this.logged_in) { if (this.logged_in) {
this.redirect_to("/spaces"); this.redirect_to("/spacedeck/spaces");
} else { } else {
this.active_view = "signup"; this.active_view = "signup";
} }
...@@ -119,7 +119,7 @@ var SpacedeckRoutes = { ...@@ -119,7 +119,7 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/login", path: "/spacedeck/login",
handler: function(params) { handler: function(params) {
if (this.logged_in) { if (this.logged_in) {
if(this.invitation_token) { if(this.invitation_token) {
...@@ -128,7 +128,7 @@ var SpacedeckRoutes = { ...@@ -128,7 +128,7 @@ var SpacedeckRoutes = {
location.href = "spaces/"+m.space_id; location.href = "spaces/"+m.space_id;
}.bind(this), function(xhr) { console.error(xhr); }); }.bind(this), function(xhr) { console.error(xhr); });
} else { } else {
this.redirect_to("/spaces"); this.redirect_to("/spacedeck/spaces");
} }
} else { } else {
this.active_view = "login"; this.active_view = "login";
...@@ -143,14 +143,14 @@ var SpacedeckRoutes = { ...@@ -143,14 +143,14 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/logout", path: "/spacedeck/logout",
handler: function(params) { handler: function(params) {
if (this.logged_in) { if (this.logged_in) {
this.logout(function(m) { this.logout(function(m) {
this.redirect_to("/login"); this.redirect_to("/spacedeck/login");
}.bind(this), function(xhr) { console.error(xhr); }); }.bind(this), function(xhr) { console.error(xhr); });
} else { } else {
this.redirect_to("/login"); this.redirect_to("/spacedeck/login");
} }
}.bind(this) }.bind(this)
} }
...@@ -158,17 +158,17 @@ var SpacedeckRoutes = { ...@@ -158,17 +158,17 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/spaces", path: "/spacedeck/spaces",
handler: function(params) { handler: function(params) {
if (!this.logged_in) { if (!this.logged_in) {
window._spacedeck_location_change = true; window._spacedeck_location_change = true;
location.href = "/login"; location.href = "/spacedeck/login";
} else { } else {
if (this.logged_in && this.user.home_folder_id) { if (this.logged_in && this.user.home_folder_id) {
this.load_space(this.user.home_folder_id); this.load_space(this.user.home_folder_id);
} else { } else {
location.href = "/"; location.href = "/spacedeck/";
} }
} }
...@@ -178,11 +178,11 @@ var SpacedeckRoutes = { ...@@ -178,11 +178,11 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/account", path: "/spacedeck/account",
handler: function(params) { handler: function(params) {
if (!this.logged_in) { if (!this.logged_in) {
window._spacedeck_location_change = true; window._spacedeck_location_change = true;
location.href = "/"; location.href = "/spacedeck/";
} else { } else {
this.active_view = "account"; this.active_view = "account";
} }
...@@ -193,11 +193,11 @@ var SpacedeckRoutes = { ...@@ -193,11 +193,11 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/team", path: "/spacedeck/team",
handler: function(params) { handler: function(params) {
if (!this.logged_in) { if (!this.logged_in) {
window._spacedeck_location_change = true; window._spacedeck_location_change = true;
location.href = "/"; location.href = "/spacedeck/";
} else { } else {
this.active_view = "team"; this.active_view = "team";
this.load_team(); this.load_team();
...@@ -208,13 +208,13 @@ var SpacedeckRoutes = { ...@@ -208,13 +208,13 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/folders/:id", path: "/spacedeck/folders/:id",
handler: function(params) { handler: function(params) {
this.load_space(params.id, null, function(xhr) { this.load_space(params.id, null, function(xhr) {
// on_error // on_error
console.log("couldn't load folder: "+xhr.status); console.log("couldn't load folder: "+xhr.status);
this.redirect_to("/spaces", function(){}); this.redirect_to("/spacedeck/spaces", function(){});
}.bind(this)); }.bind(this));
}.bind(this) }.bind(this)
} }
...@@ -223,27 +223,27 @@ var SpacedeckRoutes = { ...@@ -223,27 +223,27 @@ var SpacedeckRoutes = {
this.router.add([ this.router.add([
{ {
path: "/", path: "/spacedeck/",
handler: function(params) { handler: function(params) {
location.href = "/"; location.href = "/spacedeck/";
}.bind(this) }.bind(this)
} }
]); ]);
this.router.add([ this.router.add([
{ {
path: "/terms", path: "/spacedeck/terms",
handler: function(params) { handler: function(params) {
location.href = "/terms"; location.href = "/spacedeck/terms";
}.bind(this) }.bind(this)
} }
]); ]);
this.router.add([ this.router.add([
{ {
path: "/privacy", path: "/spacedeck/privacy",
handler: function(params) { handler: function(params) {
location.href = "/privacy"; location.href = "/spacedeck/privacy";
}.bind(this) }.bind(this)
} }
]); ]);
...@@ -253,7 +253,7 @@ var SpacedeckRoutes = { ...@@ -253,7 +253,7 @@ var SpacedeckRoutes = {
if (foundRoute) { if (foundRoute) {
foundRoute[0].handler(foundRoute[0].params, on_success); foundRoute[0].handler(foundRoute[0].params, on_success);
} else { } else {
location.href = "/not_found"; location.href = "/spacedeck/not_found";
} }
}, },
...@@ -300,10 +300,10 @@ var SpacedeckRoutes = { ...@@ -300,10 +300,10 @@ var SpacedeckRoutes = {
}, },
link_to_parent_folder: function(space_id) { link_to_parent_folder: function(space_id) {
return "/folders/"+space_id; return "/spacedeck/folders/"+space_id;
}, },
link_to_space: function(space) { link_to_space: function(space) {
return "/"+space.space_type+"s/"+space._id; return "/spacedeck/"+space.space_type+"s/"+space._id;
} }
} }
...@@ -69,11 +69,14 @@ app.use(cookieParser()); ...@@ -69,11 +69,14 @@ app.use(cookieParser());
app.disable('x-powered-by'); app.disable('x-powered-by');
//app.use(helmet.noSniff()) //app.use(helmet.noSniff())
const endpoint = config.get('endpoint');
//app.use(require("./middlewares/error_helpers")); //app.use(require("./middlewares/error_helpers"));
//app.use(require("./middlewares/cors")); //app.use(require("./middlewares/cors"));
app.use(require("./middlewares/session")); app.use(require("./middlewares/session"));
app.use(require("./middlewares/i18n")); app.use(require("./middlewares/i18n"));
app.use("/api", require("./middlewares/api_helpers")); app.use(endpoint+"/api", require("./middlewares/api_helpers"));
app.use('/api/spaces/:id', require("./middlewares/space_helpers")); app.use('/api/spaces/:id', require("./middlewares/space_helpers"));
app.use('/api/spaces/:id/artifacts/:artifact_id', require("./middlewares/artifact_helpers")); app.use('/api/spaces/:id/artifacts/:artifact_id', require("./middlewares/artifact_helpers"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment