daveappserver 0.5.46 → 0.5.49

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 CHANGED
@@ -1,4 +1,4 @@
1
- var myVersion = "0.5.46", myProductName = "daveAppServer";
1
+ var myVersion = "0.5.49", myProductName = "daveAppServer";
2
2
 
3
3
  exports.start = startup;
4
4
  exports.notifySocketSubscribers = notifySocketSubscribers;
@@ -6,6 +6,8 @@ exports.saveStats = saveStats;
6
6
  exports.getStats = getStats; //6/28/21 by DW
7
7
  exports.getConfig = getConfig;
8
8
  exports.publishFile = publishFile; //12/13/21 by DW
9
+ exports.readWholeFile = readWholeFile; //5/28/22 by DW
10
+ exports.writeWholeFile = writeWholeFile; //5/28/22 by DW
9
11
 
10
12
  const fs = require ("fs");
11
13
  var dns = require ("dns");
@@ -623,7 +625,8 @@ function cleanFileStats (stats) { //4/19/21 by DW
623
625
  }
624
626
  else {
625
627
  if (config.publishFile !== undefined) { //3/18/22 by DW
626
- var url = (flprivate) ? undefined : config.urlServerForClient + screenname + "/" + relpath;
628
+ const url = (flprivate) ? undefined : config.urlServerForClient + screenname + "/" + relpath;
629
+ const type = utils.httpExt2MIME (utils.stringLastField (f, ".")); //7/3/22 by DW
627
630
  config.publishFile (f, screenname, relpath, type, flprivate, filetext, url);
628
631
  }
629
632
  callback (undefined);
@@ -1005,7 +1008,7 @@ function startup (options, callback) {
1005
1008
  }
1006
1009
  });
1007
1010
  }
1008
- function returnServerHomePage (screenname) {
1011
+ function returnServerHomePage () {
1009
1012
  function servePage (templatetext) {
1010
1013
  var pagetable = {
1011
1014
  productName: config.productName,
@@ -1016,8 +1019,7 @@ function startup (options, callback) {
1016
1019
  flEnableLogin: config.flEnableLogin,
1017
1020
  prefsPath: config.prefsPath,
1018
1021
  docsPath: config.docsPath,
1019
- idGitHubClient: config.githubClientId, //11/9/21 by DW
1020
- screenname //4/30/22 by DW
1022
+ idGitHubClient: config.githubClientId //11/9/21 by DW
1021
1023
  };
1022
1024
  if (theRequest.addToPagetable !== undefined) { //3/9/21 by DW
1023
1025
  for (var x in theRequest.addToPagetable) {
@@ -1048,15 +1050,10 @@ function startup (options, callback) {
1048
1050
  });
1049
1051
  }
1050
1052
  }
1051
- function callWithScreenname (callback, flMustHaveToken=true) {
1053
+ function callWithScreenname (callback) {
1052
1054
  davetwitter.getScreenName (token, secret, function (screenname) {
1053
1055
  if (screenname === undefined) {
1054
- if (flMustHaveToken) {
1055
- returnError ({message: "Can't do the thing you want because the accessToken is not valid."});
1056
- }
1057
- else {
1058
- callback (undefined);
1059
- }
1056
+ returnError ({message: "Can't do the thing you want because the accessToken is not valid."});
1060
1057
  }
1061
1058
  else {
1062
1059
  callback (screenname);
@@ -1102,9 +1099,7 @@ function startup (options, callback) {
1102
1099
  case "get":
1103
1100
  switch (theRequest.lowerpath) {
1104
1101
  case "/":
1105
- callWithScreenname (function (screenname) {
1106
- returnServerHomePage (screenname);
1107
- }, false);
1102
+ returnServerHomePage ();
1108
1103
  return (true);
1109
1104
  case "/now":
1110
1105
  returnPlainText (new Date ());
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.46",
4
+ "version": "0.5.49",
5
5
  "main": "appserver.js",
6
6
  "repository": {
7
7
  "type" : "git",
package/readme.md CHANGED
@@ -52,9 +52,9 @@ The second section configures the HTTP server and the connection to Twitter for
52
52
 
53
53
  ### Updates
54
54
 
55
- #### v0.5.45 -- 4/30/22 by DW
55
+ #### v0.5.48 -- 3/18/22 by DW
56
56
 
57
- pagetable now contains the user's screenname. It's important that the addMacroToPagetable callback have access to the screenname, we need it to construct the url for the user's RSS feed in littleFeedReader.
57
+ Exports three routines: fileExists, readWholeFile, writeWholeFile.
58
58
 
59
59
  #### v0.5.44 -- 3/18/22 by DW
60
60
 
package/readme.opml CHANGED
@@ -2,7 +2,7 @@
2
2
  <opml version="2.0">
3
3
  <head>
4
4
  <title>readme.md</title>
5
- <dateModified>Sat, 30 Apr 2022 14:19:31 GMT</dateModified>
5
+ <dateModified>Sat, 28 May 2022 18:55:48 GMT</dateModified>
6
6
  <expansionState></expansionState>
7
7
  <vertScrollState>1</vertScrollState>
8
8
  <windowTop>300</windowTop>
@@ -45,8 +45,8 @@
45
45
  </outline>
46
46
  </outline>
47
47
  <outline created="Wed, 15 Sep 2021 14:19:02 GMT" text="### Updates">
48
- <outline created="Sat, 30 Apr 2022 14:17:59 GMT" text="#### v0.5.45 -- 4/30/22 by DW">
49
- <outline created="Sat, 30 Apr 2022 14:16:10 GMT" text="pagetable now contains the user's screenname. It's important that the addMacroToPagetable callback have access to the screenname, we need it to construct the url for the user's RSS feed in littleFeedReader. "></outline>
48
+ <outline created="Sat, 28 May 2022 18:54:36 GMT" text="#### v0.5.48 -- 3/18/22 by DW">
49
+ <outline created="Sat, 28 May 2022 18:54:39 GMT" text="Exports three routines: fileExists, readWholeFile, writeWholeFile."></outline>
50
50
  </outline>
51
51
  <outline created="Fri, 18 Mar 2022 14:21:28 GMT" text="#### v0.5.44 -- 3/18/22 by DW">
52
52
  <outline created="Fri, 18 Mar 2022 14:21:59 GMT" text="New callback, config.publishFile. If defined we call back with the file, screenname, relpath, flprivate, filetext and the url of the file if it's public."></outline>