Migrating hosting from Codeberg to git.kmalloc.org. Renames the
module path in go.mod, every internal import, and the OCI image
source label in the Dockerfile. Build and full test suite verified
green after the rename.
- A timeout inside the provider (the outbound client's own deadline, which wraps
context.DeadlineExceeded) was mistaken for the caller leaving and came out as a 500, so
an older stored picture was not served. The decision now uses the caller's own context,
and a build that runs out of its two minutes is an outage (502) too.
- A purge of the Commons data could be undone by a read that was already running: the row
was deleted, so the generation guard started from zero, and the files were written after
the files were removed. Pictures are now kept only under a purge counter; BeginArtistPurge
is called before the purge and a read that started earlier starts again, or is refused if
the provider is off by then.
- A redirect or an oversized picture from the picture host is a fault of that picture (no
picture), not an outage, and the pictures are downloaded through a client of their own so
that one bad file cannot open the breaker of the API calls.
- The author drops the invisible characters that reorder or hide text. Artist pictures are
decoded only up to 4 million pixels.
- Tests: an outage that ends in a deadline, a build that times out, a purge during a read,
a redirect and a huge picture from the host, a separate download client.
- GET and HEAD /artists/{id}/image serve a free picture of an artist as a JPEG
(size=small 300 px or large 1000 px, token in the query allowed for an <img>), and
GET /artists/{id}/image/credit gives the author, the licence and the page of the file,
to be shown next to it.
- New provider "commons" (off by default, no key, contact in the User-Agent), which also
needs MusicBrainz on. The way to the picture uses ids only, never a name: the artist's
MusicBrainz id, the Wikidata item MusicBrainz links to it, the file Wikidata names for
it (P18), Commons for its licence, and a 960 px copy from a Wikimedia picture host.
- Only free licences: public domain, CC0, CC BY and CC BY-SA. Non-commercial,
no-derivatives, GFDL alone, fair use and unknown licences are refused, since a copy is
kept. The author is plain text, the licence address is kept only on creativecommons.org,
and the download only from https thumb.wikimedia.org or upload.wikimedia.org.
- Built on the first request, kept in the data folder: 30 days, or a week when there is no
free picture; an older copy is served when Commons cannot be reached; a failure is not
remembered. Credit changes change the ETag.
- Removing the provider's data forgets the records and deletes the files; a read that started
before it is not saved over it.
- images table gets the credit (migration 0015); the purge reports images.
- Spec, contract test, README updated; the facts of the real APIs are written down.
Closes#41