daveappserver 0.6.11 → 0.6.14
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 +44 -14
- package/package.json +1 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.6.
|
|
1
|
+
var myVersion = "0.6.14", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -335,6 +335,7 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
335
335
|
if (conn.appData !== undefined) { //it's one of ours
|
|
336
336
|
if (conn != theNewConnection) { //it's not the new one
|
|
337
337
|
if (conn.appData.screenname == screenname) {
|
|
338
|
+
console.log ("kissOtherLogonsGoodnight: \"" + conn.appData.screenname + "\" = \"" + screenname + "\""); //2/12/23 by DW
|
|
338
339
|
conn.sendText ("goodnight");
|
|
339
340
|
}
|
|
340
341
|
}
|
|
@@ -344,7 +345,6 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
344
345
|
|
|
345
346
|
conn.on ("text", function (s) {
|
|
346
347
|
var words = s.split (" ");
|
|
347
|
-
console.log ("handleWebSocketConnection: s == " + s); //6/7/21 by DW
|
|
348
348
|
if (words.length > 1) { //new protocol as of 11/29/15 by DW
|
|
349
349
|
conn.appData.whenLastUpdate = now;
|
|
350
350
|
conn.appData.lastVerb = words [0];
|
|
@@ -353,17 +353,31 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
353
353
|
conn.appData.urlToWatch = utils.trimWhitespace (words [1]);
|
|
354
354
|
logToConsole (conn, conn.appData.lastVerb, conn.appData.urlToWatch);
|
|
355
355
|
break;
|
|
356
|
-
|
|
357
356
|
case "user": //9/29/21 by DW
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
357
|
+
if (config.flUseTwitterIdentity) { //2/12/23 by DW
|
|
358
|
+
var token = words [1], secret = words [2];
|
|
359
|
+
conn.appData.twOauthToken = token;
|
|
360
|
+
conn.appData.twOauthTokenSecret = secret;
|
|
361
|
+
conn.appData.urlToWatch = "";
|
|
362
|
+
davetwitter.getScreenName (token, secret, function (screenname) {
|
|
363
|
+
conn.appData.screenname = screenname;
|
|
364
|
+
kissOtherLogonsGoodnight (screenname, conn); //12/14/21 by DW
|
|
365
|
+
logToConsole (conn, conn.appData.lastVerb, conn.appData.screenname);
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
var emailAddress = words [1], emailSecret = words [2];
|
|
370
|
+
config.isUserInDatabase (emailAddress, function (flInDatabase, userRec) {
|
|
371
|
+
if (flInDatabase) {
|
|
372
|
+
conn.appData.emailAddress = userRec.emailAddress;
|
|
373
|
+
conn.appData.screenname = userRec.emailAddress;
|
|
374
|
+
conn.appData.emailSecret = userRec.emailSecret;
|
|
375
|
+
conn.appData.urlToWatch = "";
|
|
376
|
+
kissOtherLogonsGoodnight (conn.appData.screenname, conn);
|
|
377
|
+
logToConsole (conn, conn.appData.lastVerb, conn.appData.screenname);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
367
381
|
break;
|
|
368
382
|
|
|
369
383
|
}
|
|
@@ -1089,14 +1103,16 @@ function startup (options, callback) {
|
|
|
1089
1103
|
var flReadConfigJson = true;
|
|
1090
1104
|
if (!err) {
|
|
1091
1105
|
try {
|
|
1106
|
+
scripttext = scripttext.toString ();
|
|
1092
1107
|
var jstruct = requireFromString (scripttext);
|
|
1093
|
-
for (var x in
|
|
1108
|
+
for (var x in jstruct) {
|
|
1094
1109
|
config [x] = jstruct [x];
|
|
1095
1110
|
}
|
|
1096
1111
|
flReadConfigJson = false;
|
|
1097
1112
|
callback ();
|
|
1098
1113
|
}
|
|
1099
1114
|
catch (err) {
|
|
1115
|
+
console.log (err.message);
|
|
1100
1116
|
}
|
|
1101
1117
|
}
|
|
1102
1118
|
if (flReadConfigJson) {
|
|
@@ -1303,7 +1319,21 @@ function startup (options, callback) {
|
|
|
1303
1319
|
}
|
|
1304
1320
|
else {
|
|
1305
1321
|
if ((params.emailaddress !== undefined) && (params.emailcode !== undefined)) {
|
|
1306
|
-
|
|
1322
|
+
config.isUserInDatabase (params.emailaddress, function (flInDatabase, userRec) {
|
|
1323
|
+
if (flInDatabase) {
|
|
1324
|
+
if (params.emailcode == userRec.emailSecret) {
|
|
1325
|
+
callback (params.emailaddress);
|
|
1326
|
+
}
|
|
1327
|
+
else {
|
|
1328
|
+
const message = "Can't do what you wanted the correct email authentication wasn't provided.";
|
|
1329
|
+
returnError ({message});
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
else {
|
|
1333
|
+
const message = "Can't do what you wanted because the email address isn't in the database.";
|
|
1334
|
+
returnError ({message});
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1307
1337
|
}
|
|
1308
1338
|
else {
|
|
1309
1339
|
const message = "Can't do what you wanted because the call is missing email authentication.";
|