Skip to content
moxon home

6.4.0

API

API v6.4.0 — Public Docker image, 41 endpoints declared in the manifest, stricter text for /badge.

Contracts and manifest

  • 41 endpoints are now declared as contracts: the route, the check of the parameters and the description used by the documentation come from one declaration, so they cannot drift apart. Nothing changes in what they answer: v4, v5 and v6 behave as in 6.3.0, with the same statuses, the same messages and the same order of checks, apart from the text of a badge (see below).
  • The manifest export now lists 42 entries: the 41 endpoints, with levenshtein appearing twice (a GET until v5, a POST from v6). Each entry has its name, method, path, category, the first (since) and last (until) version that serves it, its params with their type, fixed options and default, and a request example. A parameter is marked required only when a request without it is refused before the endpoint runs, so the manifest declares fewer required parameters than the endpoints really have. Experimental
  • The manifest stays experimental: the endpoints that answer an image, keep a state (chat, tic-tac-toe, the verification of captcha and proof of work) or describe the API itself are not declared yet, and its shape may still change in a minor release.

Docker

  • A public Docker image, ghcr.io/moxondev/api, for linux/amd64 and linux/arm64. Its tags are 6.4.0, 6.4 and 6, which follow the releases, and latest, the most recent stable one. It listens on port 3000, and docker run -d -p 3000:3000 ghcr.io/moxondev/api:latest is enough to start it. See Instance.
  • It reads the same environment variables as the Node server (PORT, CHALLENGE_SECRET, TRUSTED_PROXIES, DOCS_URL, the rate limits and the rest), given with -e or from a file with --env-file.
  • It is made for a locked-down host: the image runs as the unprivileged node user and writes nothing to disk, so it also starts with --read-only --tmpfs /tmp. It reports itself healthy once GET / answers, and it stops at once on SIGTERM instead of waiting to be killed.
  • Behind a reverse proxy, set TRUSTED_PROXIES: otherwise the server sees the address of the proxy or of the Docker network instead of the caller's, and the rate limits count the wrong clients.

Badge

  • GET /badge now refuses invisible characters in label and message: a soft hyphen, a word joiner, a bidirectional mark, a Hangul or Braille filler, a tag character, a lone surrogate and other format characters. A text made only of spaces, combining marks or variation selectors is refused too. They answer the same 400 as the control characters before them: Label cannot contain control or invisible characters (Message cannot contain control or invisible characters for message).
  • Still accepted: an emoji with its variation selector, accents, no-break spaces and the ideographic space around a visible text.

Package

  • canvas goes to 3.2.3, whose release carries a prebuilt binary for linux-arm64: it is what makes the arm64 image possible. Nothing changes for the library.
  • A vulnerable minimatch pulled in by the development dependencies is replaced by a patched release. It only concerned the development tools: it was never installed with @moxon/api.
  • The npm description and the README of the package now announce 50+ endpoints.

Documentation

  • The Manifest page now describes the 42 entries: the fields of an entry and of a parameter, and the rule that required is set only when a request without the parameter is refused before the endpoint runs. It states which endpoints are not declared yet. Experimental
  • The Instance page has a new Docker section: the image, its tags, the port, the environment variables, the read-only start, the health check and TRUSTED_PROXIES behind a proxy.
  • The Badge page lists the invisible characters that label and message refuse, and the error they answer.