No description
  • Rust 70.6%
  • Python 14.8%
  • Nix 11.5%
  • PowerShell 1.6%
  • Dockerfile 1.5%
Find a file
renovate[bot] 2601f20e7f
Update dependencies (#46)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-08-24 13:07:34 +00:00
.github/workflows Update actions/checkout action to v7 (#35) 2026-07-23 23:08:54 +02:00
.vscode feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
.woodpecker fix(ci): update ghcr credentials in woodpecker configs 2026-05-22 12:14:51 +02:00
assets Added Favicon 2022-11-30 01:18:24 +01:00
charts/neko-server feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
fonts
gallery-dl-worker Update dependencies (#46) 2026-08-24 13:07:34 +00:00
src feat(docs): update README to clarify query parameters and response structure 2026-08-05 18:52:52 +02:00
template
tests feat(docs): update README to clarify query parameters and response structure 2026-08-05 18:52:52 +02:00
.dockerignore feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
.env feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
.gitattributes feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
.gitignore feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
build-all.ps1 Adjust build system 2025-11-01 18:06:09 +01:00
Cargo.lock Update dependencies (#46) 2026-08-24 13:07:34 +00:00
Cargo.toml Update Rust Dependencies (#24) 2026-07-23 22:20:43 +02:00
docker-compose.yml feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
Dockerfile feat(gallery-dl): implement gallery-dl worker and JSON API support 2026-05-24 01:57:44 +02:00
flake.lock feat(docs): improve README formatting and add nix dev environment 2026-05-24 02:15:15 +02:00
flake.nix feat(docs): improve README formatting and add nix dev environment 2026-05-24 02:15:15 +02:00
README.md feat(docs): update README to clarify query parameters and response structure 2026-08-05 18:52:52 +02:00
renovate.json feat(docs): update README to clarify query parameters and response structure 2026-08-05 18:52:52 +02:00

Neko Fans Server

Better Uptime Badge

This Server keeps track of how many images were displayed with the Neko Fans plugin.

API

Run in Postman Open API

https://api.nekofans.net/count_total Generates the total download count from every user
total
https://api.nekofans.net/count/123 Generates an image with that number
420 420
69 69
1337 1337
314159 314159

POST /gallery/query runs a constrained gallery-dl JSON query through the internal worker, normalizes the result shape, and caches the normalized result in Redis.

Request body:

{
  "source": "danbooru",
  "rating": "safe",
  "tags": ["cat_girl"],
  "limit": 25
}

Fields:

Field Required Description
source yes, unless url is set One of danbooru, gelbooru, safebooru, konachan, or yandere.
url yes, unless source is set Direct https:// URL for any gallery-dl extractor. This cannot be combined with source, rating, or tags.
rating no Convenience field for a booru rating tag such as safe, questionable, or explicit. rating:safe is also accepted and normalized to safe. The worker receives this as a normal rating:<value> search tag.
tags no Up to 20 tag strings. Tags may contain ASCII letters, numbers, _, -, and :. Existing clients may still pass rating filters as tags, for example rating:safe.
limit no Number of gallery-dl items to request. Defaults to 50; maximum is 100.

For source queries, at least one query term is required: either rating or one tags entry.

Response body:

{
  "items": [
    {
      "url": "https://cdn.example/image.jpg",
      "source": "danbooru",
      "category": "danbooru",
      "subcategory": "post",
      "id": 123,
      "title": null,
      "filename": "image",
      "extension": "jpg",
      "file_url": "https://cdn.example/image.jpg",
      "preview_url": "https://cdn.example/preview.jpg",
      "sample_url": null,
      "width": 1200,
      "height": 900,
      "rating": "s",
      "score": 42,
      "tags": ["cat_girl"],
      "created_at": "2026-05-24T10:00:00Z",
      "metadata": {}
    }
  ],
  "errors": []
}

The server consumes gallery-dl -J event rows such as [2, metadata], [3, url, metadata], and [-1, error], then returns a stable object. Source-specific fields are preserved under metadata.

Caching behavior:

Setting Default Description
GALLERY_DL_CACHE_TTL_SECONDS 900 Redis result cache TTL for normalized query target + limit.
worker lock TTL 30 Short Redis lock used to avoid duplicate worker calls for the same cache key. Concurrent identical misses return HTTP 202.

Successful responses are always backed by Redis: either X-Server-Cache: HIT or the worker result is written to Redis before returning X-Server-Cache: MISS. X-Server-Cache-Ttl-Seconds reports the remaining server-side TTL. HTTP responses include Cache-Control: no-store because this is a POST endpoint whose response varies by request body; caching is server-side in Redis, not browser/proxy caching.

The technology used to run the server

Neko Server is written in Rust with the asyc framework Tokio and using Warp as a web server. This is then all bundled in a Docker container, which gets automaticly build with Google Cloud Build. Those images are then pushed to a private Container repository.

Local development with Nix

Enter the development shell with:

nix develop

The shell includes the Rust toolchain, rust-analyzer, cargo-watch, Redis, Docker Compose, and the Python dependencies for the gallery-dl worker.