Comment by theshrike79
6 months ago
Copyparty[0] is amazing. I've noticed copyparty+webdav is a lot faster for browsing my NAS than smb or nfs from macOS.
I've been meaning to build a gallery application (or simple web page) that can browse pictures from a copyparty instance and sort/organise them with an UI fit for my purpose.
Any pointers how I could make one that self-saves to copyparty?
Sorry for taking so long to respond...I was out on vacation!
The general strategy is to figure out what state needs to be stored in your app, and combine that into one div in the page that can be grabbed via something like innerHTML. For a gallery app that is viewing pictures on copyparty, that will be the metadata, like the URL of the image, the tags you want to apply and/or what category it is in, the index within the album, the date info, etc.
Then, when your page loads, you can load all that and reason about how to arrange your photos, what to display, etc. Once that's done, the URLs can be swapped in to generate the appropriate view. I would give some thought to how to leverage WebDAV to create a directory that can store e.g. thumbnails. Copyparty does that itself, but your app should likely have its own disk-based cache accessible from a folder served by Copyparty.
The self-save part is mostly creating a something like a clone function that knows how to clone the static parts and inject updated sections for the data. I've written a little about about how to do this in my post years ago about a TiddlyWiki saver written for jart's Cosmopolitan.
https://rpdillon.net/redbean-tiddlywiki-saver.html
I've iterated on it quite a bit since then, and haven't updated my site accordingly. It's probably worth documenting the progress I've made since.