master
Dave Winer 9 years ago
parent 234604ba0d
commit 619def5cc3

@ -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)));
}

@ -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"});

Loading…
Cancel
Save