ondras / my-mind

Online Mindmapping Software
https://my-mind.github.io
MIT License
3.31k stars 652 forks source link

Webdav storage backend #53

Closed flowli closed 10 years ago

flowli commented 10 years ago

Hi there,

thank you very for this well-done mindmapping tool! During a test installation I've set up apache with webdav support (works as a OS X webdrive with read/write) but my-mind keeps giving me 404 errors. Any pointer on what I'm doing wrong?

Thanks a lot for any advice! Florian

ondras commented 10 years ago

Hi @flowli ,

are you able to check your browser's debugging tools to see the actual network requests being made? I wonder what URLs are being used (both saving and loading mind maps).

Also, is your backend hosted on the same domain as your My Mind installation?

flowli commented 10 years ago

Hi @ondras,

both WebDAV and my mind run on the same Apache Virtual Host (=domain when called in the browser).

I loaded the mindmap successfully by opening http:///mindmap/?url=%2Fmindmap%2Fdata%2Ftest.mymind - the root node is named "A test".

Then I renamed the root node's label to "test".

Some conclusions/questions:

  1. Newly creating a file via WebDAV seems to fail
  2. Updating an existing file works
  3. The filename for saving is determined using the root node's label? Shouldn't it be the file given in the URL parameter?
ondras commented 10 years ago

Hi @flowli,

thanks for your well-documented experiments and observations! There are two things I find puzzling in your report:

A. You are using three forward slashes in your URLs, is that really correct? Your examples seem to be somehow mixing the domain/server name ("mindmap") with the save path ("/mindmap/data").

B. The third example (the one what works) decribes the renamed root node to "test", but the HTTP request is done to the "A%20test.mymind" url. Did this really happen?

To answer your conclusions:

1) this might be called by the mixed "mindmap" and "/mindmap" stuff. Will try to reproduce myself.

2) good to hear this :)

3) yes, the filename is determined using the root node. The general idea is that you shall set the URL endpoint once and then use it repeatedly to create/edit many mind maps.

Are you using http://httpd.apache.org/docs/2.2/mod/mod_dav.html ? I will try to reproduce that myself.

flowli commented 10 years ago

Hi @ondras,

thanks for your quick reply!

A) I entered the term server as the hostname in html brackets (as a variable), but this got removed by github (corrected above for first time readers) B) my mistake, it really is http://server/mindmap/data/test.mymind (corrected above) 3) I would have expected that if I provide a full filename in the URL that it will write to this filename. But if i.e. a base directory is given the behaviour you describe is very much desired.

Yes, I'm using Apache with the DAV module - but in a later version 2.4.6 which comes with Ubuntu 13.10. Most likely I will soon upgrade to 14.04 (trusty).

ondras commented 10 years ago

Hi,

please update to the latest code, I might have fixed the problem (works now with my mod_dav). Please let me know about your status.

flowli commented 10 years ago

Hi @ondras, much better! Now saving to a Apache WebDAV directory works! :+1:

Just one follow-up question: is there any way to set the filename other than with the root node content?

ondras commented 10 years ago

No, there is none.

Specifying a filename in the URL field is highly speculative: how would you reasonably decide whether the token after last slash is a file or directory name? Imagine values like "/a.b/c.d" or "/data/p_q" or so.

ondras commented 10 years ago

Please also note that I am open to other suggestions regarding the overall "save to directory/filename" approach; I am aware of the current issue, but this is the best I was able to come up with.

flowli commented 10 years ago

After knowing how it works I will get used to it. An alternative might be to test if it ends on ".mymind" and otherwise consider it a folder (and then keep the current behaviour).

flowli commented 10 years ago

Thank you very much again for integrating WebDAV support - that really was my main issue... And I hope you plan on adding link and image support ;-)

ondras commented 10 years ago

Testing the ".mymind" suffix is an exception I am willing to make. Will do that soon.

ondras commented 10 years ago

What exactly do you mean by link/image support?

flowli commented 10 years ago

A way to add links and images to nodes. Or is that already possible?

ondras commented 10 years ago

Well, links are auto-detected (so you just write http://example.com/ ...). Adding images sounds like a pretty complex task; not sure how to handle that (how to add them, how to display them, how to store them...).

flowli commented 10 years ago

Oh, the links work :-) I would just make them opened in a new window/tab by default to not close the mindmap when clicking.

The images don't really have to be stored in the mindmap - they might be just linked. May be it is possible to replace a simple expression in a node's source with its respective image tag? For example I could type into a node "Look here: image[http://example.org/kitten.jpg] - how cute!" and it is replaced by "Look here: [img src="http://example.org/kitten.jpg" /] - how cute!" (HTML brackets replaced because they are interpreted by GITHub)

ondras commented 10 years ago

Just pushed an update: links are now opened in a new window/tab; it is possible to specify a particular file name (ending with ".mymind") to a WebDAV backend.

flowli commented 10 years ago

Awesome - thank you very much!