daveappserver 0.5.38 → 0.5.39

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.38", myProductName = "daveAppServer";
1
+ var myVersion = "0.5.39", myProductName = "daveAppServer";
2
2
 
3
3
  exports.start = startup;
4
4
  exports.notifySocketSubscribers = notifySocketSubscribers;
@@ -440,6 +440,12 @@ function cleanFileStats (stats) { //4/19/21 by DW
440
440
  }
441
441
  });
442
442
  }
443
+
444
+ function getPublicFileUrl (screenname, relpath) { //12/4/21 by DW
445
+ var urlpublic = config.urlServerForClient + screenname + "/" + relpath;
446
+ return (urlpublic);
447
+ }
448
+
443
449
  function makeFilePublic (screenname, relpath, callback) { //2/20/21 by DW
444
450
  console.log ("makeFilePublic: relpath == " + relpath);
445
451
  getFile (screenname, relpath, false, function (err, data) {
@@ -476,7 +482,21 @@ function cleanFileStats (stats) { //4/19/21 by DW
476
482
  }
477
483
  else {
478
484
  folderToJson.getObject (config.publicFilesPath + screenname + "/", function (err, publicSubs) {
479
- if (err) {
485
+ function legitError (err) {
486
+ if (err) {
487
+ if (err.code == "ENOENT") {
488
+ publicSubs = new Object ();
489
+ return (false);
490
+ }
491
+ else {
492
+ return (true);
493
+ }
494
+ }
495
+ else {
496
+ return (false);
497
+ }
498
+ }
499
+ if (legitError (err)) {
480
500
  callback (err);
481
501
  }
482
502
  else {
@@ -1017,6 +1037,11 @@ function startup (options, callback) {
1017
1037
  returnError (err);
1018
1038
  }
1019
1039
  else { //quirk in API, it wants a string, not a JSON struct
1040
+ if (!flprivate) {
1041
+ if (config.publicFileSaved !== undefined) {
1042
+ config.publicFileSaved (token, secret, getPublicFileUrl (screenname, params.relpath));
1043
+ }
1044
+ }
1020
1045
  returnPlainText (utils.jsonStringify (data));
1021
1046
  }
1022
1047
  });
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.38",
4
+ "version": "0.5.39",
5
5
  "main": "appserver.js",
6
6
  "repository": {
7
7
  "type" : "git",
package/readme.md CHANGED
@@ -52,6 +52,12 @@ The second section configures the HTTP server and the connection to Twitter for
52
52
 
53
53
  ### Updates
54
54
 
55
+ #### v0.5.32 -- 12/4/21 by DW
56
+
57
+ Added a new callback, publicFileSaved, which is called when the user updates a public file.
58
+
59
+ Fixed a bug where a user couldn't create a new file if their public files folder was empty.
60
+
55
61
  #### v0.5.32 -- 9/26/21 by DW
56
62
 
57
63
  Fixed the example app to require "../appserver.js" instead of "lib/daveappserver.js" which only exists on my development machine.
package/readme.opml CHANGED
@@ -45,6 +45,10 @@
45
45
  </outline>
46
46
  </outline>
47
47
  <outline created="Wed, 15 Sep 2021 14:19:02 GMT" text="### Updates">
48
+ <outline created="Sat, 04 Dec 2021 21:29:57 GMT" text="#### v0.5.32 -- 12/4/21 by DW">
49
+ <outline created="Sat, 04 Dec 2021 21:30:33 GMT" text="Added a new callback, publicFileSaved, which is called when the user updates a public file. "></outline>
50
+ <outline created="Sat, 04 Dec 2021 21:29:58 GMT" text="Fixed a bug where a user couldn't create a new file if their public files folder was empty. "></outline>
51
+ </outline>
48
52
  <outline created="Wed, 15 Sep 2021 14:19:10 GMT" text="#### v0.5.32 -- 9/26/21 by DW">
49
53
  <outline created="Wed, 15 Sep 2021 14:19:12 GMT" text="Fixed the example app to require &quot;../appserver.js&quot; instead of &quot;lib/daveappserver.js&quot; which only exists on my development machine. "></outline>
50
54
  </outline>