daveappserver 0.5.56 → 0.5.57
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 +25 -10
- package/package.json +1 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.5.
|
|
1
|
+
var myVersion = "0.5.57", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -64,6 +64,29 @@ var stats = {
|
|
|
64
64
|
};
|
|
65
65
|
const fnameStats = "stats.json";
|
|
66
66
|
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function userIsWhitelisted (screenname, callback) { //9/16/22 by DW
|
|
70
|
+
fs.readFile (fnameConfig, function (err, jsontext) {
|
|
71
|
+
var flWhitelisted = false;
|
|
72
|
+
if (!err) {
|
|
73
|
+
var jstruct;
|
|
74
|
+
try {
|
|
75
|
+
jstruct = JSON.parse (jsontext);
|
|
76
|
+
if (jstruct.whitelist === undefined) { //no whitelist
|
|
77
|
+
flWhitelisted = true;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
flWhitelisted = jstruct.whitelist.includes (screenname);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
console.log ("userIsWhitelisted: screenname == " + screenname + ", flWhitelisted == " + flWhitelisted);
|
|
87
|
+
callback (undefined, {flWhitelisted});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
67
90
|
function statsChanged () {
|
|
68
91
|
flStatsChanged = true;
|
|
69
92
|
}
|
|
@@ -1244,15 +1267,7 @@ function startup (options, callback) {
|
|
|
1244
1267
|
return (true);
|
|
1245
1268
|
case "/useriswhitelisted": //7/21/22 by DW
|
|
1246
1269
|
callWithScreenname (function (screenname) {
|
|
1247
|
-
|
|
1248
|
-
if (config.whitelist === undefined) {
|
|
1249
|
-
flWhitelisted = true;
|
|
1250
|
-
}
|
|
1251
|
-
else {
|
|
1252
|
-
flWhitelisted = config.whitelist.includes (screenname);
|
|
1253
|
-
}
|
|
1254
|
-
console.log ("/useriswhitelisted: screenname == " + screenname + ", flWhitelisted == " + flWhitelisted);
|
|
1255
|
-
returnData ({flWhitelisted});
|
|
1270
|
+
userIsWhitelisted (screenname, httpReturn); //9/16/22 by DW
|
|
1256
1271
|
});
|
|
1257
1272
|
return (true);
|
|
1258
1273
|
|