daveappserver 0.7.7 → 0.7.8
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 +31 -2
- package/package.json +1 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.7.
|
|
1
|
+
var myVersion = "0.7.8", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -1276,6 +1276,35 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
1276
1276
|
}
|
|
1277
1277
|
});
|
|
1278
1278
|
}
|
|
1279
|
+
//wordpress -- 10/31/23 by DW
|
|
1280
|
+
function wordpressHandleRequest (theRequest) {
|
|
1281
|
+
function encode (s) {
|
|
1282
|
+
return (encodeURIComponent (s));
|
|
1283
|
+
}
|
|
1284
|
+
function returnRedirect (url, code=302) {
|
|
1285
|
+
var headers = {
|
|
1286
|
+
location: url
|
|
1287
|
+
};
|
|
1288
|
+
theRequest.httpReturn (code, "text/plain", code + " REDIRECT", headers);
|
|
1289
|
+
}
|
|
1290
|
+
function useWordpressAccount (accessToken, theUserInfo) {
|
|
1291
|
+
console.log ("useWordpressAccount: accessToken == " + accessToken);
|
|
1292
|
+
console.log ("useWordpressAccount: theUserInfo == " + utils.jsonStringify (theUserInfo));
|
|
1293
|
+
config.loginWordpressUser (accessToken, theUserInfo, function (err, userRec) {
|
|
1294
|
+
if (err) {
|
|
1295
|
+
returnRedirect (config.urlServerForClient + "?failedLogin=true&message=" + encode (err.message));
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
returnRedirect (config.urlServerForClient + "?emailconfirmed=true&email=" + encode (userRec.emailAddress) + "&code=" + encode (userRec.emailSecret) + "&screenname=" + encode (userRec.screenname));
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
const options = {
|
|
1303
|
+
useWordpressAccount
|
|
1304
|
+
};
|
|
1305
|
+
const flHandled = wordpress.handleHttpRequest (theRequest, options);
|
|
1306
|
+
return (flHandled);
|
|
1307
|
+
}
|
|
1279
1308
|
|
|
1280
1309
|
function startup (options, callback) {
|
|
1281
1310
|
function readConfig (f, theConfig, flReportError, callback) {
|
|
@@ -1557,7 +1586,7 @@ function startup (options, callback) {
|
|
|
1557
1586
|
}
|
|
1558
1587
|
}
|
|
1559
1588
|
|
|
1560
|
-
if (
|
|
1589
|
+
if (wordpressHandleRequest (theRequest)) { //9/10/23 by DW
|
|
1561
1590
|
return (true);
|
|
1562
1591
|
}
|
|
1563
1592
|
|