master
Dave Winer 9 years ago
parent 44e6dc2664
commit a7ac58e182

@ -88,6 +88,10 @@ There will always be more work to do here. ;-)
#### Updates #### Updates
##### v0.68 8/31/15 by DW
Small change in error handling when we delegate a request. The previous method would cause PagePark to crash if the app we're trying to delegate to isn't running. Thanks to Dan MacTough for the help fixing this. ;-)
##### v0.67 7/30/15 by DW ##### v0.67 7/30/15 by DW
New redirect feature for individual pages. New redirect feature for individual pages.

@ -835,7 +835,7 @@ function sleepTillTopOfMinute (callback) { //11/22/14 by DW
if (ctseconds == 0) { if (ctseconds == 0) {
ctseconds = 60; ctseconds = 60;
} }
setTimeout (everyMinute, ctseconds * 1000); setTimeout (callback, ctseconds * 1000); //8/13/15 by DW -- was hard-coded to "everyMinute" ignored the callback param, fixed
} }
function scheduleNextRun (callback, ctMillisecsBetwRuns) { //11/27/14 by DW function scheduleNextRun (callback, ctMillisecsBetwRuns) { //11/27/14 by DW
var ctmilliseconds = ctMillisecsBetwRuns - (Number (new Date ().getMilliseconds ()) + ctMillisecsBetwRuns) % ctMillisecsBetwRuns; var ctmilliseconds = ctMillisecsBetwRuns - (Number (new Date ().getMilliseconds ()) + ctMillisecsBetwRuns) % ctMillisecsBetwRuns;
@ -949,4 +949,21 @@ function gigabyteString (num) { //1/24/15 by DW
function dateToNumber (theDate) { //2/15/15 by DW function dateToNumber (theDate) { //2/15/15 by DW
return (Number (new Date (theDate))); return (Number (new Date (theDate)));
} }
function getFileModDate (f, callback) { //8/26/15 by DW
fs.exists (f, function (flExists) {
if (flExists) {
fs.stat (f, function (err, stats) {
if (err) {
callback (undefined);
}
else {
callback (new Date (stats.mtime).toString ());
}
});
}
else {
callback (undefined);
}
});
}

@ -1,4 +1,4 @@
var myVersion = "0.67c", myProductName = "PagePark"; var myVersion = "0.68a", myProductName = "PagePark";
/* The MIT License (MIT) /* The MIT License (MIT)
Copyright (c) 2014-2015 Dave Winer Copyright (c) 2014-2015 Dave Winer
@ -374,13 +374,17 @@ function handleHttpRequest (httpRequest, httpResponse) {
"X-Forwarded-For": httpRequest.connection.remoteAddress "X-Forwarded-For": httpRequest.connection.remoteAddress
} }
}; };
try { function handleError (err) {
httpRequest.pipe (request (theRequest)).pipe (httpResponse); if (err) {
} console.log ("delegateRequest: error == " + err.message);
catch (tryError) { httpResponse.writeHead (500, {"Content-Type": "text/plain"});
httpResponse.writeHead (500, {"Content-Type": "text/plain"}); httpResponse.end (tryError.message);
httpResponse.end (tryError.message); }
} }
var req = httpRequest.pipe (request (theRequest));
req.on ("error", handleError);
req.pipe (httpResponse).on ("error", handleError);
} }
function findMappedDomain (domain, callback) { //5/23/15 by DW function findMappedDomain (domain, callback) { //5/23/15 by DW
for (var x in pageparkPrefs.domainMap) { for (var x in pageparkPrefs.domainMap) {

Loading…
Cancel
Save