diff --git a/README.md b/README.md index 831d42b..7eedf80 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ content ## Feature requests * should write at the end of build console out that build is done (or error) -* share workspace files at static +* ~~share workspace files at static~~ * "clear workspace" button * show more builds button (or infinity scroll) on start page * hide console output by default (when go on completed build page you scroll diff --git a/app.js b/app.js index a052e70..1e5d1fa 100644 --- a/app.js +++ b/app.js @@ -19,13 +19,18 @@ var app = new EventEmitter(), httpApi; var staticPath = path.join(__dirname, 'static'), - staticServer = new nodeStatic.Server(staticPath); + staticServer = new nodeStatic.Server(staticPath), + staticDataServer; var server = http.createServer(function(req, res) { if (req.url.indexOf('/api/') === 0) { return httpApi(req, res); } + if (new RegExp('^/projects/(\\w|-)+/workspace').test(req.url)) { + return staticDataServer.serve(req, res); + } + if (req.url.indexOf('/data.io.js') === -1) { if (/(js|css|fonts)/.test(req.url)) { staticServer.serve(req, res); @@ -143,6 +148,8 @@ Steppy( // path to root dir (with projects, builds etc) app.config.paths.data = path.join(process.cwd(), 'data'); + staticDataServer = new nodeStatic.Server(app.config.paths.data); + app.config.paths.projects = path.join(app.config.paths.data, 'projects'); app.config.paths.db = path.join(app.config.paths.data, 'db'); app.config.paths.preload = path.join(app.config.paths.data, 'preload.json');