Repository navigation
Releases
Releases · pe200012/hs-hath
v1.4.0
Upgrade notes
- Supervisor: on
FAIL_NOT_LOGGED_INfromstill_alive, the client now exits with status 1 instead of continuing; have the supervisor restart it on failure - Startup: the client now refuses to start with an empty
FilesystemorSQLitecache while more than 20 static ranges are assigned, or onFilesystemif the disk cannot hold the cache size - Image proxy: a proxy set on the H@H settings page now takes effect; clear it there if the proxy is unreachable
- Release archives no longer contain
migrate-to-r2orhath-bench client-login: deleteversion,proxyandlruCacheSize, with their types and defaults, to silence the warning on startup (see Deprecated)- Library API: exports and signatures changed (see Changed)
Changed
- Release archives ship only
hs-hathandLICENSE(buildmigrate-to-r2andhath-benchfrom source); Linux builds are static musl binaries foramd64andarm64without UPX unixdependency is gated to non-Windows targets- Filesystem backend deletes blacklisted entries only if they are regular files
- A failed login waits 5 s before exiting, 15 min on
FAIL_STARTUP_LOOP FAIL_NOT_LOGGED_INfromstill_aliveshuts down with exit status 1- Requests that miss the same file share one upstream download
- Filesystem eviction works through the directory with the oldest file instead of rescanning the whole cache
- Library:
Hath.Cache.FilesystemexportsopenFsCacheandevictinstead ofnewFsCacheandsweep;startServerreturns anExitCode;ServerOptionshasskipStartupVerify;toldToStopreturnsMaybe Stop;locateResourcetakes the settings andfetchFilethe image proxy
Added
- Multi-arch Docker image (
ghcr.io/pe200012/hs-hath,linux/amd64andlinux/arm64) on distroless nonroot, pluscompose.yaml --versionreadsHATH_BUILD_COMMITat compile time when set- Windows build support and
hs-hath-<version>-windows-x64.ziprelease archives (Ctrl+C and Ctrl+Break trigger graceful shutdown; closing the console window exits immediately) Hath.Cache.FileStatusmodule for cross-platform file status and mtime lookups- RPC failover between the
rpc_server_ipservers, as in the official client - Image proxy from the H@H settings page, for cache misses, proxy tests and retried gallery downloads
ETag,If-None-Match(304) and single byte ranges for cached files;Cache-Controladdsimmutable- Filesystem backend: totals saved at shutdown and reused at start; SHA-1 check of a file last served over a week ago;
verify_cacheandrescan_cache - Official startup checks: refuse an empty cache with more than 20 static ranges, and a disk too small for the cache size
- No caching while less than
diskremaining_bytes(at least 100 MiB) would be left free; gallery downloads pause underdiskremaining_bytes+ 1000 MiB
Removed
service/(personal VPN/tunnel Dockerfile and compose file)
Deprecated
version,proxyandlruCacheSizeinclient-login: never used; they may now be omitted, trigger a warning if present, and will be removed- Library:
Hath.Configdeprecatesversion,proxy,lruCacheSizeandClientProxy
v1.3.0
Upgrade notes
/metricsand/admin/settingsanswer only a request that sendsAuthorization: Bearer <token>, the token being the value ofHATH_METRICS_TOKENin the environment. Without the variable both are gone (404); a Prometheus scrape needsauthorization: { credentials: <token> }(see Security)- Reverse proxy: behind a reverse proxy, run hs-hath with
--trust-proxy-headers. Server commands are now accepted only from the addressesrpc_server_iplists and from local ones (loopback, private), taken from the peer as flood control sees it. A proxy or tunnel on a local address that does not pass the reader's address on therefore still works: its commands are judged by their key alone, as every command was before client_startfailures: whenclient_startfails for a reason other thanFAIL_OTHER_CLIENT_CONNECTED(another client connected) orFAIL_CID_IN_USE(client id in use), for exampleFAIL_CONNECT_TESTor no reply, the process stays up without announcing itself, as the official client does, instead of retrying every second. A supervisor will not restart it- Blacklist: blacklisted files are now deleted from the cache (SQLite, Filesystem and R2); before, the list was only printed
- Certificate: a certificate with less than 24 h left is refused at start
- Gallery layout: galleries are downloaded into a new directory layout,
<downloadDir>/<title> [<gid>](see Changed); files under the old<downloadDir>/<gid>/are not recognised, so those galleries are fetched again /h/requests need validfileindexandxresoptions even for cached files (404 otherwise), as with the official client- Library API: modules and exports were removed, and signatures changed (see Changed). Removed modules:
Hath.Metrics.Counter,Hath.Metrics.Gauge,Hath.Metrics.Histogram,Hath.Metrics.Prometheus,Hath.Metrics.Registry,Hath.Metrics.SnapshotandHath.Metrics.Types(Hath.Statsholds the counters and renders them). Removed exports: fromHath.StatstheStatseffect (Stats(..),runStats,readPrometheus) and the fields ofStatsEnv;Hath.Cache.SQLite.FileRecord;Hath.Locate.streamUpstream;Hath.Gallery.Downloader.downloadNextGallery; the re-exports ofCacheRunner(..)andGalleryTask(..)fromHath.Server; the constructor and fields ofHath.Server.FloodControl.IPRecordand itsHashable IPinstance; thegalleryFileCountfield ofHath.Gallery.GalleryMetadata; theoptShowVersionfield ofHath.CLI.Options(the option parser answers--versionitself);Hath.Server.Middleware.normalizeAcceptMiddlewareandwithHathHeaders
Security
- Dependencies with published advisories: the snapshot is lts-24.67 (was lts-24.27), and
stack.yamlandstack-release.yamltakewarp-3.4.21andhttp2-5.4.14as extra dependencies, withhttp-semantics-0.4.2andtime-manager-0.5.2, which they need. warp before 3.4.17 could be made to read one request as two, which lets a request past a reverse proxy in front of it (HSEC-2026-0013); http2 before 5.4.14 took a CONNECT naming two hosts (HSEC-2026-0015); the snapshot brings aeson 2.2.5.1 (HSEC-2026-0007) and scientific 0.3.10.0 (HSEC-2026-0011).file-iois held at the compiler's 0.1.5. Still open: crypton-x509 1.7 does not enforce X.509 Name Constraints (HSEC-2026-0008); the fix is in 1.9.1, whichtls2.1 cannot be built with /metricsand/admin/settingsanswered anyone who reached the port, and the second lists the RPC servers' addresses. They now need a token (see Upgrade notes), compared in constant time; a wrong or missing one gets 403- Flood control counts a request to any path, as the official client counts every connection; it only counted
/h/, so/t/,/servercmd/and the rest could be asked for without limit - Keys and signatures (keystamps, the keys of server commands and speed tests, the signature of an RPC reply, a gallery list's
DLHASH) are compared in constant time, so the time a refusal takes says nothing about how close a guess was - Cache misses: a file being fetched is held in memory until it is cached, and every request for it meanwhile fetched it again, so one valid link asked for often enough could take all the memory. The downloads under way may now hold 512 MiB between them; past that a miss is answered 503 until some have finished (a single larger file is still fetched when nothing else is under way)
- RPC replies longer than 10 MiB are refused, as by the official client. The RPC server is reached over plain HTTP, and a reply without end from whoever sits in between was read into memory until none was left
- CI: the workflows' token is read-only except in the job that creates the release, and the actions that are not GitHub's own are pinned to a commit (the release image to a digest) instead of a tag that can be moved
.gitignorelists the files that hold secrets (client-login,.env,*.p12,service/client.toml,r2/wrangler.toml), so that they cannot be committed by accident
Changed
- Gallery layout as in the official client: a gallery goes into
<downloadDir>/<title> [<gid>], or[<gid>-<xres>x]for a resized one, its title cleaned up the same way and cut short with...tomax_filename_length(from the server's settings, 125 by default); it used to be<downloadDir>/<gid>/. If the file system will not take the name, the directory is<gid>or<gid>-<xres>x. A file already there and intact is kept, a damaged one deleted - Certificate refresh swaps the certificate in place for new handshakes instead of restarting the listener, so transfers in progress are no longer cut off and
client_startis not re-sent - Filesystem backend: hits are sent from the file instead of being read into memory, and the least recently served files are evicted to stay under the disk limit from the H@H settings page (100 MiB below it, as the official client). Its per-request in-memory LRU, which never survived past one request, is gone
- Metrics:
hath_latency_seconds(a gauge holding the last request's latency in microseconds) is replaced by the histogramhath_request_duration_seconds; the always-zerohath_errors_totalis removed./metricsis rendered when it is read, not every 5 seconds by a background thread, so it shows current values andhath_uptime_seconds, which was always 0, counts; the other names, their order and the format are unchanged client-login.exampleuses the Filesystem backend- Logs: failed TLS handshakes and connections that close before sending anything (scanners probing SSL3/TLS 1.0/1.1 and cipher suites, a few thousand a day on a public node) are no longer printed. The TLS 1.0/1.1 entries are dropped from the allowed versions;
tls2.x rejected them anyway - TLS session resumption (session IDs on TLS 1.2, tickets on TLS 1.3): a returning visitor skips the certificate and its RSA signature, which cuts the server's CPU per handshake by about 45 % on TLS 1.3 and 75 % on TLS 1.2 (several ms on a small VM)
- Internals: the modules live under
Hath.*, split by subject /admin/settingslists only the settings the server assigns- The SQLite backend no longer records the file name a file was first requested under, and a hit no longer writes to the database (the
lru_countercolumn, which nothing read, stays as it is) - R2 backend: a file just uploaded after a cache miss is redirected at once on its next request, instead of first asking the bucket whether it is there (a 40–350 ms round trip)
hath-benchwrites the hs-hath config throughClientConfig'sToDhallinstance instead of a hand-written copy of the record- RPC requests are sent as the official client sends them: the query carries
clientbuild,act,add,cid,acttime,actkeyin that order,add=even when empty, with the;insideaddunescaped. Requests to the RPC server, to image servers (cache misses) and for gallery files carryUser-Agent: Hentai@Home 1.6.6and, as in the official client,Connection: Close(RPC, gallery files) orHath-Request(image servers), and nothing else: no longer our response headers (Cache-Control,Server,X-Content-Type-Options) orAccept-Encoding: gzip - RPC transport: a request whose exchange fails (no connection, a broken reply, an HTTP error other than 404/410) is sent again at once, three times in all, and a connection attempt gives up after 5 s, as in the official client. The reply may still take up to 60 s
- Responses carry the official client's headers:
Server,Connection: close,Content-TypeandContent-Length, andCache-Controlonly with a body; no moreUser-AgentorX-Content-Type-Options. An empty body saysContent-Length: 0where the official client says nothing and closes. An error is the official page,An error has occurred. (<status>)astext/html; charset=ISO-8859-1; so are the replies of server commands, androbots.txtistext/plain; charset=ISO-8859-1. A request other than GET or HEAD gets 400. As in the official client, the path is not percent-decoded except for%3d. Flood control's 429, and Range and If-Modified-Since for files from disk, are as they were - Library API (RPC):
CallRPCandCallDownloadertakeaddasText, empty when there is none;HathError'sTransportErrorcarries aText;serverStatreturns()and fails unless the server answers OK;clientLoginandclientSettingsneedEmbed IO;Hath.Protocol.clientBuildis anInt64. New:Hath.Settings.settingNumber,Hath.Protocol'srpcQuery,outgoingHeadersandretryWithServerTime,Hath.RPC.worthRetrying - Library API (stats, R2): `Hath....
v1.2.0
Security
- Gallery downloader: file names from the server could contain path separators, letting a forged list write anywhere the client can. Lists must now carry a valid
DLHASH, and names/types are limited to what the gallery system produces (official 1.6.6 fix)
Changed
- Protocol 1.6.6 (build 181): RPC moves to
/16/rpcand/16/dl; replies must be signed with the client key and unsigned or altered ones are rejected. The build is fixed in code; the configversionfield is no longer used - Flood control now matches the official client (10 hits draining 1/s, 60 s block; local network and RPC servers exempt)
- Cache misses are streamed to the requester while being fetched instead of after the full download
- Hackage: builds without extra flags;
cryptostoreis vendored with crypton baked in
Fixed
threaded_proxy_testreports real results;servercmdsignatures are checked- Files whose hash is
unknown(generated on demand) can now be downloaded - webp/avif Content-Type; a failed cache write no longer fails the request; shutdown no longer spins when the RPC server is unreachable
Added
hath-bench: a mock RPC server and benchmark that drives hs-hath or the official client
Upgrading
- Upgrading is recommended for the gallery downloader security fix. This release speaks the H@H 1.6.6 protocol (client build 181); the build number is now fixed in code; the
versionfield inclient-loginis ignored and only kept so existing configs still load. - Flood control is on by default and behaves like the official client, so
--disable-rate-limitis no longer needed.
Downloads
hs-hath-v1.2.0-ubuntu-22.04-x86_64.tar.gz:hs-hath,hath-benchandmigrate-to-r2for x86_64 Linux, built on Ubuntu 22.04 (needs glibc ≥ 2.34).hs-hath --versionreports commit624e8f5.- Hackage: https://hackage.haskell.org/package/hs-hath-1.2.0
SHA-256: 57e64013c97f42325a21dc240fe2f55913574856c03a5a7da3927f8f9e8af97c