moving towards getting this working again after the merge...
authorJack Allnutt <m2ys4u@Gmail.com>
Tue, 18 Sep 2012 23:05:42 +0000 (00:05 +0100)
committerJack Allnutt <m2ys4u@Gmail.com>
Tue, 18 Sep 2012 23:05:42 +0000 (00:05 +0100)
client_backbone/backbone-git.js [moved from client_backbone/js/backbone-git.js with 100% similarity]
client_backbone/index.html [changed mode: 0644->0755]
client_backbone/jquery-1.7.1.min.js [moved from client_backbone/js/jquery-1.7.1.min.js with 100% similarity]
client_backbone/underscore-min.js [moved from client_backbone/js/underscore-min.js with 100% similarity]
server/http-handler.js

old mode 100644 (file)
new mode 100755 (executable)
index d771d90..0e915ad
@@ -5,7 +5,7 @@
 
 <title> KiwiIRC </title>
 
-<link rel="stylesheet" type="text/css" href="style.css" />
+<link rel="stylesheet" type="text/css" href="css/style.css" />
 
 </head>
 <body>
                 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
index aa3d2c04311edd3c5efed43bb7e2eb0a08072549..01307b0e68125b038b180816efc32f28337d6c67 100755 (executable)
@@ -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);
     }
 };