daveappserver 0.5.51 → 0.5.54
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.
- package/appserver.js +39 -6
- package/package.json +1 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.5.
|
|
1
|
+
var myVersion = "0.5.54", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -1012,6 +1012,16 @@ function startup (options, callback) {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
function returnServerHomePage () {
|
|
1014
1014
|
function servePage (templatetext) {
|
|
1015
|
+
|
|
1016
|
+
function arrayToParam (theArray) { //7/21/22 by DW
|
|
1017
|
+
if (theArray === undefined) {
|
|
1018
|
+
return (undefined);
|
|
1019
|
+
}
|
|
1020
|
+
else {
|
|
1021
|
+
return (JSON.stringify (theArray));
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1015
1025
|
var pagetable = {
|
|
1016
1026
|
productName: config.productName,
|
|
1017
1027
|
productNameForDisplay: config.productNameForDisplay,
|
|
@@ -1021,8 +1031,7 @@ function startup (options, callback) {
|
|
|
1021
1031
|
flEnableLogin: config.flEnableLogin,
|
|
1022
1032
|
prefsPath: config.prefsPath,
|
|
1023
1033
|
docsPath: config.docsPath,
|
|
1024
|
-
idGitHubClient: config.githubClientId
|
|
1025
|
-
whitelist: config.whitelist //7/21/22 by DW
|
|
1034
|
+
idGitHubClient: config.githubClientId //11/9/21 by DW
|
|
1026
1035
|
};
|
|
1027
1036
|
if (theRequest.addToPagetable !== undefined) { //3/9/21 by DW
|
|
1028
1037
|
for (var x in theRequest.addToPagetable) {
|
|
@@ -1030,10 +1039,21 @@ function startup (options, callback) {
|
|
|
1030
1039
|
}
|
|
1031
1040
|
}
|
|
1032
1041
|
if (config.addMacroToPagetable !== undefined) {
|
|
1033
|
-
config.addMacroToPagetable (pagetable);
|
|
1042
|
+
config.addMacroToPagetable (pagetable, theRequest); //8/10/22 by DW
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
function replaceAllAndReturnHtml () {
|
|
1046
|
+
var pagetext = utils.multipleReplaceAll (templatetext.toString (), pagetable, false, "[%", "%]");
|
|
1047
|
+
returnHtml (pagetext);
|
|
1048
|
+
}
|
|
1049
|
+
if (config.asyncAddMacroToPagetable !== undefined) { //8/10/22 by DW
|
|
1050
|
+
config.asyncAddMacroToPagetable (pagetable, theRequest, function () {
|
|
1051
|
+
replaceAllAndReturnHtml ();
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
else {
|
|
1055
|
+
replaceAllAndReturnHtml ();
|
|
1034
1056
|
}
|
|
1035
|
-
var pagetext = utils.multipleReplaceAll (templatetext.toString (), pagetable, false, "[%", "%]");
|
|
1036
|
-
returnHtml (pagetext);
|
|
1037
1057
|
}
|
|
1038
1058
|
if (config.pathServerHomePageSource !== undefined) {
|
|
1039
1059
|
fs.readFile (config.pathServerHomePageSource, function (err, templatetext) {
|
|
@@ -1221,6 +1241,19 @@ function startup (options, callback) {
|
|
|
1221
1241
|
getGithubUserInfo (params.username, params.accessToken, httpReturn);
|
|
1222
1242
|
});
|
|
1223
1243
|
return (true);
|
|
1244
|
+
case "/useriswhitelisted": //7/21/22 by DW
|
|
1245
|
+
callWithScreenname (function (screenname) {
|
|
1246
|
+
var flWhitelisted = false;
|
|
1247
|
+
if (config.whitelist === undefined) {
|
|
1248
|
+
flWhitelisted = true;
|
|
1249
|
+
}
|
|
1250
|
+
else {
|
|
1251
|
+
flWhitelisted = config.whitelist.includes (screenname);
|
|
1252
|
+
}
|
|
1253
|
+
console.log ("/useriswhitelisted: screenname == " + screenname + ", flWhitelisted == " + flWhitelisted);
|
|
1254
|
+
returnData ({flWhitelisted});
|
|
1255
|
+
});
|
|
1256
|
+
return (true);
|
|
1224
1257
|
|
|
1225
1258
|
}
|
|
1226
1259
|
break;
|