hs-hath: A Haskell implementation of the Hentai@Home client

[ gpl, library, program, web ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.4.0
Change log CHANGELOG.md
Dependencies aeson (>=1 && <3), asn1-encoding (>=0.9 && <0.10), asn1-types (>=0.3.1 && <0.4), base (>=4.7 && <4.22), base64 (<2), base64-bytestring (>=1 && <2), basement (>=0.0.16 && <0.1), binary (<1), bytestring (>=0.11 && <0.13), case-insensitive (>=1 && <2), co-log (>=0.6 && <0.8), co-log-polysemy (>=0.0.1.5 && <0.0.2), conduit (>=1.3 && <1.4), conduit-extra (>=1 && <2), containers (>=0.6 && <0.8), crypton (>=1.0 && <1.1), crypton-connection (>=0.4 && <0.5), crypton-x509 (>=1.7 && <1.8), crypton-x509-validation (>=1.6 && <1.7), data-default (>=0.7 && <0.9), data-default-class (<1), dhall (>=1.42 && <1.43), digest (<1), directory (>=1.3 && <1.4), filepath (>=1.4 && <1.6), hourglass (>=0.2 && <0.3), hs-hath, http-client (>=0.7 && <0.8), http-client-tls (>=0.3 && <0.4), http-conduit (>=2 && <3), http-types (>=0.12 && <0.13), ini (<1), lrucache (>=1.2 && <1.3), memory (>=0.18 && <0.19), network (>=3.2.12 && <3.3), network-uri (>=2 && <3), optparse-applicative (>=0.18 && <0.19), pem (>=0.1 && <0.3), polysemy (>=1.9 && <1.10), process (>=1.6 && <1.7), recv (>=0.1.0 && <0.2), relude (>=1.2 && <1.3), resourcet (>=1 && <2), retry (<1), sqlite-simple (>=0.4 && <0.5), stm (>=2.3 && <3), streaming-commons (<1), string-interpolate (>=0.3 && <0.4), template-haskell (>=2.19 && <2.24), text (>=2.0 && <2.2), time (>=1.12 && <1.15), time-units (>=1 && <2), tls (>=2.1.3 && <2.4), tls-session-manager (>=0.0.5 && <0.1), transformers (<1), unix (>=2.8 && <2.9), unliftio (>=0.2 && <0.3), unliftio-core (<1), unordered-containers (<1), wai (>=3.2 && <3.3), wai-extra (>=3.1 && <3.2), warp (>=3.4 && <3.5), xml-conduit (>=1 && <2) [details]
Tested with ghc ==9.12.2
License GPL-3.0-only
Copyright 2024-2026 pe200012
Author pe200012
Maintainer 1326263755@qq.com
Uploaded by pe200012 at 2026-11-29T08:58:38Z
Category Web
Home page https://github.com/pe200012/hs-hath#readme
Bug tracker https://github.com/pe200012/hs-hath/issues
Source repo head: git clone https://github.com/pe200012/hs-hath
Distributions
Executables migrate-to-r2, hs-hath, hath-bench
Downloads 91 total (23 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-11-29 [all 1 reports]

Readme for hs-hath-1.4.0

[back to package description]

hs-hath

A Hentai@Home client written in Haskell, also on Hackage. Supports local disk, SQLite, and S3-compatible (e.g. Cloudflare R2) cache backends, Dhall configuration, and Prometheus metrics at /metrics. Expect ~200 MiB RAM on average.

Install

Prebuilt static binaries for Linux (amd64, arm64) and Windows (x64) are available on GitHub Releases.

Multi-arch Docker images (linux/amd64, linux/arm64) are published to ghcr.io/pe200012/hs-hath. With compose.yaml:

mkdir cache download
cp client-login.example client-login   # set clientId and key
echo HATH_PORT=443 > .env              # port from your H@H settings page
docker compose up -d

To build from source, install Stack and SQLite 3, then run:

stack build

Configuration

Copy client-login.example to client-login and fill it in. hs-hath reads ./client-login unless given -c FILE.

in  ClientConfig::{
    , clientId = "<YOURID>"
    , key = "<YOURKEY>"
    , downloadDir = "./download"
    , cachePath = "./cache"
    , cacheBackend = CacheBackend.CacheBackendFilesystem
    , r2Config = None R2Config
    }

version, proxy and lruCacheSize are deprecated and have no effect. If your file still has them, delete them along with their types and defaults (see client-login.example).

cacheBackend options:

  • CacheBackendFilesystem: stores and serves files from cachePath, evicting least recently served files to stay under the H@H disk limit.
  • CacheBackendSQLite: stores files in an SQLite database at cachePath, with no eviction. Checks every file at startup unless --skip-startup-verify is passed.
  • CacheBackendR2: serves hits via presigned redirects, with no eviction. Requires r2Config = Some { r2Endpoint = "https://<account id>.r2.cloudflarestorage.com", r2Bucket = "<bucket>" }, R2_ACCESS_KEY and R2_SECRET_KEY in the environment, and a store returning ETag, Content-Length, and Last-Modified (missing ETag fails cache writes).

Usage

Start the client with hs-hath (or stack exec hs-hath when built with Stack). Run hs-hath --help for all CLI options.

On Windows, stop the client with Ctrl+C so it notifies the server; closing the console window terminates it immediately.

With docker run, pass -p <port>:<port>, --stop-timeout 45 (graceful shutdown takes up to 30s), and -u <uid>:<gid> matching the host files (default uid is 65532).

Metrics

Set HATH_METRICS_TOKEN (e.g. openssl rand -hex 32) to enable /metrics and /admin/settings with Authorization: Bearer <token>. Both endpoints return 404 when unset.

scrape_configs:
  - job_name: hath
    scheme: https
    authorization:
      credentials: <token>
    static_configs:
      - targets: ["<host>:<port>"]

Proxies and tunnels

Behind a reverse proxy on a loopback or private address, pass --trust-proxy-headers so flood control reads client IPs from X-Forwarded-For. The connection limit does not apply behind a local proxy.

With tunnels that rewrite the source IP (rathole, frp, port forwarding), every connection arrives from a local address, so flood control and connection limits do not apply and /servercmd/ is authenticated by key alone. Rate-limit at the tunnel ingress.

Startup and exit conditions

  • Run it under a supervisor that restarts it: it exits on a failed login and with status 1 on a lost session.
  • Refuses to start with an empty Filesystem or SQLite cache while more than 20 static ranges are assigned, or on Filesystem if the disk cannot hold the cache size set on the H@H settings page.
  • On a failed connection test, it stays running without announcing itself so the port can be tested.

License

GPL-3.0. See LICENSE.