Hello @ncw! Thank you for merging PR 2844, adding vfsgen for static items!
Here is a question: how should we deal with static assets?
For example, we may have a file called “styles.css”, and normally, that might be served via
/static/styles.css. However, this would make it impossible for a user to browse a folder named
Here are some options:
Choose a sentinel value for static assets. For example, “/rclone-static-112358” or “/random-number-11235”. Downsides: now we have a hardcoded value which a user is never able to browse.
Inline everything. That is, rather than our code saying
<link href="/rclone-static/styles.css">, simply inline it. The two disadvantages is that this does not work for images (for example, an icon depicting a folder), and this would increase the HTML payload size upon every request. (Technically, one could inline .svg files.)
Choose not to use any HTML features which rely on static assets, such as images. This could be very limiting.
Host assets externally (eg,
<link href="http://example.com/styles.css">). I think this is the worst idea, since how rclone’s http feature would have an external dependency, which has both stability and security implications.
Run another local HTTP server, on a different port, whose sole job would be to serve static assets. Eg,
<link href="http://localhost:9090/styles.css">. This would give the most flexibility, though probably has the most complexity.
If it were me, I would probably choose option 1, or possibly option 2, or option 5. But maybe you have an idea for a solution I haven’t thought of, or a tradeoff that you’d find acceptable.