daveappserver 0.5.41 → 0.5.44
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 +46 -24
- package/package.json +1 -1
- package/readme.md +6 -0
- package/readme.opml +5 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.5.
|
|
1
|
+
var myVersion = "0.5.44", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -378,6 +378,9 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
378
378
|
}
|
|
379
379
|
else {
|
|
380
380
|
var url = (flprivate) ? undefined : config.urlServerForClient + screenname + "/" + relpath;
|
|
381
|
+
if (config.publishFile !== undefined) { //3/18/22 by DW
|
|
382
|
+
config.publishFile (f, screenname, relpath, type, flprivate, filetext, url);
|
|
383
|
+
}
|
|
381
384
|
if (!flprivate) {
|
|
382
385
|
notifySocketSubscribers ("update", filetext, true, function (conn) { //3/6/2 by DW -- payload is a string
|
|
383
386
|
if (conn.appData.urlToWatch == url) {
|
|
@@ -619,6 +622,10 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
619
622
|
callback (err);
|
|
620
623
|
}
|
|
621
624
|
else {
|
|
625
|
+
if (config.publishFile !== undefined) { //3/18/22 by DW
|
|
626
|
+
var url = (flprivate) ? undefined : config.urlServerForClient + screenname + "/" + relpath;
|
|
627
|
+
config.publishFile (f, screenname, relpath, type, flprivate, filetext, url);
|
|
628
|
+
}
|
|
622
629
|
callback (undefined);
|
|
623
630
|
}
|
|
624
631
|
});
|
|
@@ -999,31 +1006,46 @@ function startup (options, callback) {
|
|
|
999
1006
|
});
|
|
1000
1007
|
}
|
|
1001
1008
|
function returnServerHomePage () {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
pagetable [x] = theRequest.addToPagetable [x];
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
if (config.addMacroToPagetable !== undefined) {
|
|
1021
|
-
config.addMacroToPagetable (pagetable);
|
|
1009
|
+
function servePage (templatetext) {
|
|
1010
|
+
var pagetable = {
|
|
1011
|
+
productName: config.productName,
|
|
1012
|
+
productNameForDisplay: config.productNameForDisplay,
|
|
1013
|
+
version: config.version,
|
|
1014
|
+
urlServerForClient: config.urlServerForClient,
|
|
1015
|
+
urlWebsocketServerForClient: config.urlWebsocketServerForClient,
|
|
1016
|
+
flEnableLogin: config.flEnableLogin,
|
|
1017
|
+
prefsPath: config.prefsPath,
|
|
1018
|
+
docsPath: config.docsPath,
|
|
1019
|
+
idGitHubClient: config.githubClientId //11/9/21 by DW
|
|
1020
|
+
};
|
|
1021
|
+
if (theRequest.addToPagetable !== undefined) { //3/9/21 by DW
|
|
1022
|
+
for (var x in theRequest.addToPagetable) {
|
|
1023
|
+
pagetable [x] = theRequest.addToPagetable [x];
|
|
1022
1024
|
}
|
|
1023
|
-
var pagetext = utils.multipleReplaceAll (templatetext, pagetable, false, "[%", "%]");
|
|
1024
|
-
returnHtml (pagetext);
|
|
1025
1025
|
}
|
|
1026
|
-
|
|
1026
|
+
if (config.addMacroToPagetable !== undefined) {
|
|
1027
|
+
config.addMacroToPagetable (pagetable);
|
|
1028
|
+
}
|
|
1029
|
+
var pagetext = utils.multipleReplaceAll (templatetext.toString (), pagetable, false, "[%", "%]");
|
|
1030
|
+
returnHtml (pagetext);
|
|
1031
|
+
}
|
|
1032
|
+
if (config.pathServerHomePageSource !== undefined) {
|
|
1033
|
+
fs.readFile (config.pathServerHomePageSource, function (err, templatetext) {
|
|
1034
|
+
if (err) {
|
|
1035
|
+
console.log ("returnServerHomePage: err.message == " + err.message + ", f == " + config.pathServerHomePageSource);
|
|
1036
|
+
}
|
|
1037
|
+
else {
|
|
1038
|
+
servePage (templatetext);
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
request (config.urlServerHomePageSource, function (err, response, templatetext) {
|
|
1044
|
+
if (!err && response.statusCode == 200) {
|
|
1045
|
+
servePage (templatetext);
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1027
1049
|
}
|
|
1028
1050
|
function callWithScreenname (callback) {
|
|
1029
1051
|
davetwitter.getScreenName (token, secret, function (screenname) {
|
package/package.json
CHANGED
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.44 -- 3/18/22 by DW
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
It's called when we handle a /publishfile or /writewholefile message.
|
|
60
|
+
|
|
55
61
|
#### v0.5.32 -- 12/4/21 by DW
|
|
56
62
|
|
|
57
63
|
Added a new callback, publicFileSaved, which is called when the user updates a public file.
|
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
|
|
5
|
+
<dateModified>Fri, 18 Mar 2022 14:26:35 GMT</dateModified>
|
|
6
6
|
<expansionState></expansionState>
|
|
7
7
|
<vertScrollState>1</vertScrollState>
|
|
8
8
|
<windowTop>300</windowTop>
|
|
@@ -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="Fri, 18 Mar 2022 14:21:28 GMT" text="#### v0.5.44 -- 3/18/22 by DW">
|
|
49
|
+
<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>
|
|
50
|
+
<outline created="Fri, 18 Mar 2022 14:22:36 GMT" text="It's called when we handle a /publishfile or /writewholefile message."></outline>
|
|
51
|
+
</outline>
|
|
48
52
|
<outline created="Sat, 04 Dec 2021 21:29:57 GMT" text="#### v0.5.32 -- 12/4/21 by DW">
|
|
49
53
|
<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
54
|
<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>
|