Arlen22 / TiddlyServer

v2 - A static file server that can also save files and mount TiddlyWiki folders
https://arlen22.github.io/tiddlyserver/
MIT License
258 stars 36 forks source link

Having trouble getting started #32

Open cbearden opened 6 years ago

cbearden commented 6 years ago

I am entirely new to TiddlyServer. I'm running Ubuntu 16.04.3 and using Firefox and Chrome. Since I don't know my way around, I'm following your README and the instructions at https://www.didaxy.com/introduction-to-tiddlyserver closely to hold as many things constant as I can.

I have downloaded and installed node.js 8.9.4 by adding the Nodesource repo to my repo list, and I have downloaded and unzipped the source code for the 2.0.11 release:

  https://github.com/Arlen22/TiddlyServer/archive/2.0.11.tar.gz

I created a simple settings.json file:

{
  "tree" : {
    "WorkNotes" : "/home/dubitron/Desktop/Tiddlers/WorkNotes/"
  },
  "types" : {
    "htmlfile" : ["html", "htm"]
  },
  "username" : "",
  "password" : "",
  "host" : "127.0.0.1",
  "port" : "8181",
  "backupDirectory" : "backup"
}

The WorkNotes directory contains a 5.1.7 TiddlyWiki WorkNotes.html I have used for quite a while with TiddlyFox.

From within the TiddlyServer source dir I run the node server (in a screen session for convenience):

screen -S tserv node server.js

which results in the following output in the screen session:

Settings file: /home/cfbearden/opt/TiddlyServer-2.0.11/settings.json
Open your browser and type in one of the following:
127.0.0.1:8181

I can navigate to and view the TiddlyWiki through the node server, but I can't save changes to it. When I click on the Save iconi, I'm prompted with the download Save dialog, which is the same behavior as when I edit the TiddlyWiki via a file:/// path.

Thanks for any help. The idea is promising, but clearly I'm missing something.

Arlen22 commented 6 years ago

First, either set the backupDirectory to an empty string (""), or create the backup folder next to settings.json. That is probably part of the problem. Also, if you could paste the console output in here after you try to save, that would help in further diagnosis.

Enjoy!

On Sat, Jan 6, 2018 at 2:35 AM, Charles Bearden notifications@github.com wrote:

I am entirely new to TiddlyServer. I'm running Ubuntu 16.04.3 and using Firefox and Chrome. Since I don't know my way around, I'm following your README and the instructions at https://www.didaxy.com/ introduction-to-tiddlyserver closely to hold as many things constant as I can.

I have downloaded and installed node.js 8.9.4 by adding the Nodesource repo to my repo list, and I have downloaded and unzipped the source code for the 2.0.11 release:

https://github.com/Arlen22/TiddlyServer/archive/2.0.11.tar.gz

I created a simple settings.json file:

{ "tree" : { "WorkNotes" : "/home/dubitron/Desktop/Tiddlers/WorkNotes/" }, "types" : { "htmlfile" : ["html", "htm"] }, "username" : "", "password" : "", "host" : "127.0.0.1", "port" : "8181", "backupDirectory" : "backup" }

The WorkNotes directory contains a 5.1.7 TiddlyWiki WorkNotes.html I have used for quite a while with TiddlyFox.

From within the TiddlyServer source dir I run the node server (in a screen session for convenience):

screen -S tserv node server.js

which results in the following output in the screen session:

Settings file: /home/cfbearden/opt/TiddlyServer-2.0.11/settings.json Open your browser and type in one of the following:127.0.0.1:8181

I can navigate to and view the TiddlyWiki through the node server, but I can't save changes to it. When I click on the Save iconi, I'm prompted with the download Save dialog, which is the same behavior as when I edit the TiddlyWiki via a file:/// path.

  • What am I doing wrong?
  • Do I need any of the other files in the release ( editions-server.zip, editions.zip)?
  • Am I supposed to initialize the data directory somehow?
  • Do I need to install some further plugins in my TiddlyWiki?
  • Does the TiddlyWiki version need to be higher?

Thanks for any help. The idea is promising, but clearly I'm missing something.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Arlen22/TiddlyServer/issues/32, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa2QK-yt1BJJQlz_I-Ju_swbw6m43Xcks5tHmtWgaJpZM4RUyrl .

cbearden commented 6 years ago

Thanks for your reply.

I changed backupDirectory to have an empty string as its value, but the behavior doesn't change: I am still prompted to download the TiddlyWiki when I try to save it.

One interesting thing I notice is that I don't get console output for the request for the TiddlyWiki itself. With the above configuration (after fixing backupDirectory), I get a 200 when I retrieve the web root localhost:8181:

Open your browser and type in one of the following:
127.0.0.1:8181
[2018-01-08T15:25:21.763-0600] GET     127.0.0.1       200 127.0.0.1 /                                                           18.729 ms - -

Then, when I click on the the link to the directory, I get a 302 and then a 200 (from the one click):

[2018-01-08T15:27:13.782-0600] GET     127.0.0.1       302 127.0.0.1 /WorkNotes                                                  1.027 ms - -
[2018-01-08T15:27:13.790-0600] GET     127.0.0.1       200 127.0.0.1 /WorkNotes/                                                 2.800 ms - -

Now the link to the TiddlyWiki shows up, but when I click on that link, no request is logged to the console, and when I modify and try to save the TiddlyWiki, I am prompted to save the file somewhere or open it with some application (the usual Firefox dialog). It's as if the TiddlyWiki is being treated as a static file loaded into the browser via a file:/// URL rather than as a page served up by Node.js.

Thanks, Chuck

cbearden commented 6 years ago

I tried editing a fresh, empty v5.1.15 TiddlyWiki with TiddlyServer, and it worked, mostly. After upgrading the TiddlyWiki I was trying to edit, it works also.

The one problem: on about every 10th or so save, I get an error. First, a small modal window appears with this text:

Error while saving: XMLHttpRequest error code: 412

After I dismiss it by clicking the OK button, a larger window appears:

tiddlyservererror

The following lines appear in the console output:

412 ifmatch "2359385-3366912-1515530493000"
412 etag "2359385-3366912-1515530493330"
412 caused by difference in modified
[2018-01-09T14:44:36.149-0600] PUT     127.0.0.1       412 127.0.0.1 /WorkNotes/upgrade.html                                     0.721 ms - -

I lose those changes to the TiddlyWiki, but I can reload and it will work for another 5 or 10 saves.

At least it mostly works now, thanks.

Arlen22 commented 6 years ago

Ok, glad you got it working. I believe the earlier versions of TiddlyWiki does not have the correct mechanism to use for saving. At some point in the future, I may add a shim to support old versions of TiddlyWiki5.

The second problem can usually be fixed by adding "etagWindow": 3 to settings.json. The details of how this works is too complicated for me to explain, but it should take care of the 412 error. If it doesn't, you can increase it to 10 or 20, but that is the most I would recommend. If you have to increase it to more than that, I would be happy to help diagnose that as well.

Hope that helps.

On Wed, Jan 10, 2018 at 4:52 AM, Charles Bearden notifications@github.com wrote:

I tried editing a fresh, empty v5.1.15 TiddlyWiki with TiddlyServer, and it worked, mostly. After upgrading the TiddlyWiki I was trying to edit, it works also.

The one problem: on about every 10th or so save, I get an error. First, a small modal window appears with this text:

Error while saving: XMLHttpRequest error code: 412

After I dismiss it by clicking the OK button, a larger window appears:

[image: tiddlyservererror] https://user-images.githubusercontent.com/427030/34742612-5e3438c8-f54c-11e7-8aa8-9c8dda439ec0.png

The following lines appear in the console output:

412 ifmatch "2359385-3366912-1515530493000" 412 etag "2359385-3366912-1515530493330" 412 caused by difference in modified [2018-01-09T14:44:36.149-0600] PUT 127.0.0.1 412 127.0.0.1 /WorkNotes/upgrade.html 0.721 ms - -

I lose those changes to the TiddlyWiki, but I can reload and it will work for another 5 or 10 saves.

At least it mostly works now, thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Arlen22/TiddlyServer/issues/32#issuecomment-356410308, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa2QF0xWU0-fgqxnk_0nOj9auEXN6RNks5tI9F0gaJpZM4RUyrl .

cbearden commented 6 years ago

Thank you for the advice about "etagWindow". I added it to my configuration, we'll see how it goes.

cbearden commented 6 years ago

So far, so good with the "etagWindow" value. Thanks!