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

[ gpl, library, program, web ] [ Propose Tags ] [ Report a vulnerability ]

Please see the README on GitHub at https://github.com/pe200012/hs-hath#readme


[Skip to Readme]

Modules

  • CLI
  • FileVerification
  • HathNetwork
    • HathNetwork.Genesis
    • HathNetwork.RPC
  • Interface
    • Interface.API
  • LegacyCiphers
  • Metrics
    • Metrics.Counter
    • Metrics.Gauge
    • Metrics.Prometheus
    • Metrics.Registry
    • Metrics.Snapshot
    • Metrics.Types
  • Middleware
  • Server
  • SettingM
  • Stats
  • Storage
    • Storage.Database
    • Storage.Filesystem
    • Storage.Locate
    • Storage.R2
  • Types
  • Utils
  • Version

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.1.1
Change log CHANGELOG.md
Dependencies aeson (>=2.1 && <2.3), async (>=2.2 && <2.3), base (>=4.7 && <4.22), base64 (>=1.0 && <1.1), base64-bytestring (>=1 && <2), binary (<1), bytestring (>=0.11 && <0.13), case-insensitive (>=1 && <2), co-log (>=0.6 && <0.8), co-log-core (>=0.3 && <0.4), 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-store (>=1.6 && <1.7), cryptostore (>=0.3 && <0.4), data-default-class (<1), dhall (>=1.42 && <1.43), digest (<1), directory (>=1.3 && <1.4), exceptions (>=0.10 && <0.11), extra (>=1.7 && <1.9), filepath (>=1.4 && <1.6), ghc-prim (<10), hex-text (>=0.1 && <0.2), hs-hath, http-client (>=0.7 && <0.8), http-client-tls (>=0.3 && <0.4), http-conduit (>=2.3 && <2.4), http-media (>=0.8 && <0.9), http-types (>=0.12 && <0.13), ini (<1), lrucache (>=1.2 && <1.3), mason (>=0.2.6 && <0.3), memory (>=0.18 && <0.19), monad-control (>=1.0 && <1.1), monad-loops (>=0.4 && <0.5), mtl (>=2.3 && <2.4), network (>=3.1 && <3.3), network-uri (>=2 && <3), optparse-applicative (>=0.18 && <0.19), polysemy (>=1.9 && <1.10), polysemy-zoo (>=0.8 && <0.9), process (>=1.6 && <1.7), recv (<1), relude (>=1.2 && <1.3), resourcet (>=1.3 && <1.4), retry (<1), safe-exceptions (>=0.1 && <0.2), servant (>=0.20.2 && <0.21), servant-client (>=0.20.2 && <0.21), servant-client-core (>=0.20.2 && <0.21), servant-server (>=0.20.2 && <0.21), sqlite-simple (>=0.4 && <0.5), stm (>=2.5 && <2.6), streaming-commons (<1), string-interpolate (>=0.3 && <0.4), suspend (>=0.2 && <0.3), template-haskell (>=2.19 && <2.24), text (>=2.0 && <2.2), time (>=1.12 && <1.15), time-units (>=1 && <2), timers (>=0.2 && <0.3), tls (>=2.0 && <2.4), tls-session-manager (>=0.0.5 && <0.1), transformers (>=0.6 && <0.7), unix (>=2.8 && <2.9), unliftio (>=0.2 && <0.3), unliftio-core (<1), unordered-containers (>=0.2 && <0.3), 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.6.6
License GPL-3.0-only
Copyright 2024 pe200012
Author pe200012
Maintainer 1326263755@qq.com
Uploaded by pe200012 at 2026-01-26T11:25:21Z
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
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2026-01-26 [all 2 reports]

Readme for hs-hath-1.1.1

[back to package description]

hs-hath - A Haskell Implementation of the Hentai@Home Client

License: GPL v3

A high-performance Haskell implementation of the Hentai@Home client. The client caches and serves gallery files, communicates with the H@H server via TLS-secured RPC, and supports S3-compatible storage backends including Cloudflare R2.

Features

Resource caching uses an LRU cache with SQLite-backed or R2-backed storage. RPC communication to the H@H server uses TLS with automatic certificate refresh every 24 hours. Rate limiting includes both IP-based throttling and keystamp-based fallback for NAT environments. Gallery downloads support parallel file fetching. Prometheus metrics are available at the /metrics endpoint. The client tracks build information via the --version flag.

Installation

Prerequisites

  • Stack (Haskell toolchain)
  • SQLite 3
  • OpenSSL libraries

Building

git clone https://github.com/pe200012/hs-hath.git
cd hs-hath
stack build

Configuration

Create a client-login file with your credentials:

{ clientId = "your-client-id"
, key = "your-api-key" 
, version = "1.0.0"
, proxy = None ClientProxy
, downloadDir = "./downloads"
, cachePath = "./cache.db"
}

Usage

Start the client:

stack exec hs-hath

View version information:

stack exec hs-hath -- --version

The client responds to SIGINT and SIGTERM for graceful shutdown. Settings reload automatically via RPC command. The Prometheus metrics endpoint is available at /metrics for monitoring.

Architecture

The RPC client handles communication with the H@H server, including certificate management and settings synchronization. The resource cache stores files using SQLite with LRU eviction. An HTTP server built on Warp serves cached resources. Rate limiting middleware provides both IP-based and keystamp-based request throttling. The storage backend supports local filesystem and S3-compatible services like Cloudflare R2.

Metrics

The client exports Prometheus metrics in text format at the /metrics endpoint. Metrics include request counters, cache statistics, and operational counters for monitoring and alerting.

Performance

Has not been optimized yet. Currently, it will take ~200MiB RAM on average.

Troubleshooting

Certificate errors

Verify system clock synchronization and certificate file permissions. Certificate refresh occurs automatically every 24 hours.

Connection issues

Check proxy settings if configured. Ensure firewall allows outbound TLS connections on the required ports.

Storage backend errors

For S3-compatible backends like Cloudflare R2, verify that the storage server returns required headers: ETag, Content-Length, and Last-Modified. Missing ETag headers cause write failures.

Rate limiting

The client implements strict request throttling. Banned IPs and rate limit violations appear in console logs. Verify client configuration if legitimate requests are being rejected.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.