hi!
i just wanted to tell you about how i have set up
owncloud+remotestorage to edit my website. When you store files on
owncloud via remotestorage, their Content-Type gets prepended,
followed by an ascii line feed. So when you look at the files on disk
you will see something like:
root@michielbdejong:/var/www/data/admin/unhosted_apps# head
websites/
https_michielbdejong.com/index.html
text/html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
[...]
or:
root@michielbdejong:/var/www/data/admin/unhosted_apps# head
public/pictures/michiel.jpg
image/jpeg
????JFIFHH??XICC_PROFILEHLinomntrRGB XYZ ? 1acspMSFTIEC sRGB???-HP
cprtP3desc?lwtpt?bkptrXYZgXYZ,bXYZ@
[...]
So i wrote a short nodejs script that opens these files as Buffers,
then locates the first linefeed character with a (buffer[i]==10)
check, and then separates and serves the Content-Type and the document
content as desired.
I created a 'websites' module for now, but only put my index.html on
there; the picture is served from my public/pictures scope.
On a side note, this highlights the use for ETag headers, since now
when you visit
https://michielbdejong.com/ the image will not ever be
cached by your browser.
I would discourage people from serving their website straight from the
public area on their remotestorage, both because it can not be the
root of a domain, which is a bit ugly, and because it opens cross-site
scripting risks; a malicious app could gain access to a seemingly
unimportant part of your remotestorage, then plant a javascript file
there, and execute it in the browser, thus gaining access to your
website's origin and whatever you may have on there. This is of course
especially relevant for origins on which you're hosting owncloud or
other cookie-based admin panels.
My next step will be to write a usable photo upload app using
javascript file upload, and a usable website editor app using
CodeMirror. For now, i'm developing this for personal use, and it's
quite experimental (i didn't even bother publishing the code yet) but
my idea is that in the future this could mature and become a way for
people to edit their own website through unhosted web apps.
Ciao!
Michiel