snix/users/Profpatsch/whatcd-resolver/services/reverse-proxy/caddyfile
Profpatsch 498c8e05f8 feat(users/Profpatsch/whatcd-resolver): serve torrent files
We want to be able to play the files directly from the web
browser (jukebox).

Luckily, transmission does not seem to change the filenames from the
ones given by the torrent file, so we can literally parse the torrent
file and construct a path to the media file, extraordinary.

Adjusts the caddy reverse proxy to serve the given transmission
directory (using my weird sshfs forwarding scheme in the shell.nix
preset lol), then redirect from a handler that maps from
torrentId/fileId to the actual file.

Change-Id: Iab5faf7cc06066f3253031af31e137c0e28f54e3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13270
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2025-03-15 19:11:00 +00:00

17 lines
362 B
Text

{
# Global options block
auto_https off
}
:9092 {
# Serve files from the directory specified by WHATCD_RESOLVER_TRANSMISSION_DOWNLOAD_DIRECTORY
handle_path /files/* {
root * {env.WHATCD_RESOLVER_TRANSMISSION_DOWNLOAD_DIRECTORY}
file_server {
browse off
}
}
# Reverse proxy from localhost:9092 to localhost:9093
reverse_proxy * localhost:9093
}