From 69369f52cd7c1318c1db87c9c67a4a7f9a41931b Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Wed, 19 Sep 2012 00:05:42 +0100 Subject: [PATCH] moving towards getting this working again after the merge... --- client_backbone/{js => }/backbone-git.js | 0 client_backbone/index.html | 4 +- client_backbone/{js => }/jquery-1.7.1.min.js | 0 client_backbone/{js => }/underscore-min.js | 0 server/http-handler.js | 90 +------------------- 5 files changed, 4 insertions(+), 90 deletions(-) rename client_backbone/{js => }/backbone-git.js (100%) mode change 100644 => 100755 client_backbone/index.html rename client_backbone/{js => }/jquery-1.7.1.min.js (100%) rename client_backbone/{js => }/underscore-min.js (100%) diff --git a/client_backbone/js/backbone-git.js b/client_backbone/backbone-git.js similarity index 100% rename from client_backbone/js/backbone-git.js rename to client_backbone/backbone-git.js diff --git a/client_backbone/index.html b/client_backbone/index.html old mode 100644 new mode 100755 index d771d90..0e915ad --- a/client_backbone/index.html +++ b/client_backbone/index.html @@ -5,7 +5,7 @@ KiwiIRC - + @@ -170,7 +170,7 @@ container: $('#kiwi'), // Override the kiwi_server to use. (Think: running on standalone client..) - kiwi_server: 'http://192.168.1.13:7778' + kiwi_server: 'https://192.168.1.10:7777' }; // Start the app by either the dev or closed environment diff --git a/client_backbone/js/jquery-1.7.1.min.js b/client_backbone/jquery-1.7.1.min.js similarity index 100% rename from client_backbone/js/jquery-1.7.1.min.js rename to client_backbone/jquery-1.7.1.min.js diff --git a/client_backbone/js/underscore-min.js b/client_backbone/underscore-min.js similarity index 100% rename from client_backbone/js/underscore-min.js rename to client_backbone/underscore-min.js diff --git a/server/http-handler.js b/server/http-handler.js index aa3d2c0..01307b0 100755 --- a/server/http-handler.js +++ b/server/http-handler.js @@ -49,99 +49,13 @@ var serve_static_file = function (request, response) { HTTPHandler.prototype.handler = function (request, response) { var file_list, default_file_list, hash, uri, site, subs, self = this; - site = 'default'; uri = url.parse(request.url, true); subs = uri.pathname.substr(0, 4); - if (uri.pathname === '/all.js') { - hash = is_cached(site,'all.js'); - if (!hash) { - file_list = []; - default_file_list = []; - console.log('a'); - fs.readFile('client_backbone/manifest.json', 'utf-8', function (err, manifest) { - console.log('b'); - var js = ''; - manifest = JSON.parse(manifest); - _.each(manifest.js, function (file) { - console.log(file) - js += fs.readFileSync('client_backbone/js/' + file, 'utf-8') + '\r\n'; - }); - - // TODO: Replace false with check for debug flag - if (/* debug === */ false) { - js = uglify.uglify.gen_code(uglify.uglify.ast_squeeze(uglify.uglify.ast_mangle(uglify.parser.parse(js)))); - } - - hash = set_cache(site, 'all.js', js); - if (request.headers['if-none-match'] === hash) { - response.statusCode = 304; - } else { - response.setHeader('Content-type', 'application/javascript'); - response.setHeader('ETag', hash); - response.write(js); - } - response.end(); - }); - } else { - if (request.headers['if-none-match'] === hash) { - response.statusCode = 304; - } else { - response.setHeader('Content-type', 'application/javascript'); - response.setHeader('ETag', hash); - response.write(get_cache(site, 'all.js')); - } - response.end(); - } - } else if (uri.pathname === '/') { - var jadefile = ''; - - hash = is_cached(site, '/'); - - if (!hash) { - try { - fs.readFile('client_backbone/index.jade', 'utf-8', function (err, str) { - if (err) { - console.log(err + ''); - response.end(); - } else { - jadefile = str; - } - hash = set_cache('default', '/', jade.compile(jadefile, {pretty: true})()); - if (response.statusCode !== 500) { - if (request.headers['if-none-match'] === hash) { - response.statusCode = 304; - } else { - response.setHeader('Content-type', 'text/html; charset=utf-8'); - response.setHeader('ETag', hash); - response.write(get_cache(site, '/')); - } - } - response.end(); - }); - - } catch (e) { - console.log(e); - response.statusCode = 500; - response.end(); - } - } else { - if (request.headers['if-none-match'] === hash) { - response.statusCode = 304; - } else { - response.setHeader('Content-type', 'text/html; charset=utf-8'); - response.setHeader('ETag', hash); - response.write(get_cache(site, '/')); - } - response.end(); - } - } else if ((subs === '/img') || (subs === '/css')) { - serve_static_file.call(this, request, response); - } else if (uri.pathname.substr(0, 10) === '/socket.io') { + if (uri.pathname.substr(0, 10) === '/socket.io') { return; } else { - response.statusCode = 404; - response.end(); + serve_static_file.call(this, request, response); } }; -- 2.25.1