daveappserver 0.5.52 → 0.5.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/appserver.js +21 -4
  2. package/package.json +1 -1
package/appserver.js CHANGED
@@ -1,4 +1,4 @@
1
- var myVersion = "0.5.52", myProductName = "daveAppServer";
1
+ var myVersion = "0.5.55", myProductName = "daveAppServer";
2
2
 
3
3
  exports.start = startup;
4
4
  exports.notifySocketSubscribers = notifySocketSubscribers;
@@ -939,6 +939,7 @@ function startup (options, callback) {
939
939
  config.twitter.http404Callback = http404Callback; //1/24/21 by DW
940
940
  config.twitter.twitterConsumerKey = config.twitterConsumerKey;
941
941
  config.twitter.twitterConsumerSecret = config.twitterConsumerSecret;
942
+ config.twitter.userLogonCallback = userLogonCallback; //8/14/22 by DW
942
943
  davetwitter.start (config.twitter);
943
944
  }
944
945
  function handleHttpRequest (theRequest) {
@@ -1039,10 +1040,21 @@ function startup (options, callback) {
1039
1040
  }
1040
1041
  }
1041
1042
  if (config.addMacroToPagetable !== undefined) {
1042
- config.addMacroToPagetable (pagetable);
1043
+ config.addMacroToPagetable (pagetable, theRequest); //8/10/22 by DW
1044
+ }
1045
+
1046
+ function replaceAllAndReturnHtml () {
1047
+ var pagetext = utils.multipleReplaceAll (templatetext.toString (), pagetable, false, "[%", "%]");
1048
+ returnHtml (pagetext);
1049
+ }
1050
+ if (config.asyncAddMacroToPagetable !== undefined) { //8/10/22 by DW
1051
+ config.asyncAddMacroToPagetable (pagetable, theRequest, function () {
1052
+ replaceAllAndReturnHtml ();
1053
+ });
1054
+ }
1055
+ else {
1056
+ replaceAllAndReturnHtml ();
1043
1057
  }
1044
- var pagetext = utils.multipleReplaceAll (templatetext.toString (), pagetable, false, "[%", "%]");
1045
- returnHtml (pagetext);
1046
1058
  }
1047
1059
  if (config.pathServerHomePageSource !== undefined) {
1048
1060
  fs.readFile (config.pathServerHomePageSource, function (err, templatetext) {
@@ -1300,6 +1312,11 @@ function startup (options, callback) {
1300
1312
  return (false); //tell davetwitter we didn't handle it
1301
1313
  }
1302
1314
  }
1315
+ function userLogonCallback (options) { //8/14/22 by DW
1316
+ if (config.userLogonCallback !== undefined) {
1317
+ config.userLogonCallback (options);
1318
+ }
1319
+ }
1303
1320
  function everyMinute () {
1304
1321
  var now = new Date ();
1305
1322
  if (config.everyMinute !== undefined) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "daveappserver",
3
3
  "description": "Factored code that was appearing in all my servers.",
4
- "version": "0.5.52",
4
+ "version": "0.5.55",
5
5
  "main": "appserver.js",
6
6
  "repository": {
7
7
  "type" : "git",