From 619def5cc38db0f645379b19e8bc26f136328fc8 Mon Sep 17 00:00:00 2001 From: Dave Winer Date: Wed, 18 Feb 2015 19:25:02 -0500 Subject: [PATCH] v0.54 --- lib/utils.js | 4 ++++ pagepark.js | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index cac8fc6..261a4b9 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -16,6 +16,7 @@ exports.isAlpha = isAlpha; exports.isNumeric = isNumeric; exports.stringLastField = stringLastField; exports.multipleReplaceAll = multipleReplaceAll; +exports.replaceAll = replaceAll; //2/17/15 by DW exports.kilobyteString = kilobyteString; exports.megabyteString = megabyteString; exports.gigabyteString = gigabyteString; @@ -913,4 +914,7 @@ function gigabyteString (num) { //1/24/15 by DW num = Number (num) / onegig; return (num.toFixed (2) + "GB"); } +function dateToNumber (theDate) { //2/15/15 by DW + return (Number (new Date (theDate))); + } diff --git a/pagepark.js b/pagepark.js index 1fccf8b..7682dd3 100644 --- a/pagepark.js +++ b/pagepark.js @@ -1,4 +1,4 @@ -var myVersion = "0.53", myProductName = "PagePark"; +var myVersion = "0.54", myProductName = "PagePark"; //The MIT License (MIT) @@ -200,6 +200,10 @@ function handleHttpRequest (httpRequest, httpResponse) { }); } function serveFile (f) { + function httpReturn (val, type) { //2/17/15 by DW + httpResponse.writeHead (200, {"Content-Type": type}); + httpResponse.end (val.toString ()); + } fs.readFile (f, function (err, data) { if (err) { return404 (); @@ -210,8 +214,10 @@ function handleHttpRequest (httpRequest, httpResponse) { case "js": try { var val = eval (data.toString ()); - httpResponse.writeHead (200, {"Content-Type": "text/html"}); - httpResponse.end (val.toString ()); + if (val !== undefined) { //2/17/15 by DW + httpResponse.writeHead (200, {"Content-Type": "text/html"}); + httpResponse.end (val.toString ()); + } } catch (err) { httpResponse.writeHead (500, {"Content-Type": "text/plain"});