]> git.sesse.net Git - remoteglot/commitdiff
Make serve-analysis.js capable of handling e.g. /analysis2.pl.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 25 Jun 2015 20:07:22 +0000 (22:07 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 25 Jun 2015 20:08:06 +0000 (22:08 +0200)
www/serve-analysis.js

index d69c23a7dd2135e43062c710589202319fd432ee..9bb33cfd28340d29dc7ae7e871db8b99bd148782 100644 (file)
@@ -20,10 +20,16 @@ if (process.argv.length >= 3) {
        json_filename = process.argv[2];
 }
 
        json_filename = process.argv[2];
 }
 
+// Expected destination filename.
+var serve_url = '/analysis.pl';
+if (process.argv.length >= 4) {
+       serve_url = process.argv[3];
+}
+
 // TCP port to listen on.
 var port = 5000;
 // TCP port to listen on.
 var port = 5000;
-if (process.argv.length >= 4) {
-       port = parseInt(process.argv[3]);
+if (process.argv.length >= 5) {
+       port = parseInt(process.argv[4]);
 }
 
 // If set to 1, we are already processing a JSON update and should not
 }
 
 // If set to 1, we are already processing a JSON update and should not
@@ -264,7 +270,7 @@ server.on('request', function(request, response) {
                handle_viewer_override(request, u, response);
                return;
        }
                handle_viewer_override(request, u, response);
                return;
        }
-       if (u.pathname !== '/analysis.pl') {
+       if (u.pathname !== serve_url) {
                // This is not the request you are looking for.
                send_404(response);
                return;
                // This is not the request you are looking for.
                send_404(response);
                return;