From: Darren Date: Sun, 21 Oct 2012 14:17:50 +0000 (+0100) Subject: Serving new client code X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0ae87edb6b1a62ce232372d43302aa226593745e;p=KiwiIRC.git Serving new client code --- diff --git a/server/http-handler.js b/server/http-handler.js index 83d7d35..950f1e5 100755 --- a/server/http-handler.js +++ b/server/http-handler.js @@ -13,11 +13,20 @@ module.exports.HttpHandler = HttpHandler; HttpHandler.prototype.serve = function (request, response) { + // The incoming requests root directory (ie. /kiwiclient/) + // TODO: check the config for this setting + var root_path = '/client', + root_path_regex = root_path.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'); + + // Any asset request to head into the asset dir + request.url = request.url.replace(root_path + '/assets/', '/assets/'); + // Any requests for /client to load the index file - if (request.url.match(/^\/client/)) { + if (request.url.match(new RegExp('^' + root_path_regex, 'i'))) { request.url = '/'; } + this.file_server.serve(request, response, function (err) { if (err) { response.writeHead(err.status, err.headers);