Commit graph

13 commits

Author SHA1 Message Date
bb31335319 fup: add basic view and paste UIs 2021-03-22 00:25:32 +00:00
b7cd0d0e29 fup: add cheddar as a syntax highlighter 2021-03-21 18:52:22 +00:00
2306915e2c fup: implement file uploads!
TODO: tests for this.
2021-03-21 18:04:37 +00:00
7eac2c0c07 fup/fuphttp: add badRequest handler
We might get bad requests for e.g. file uploads, so we should have an error
handler for that.

This also disables mime type sniffing for the other text/plain error handler.
2021-03-21 17:08:29 +00:00
5d9b444a56 fup/fuphttp: add filename generator to options and application 2021-03-21 17:07:47 +00:00
ad67e1025a fup/fuphttp: split download logic into a separate file.
It's neatly partitionable away from the rest of the logic, so it's easier to
put it in a separate file.
2021-03-21 15:23:43 +00:00
4c4bd46aa8 fup: factor out metadata retrieval into a separate file
We'll need this for cleanup operations as well. This should likely be factored
out again into an entirely separate package that deals with storage access.
2021-03-21 15:17:46 +00:00
7bac0aee74 fup: implement deleting expired files on request
This is a very basic implementation of gating that we only return files which
haven't expired.  If the file has expired, then we just delete it.
2021-03-21 14:56:42 +00:00
0e69199569 fup: shore up serving and add tests for supported methods
We support several methods of serving assets:

* Redirect to blobstore
    - This requires the backend to support signed URLs.
      We rely on the backend to support HTTP semantics, like supporting
      Range headers.
* Serve-using-http.ServeContent
    - This requires the backend to actually be providing a io.ReadSeeker.
      net/http provides Range/If- conditional support.
* Serve-proxy
    - This is the safest and most compatible method.
      We don't support conditionals nor Range headers. This mode is unlikely
      to be suitable for multimedia, like MP3s or video.
2021-03-21 14:35:04 +00:00
08098fb666 fup: add file serving
This adds both redirect-to-signed-URL and proxy fileserving.

The proxy fileserving is somewhat limited: we don't support the Range header,
and it isn't easy to reuse the net/http ServeContent implementation because
that requires a SeekCloser. I think it might be possible to "bodge" a
SeekCloser on top of dynamically opening files, but it'll be a bit wonky and
will be slower than strictly necessary.
2021-03-21 03:04:38 +00:00
e21db7a061 fup: add a template function for getting paths to static assets
We add the hash of the file to the static assets, so they can be cached
indefinitely.  This also, however, means that we need some way of referring to
them.
2021-03-21 03:03:15 +00:00
a261baedf4 fup: add SPDX headers 2021-03-20 20:40:40 +00:00
bcd39fae10 fup: create serve subcommand and fuphttp package
This is the skeleton of the application. Let's goooo!
2021-03-20 19:53:43 +00:00