pmtiles-swarm 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -28,9 +28,48 @@
28
28
  file: libtorrent's resume data records each file's size and mtime and re-hashes the whole
29
29
  store when they disagree on load, so doing it under a running torrent would trade a broken
30
30
  ETag for an hours-long recheck of a large library.
31
- - _...Add new stuff here..._
31
+ - **MBTiles archives are served as tiles once their download finishes.** They could be
32
+ distributed but never served, which was right while one is arriving — MBTiles is SQLite, whose
33
+ pages are laid out for a B-tree rather than spatially, so reading one tile can touch pages
34
+ anywhere in the file, and over a swarm that is not a read but a download. None of that is true
35
+ of a complete local copy: it is an ordinary database holding the same tiles and metadata a
36
+ PMTiles does. A TileJSON endpoint and z/x/y tiles now answer for one, read through the built-in
37
+ `node:sqlite` so this costs no dependency. An incomplete archive answers 503 — "not yet" —
38
+ where anything that holds no tiles at all still answers 415.
39
+ - **`sparse` is read from the archive's own metadata.** Defaulting by tile format is a guess:
40
+ PMTiles records that tiles are webp, not that they are terrain. tileserver-gl reads `sparse`
41
+ from the metadata, so an archive built to be served there already carried the answer and it was
42
+ being ignored here — the same file behaved differently in the two servers unless configured
43
+ twice. Precedence is the entry, then the archive, then this node's default, then the format
44
+ guess; the archive sits above the node default because a blanket setting was chosen without
45
+ reference to any particular archive. It is republished in the TileJSON, so a mirror starts from
46
+ the same answer.
47
+ - **A mutable magnet now carries the build that is current, alongside the key.** A BEP 46 magnet
48
+ named only the public key, which needs a DHT to resolve — and browsers have none, since
49
+ WebTorrent stubs out `bittorrent-dht` in its browser build for want of UDP sockets. That
50
+ mattered because this string is routinely put in the fragment of a `tiles.json` URL, an
51
+ arrangement whose whole point is that one URL is self-sufficient. A key-only fragment forced a
52
+ browser to fetch the very document the fragment was attached to before it could join anything.
53
+ The magnet is now `xt=urn:btih:<build>&xs=urn:btpk:<key>`: a client resolves whichever it
54
+ understands, and the infohash going stale on the next build is what the key beside it is for.
55
+ - **The public listener has a front page.** With `adminPort` splitting the two, `/` on the public
56
+ port was a 404. It now lists the archives this node publishes with their tile and TileJSON
57
+ URLs, torrents, magnets and a preview for each. It is a view of `/api/catalog` and
58
+ `/api/categories`, filtered by the same `feedCategories` rule, so it can show nothing that was
59
+ not already published — and it is not the console, which stays on the admin port.
60
+ `publicIndex: false` turns it off, withdrawing the three paths it needs with it.
61
+ - **Lint and format tooling.** `npm run lint`, `lint:fix`, `format`, `format:check`, `tidy` and
62
+ `check`, wired into CI. There was no linter before, though the source carried
63
+ `eslint-disable` comments for one — so those suppressed nothing and the rules they named were
64
+ never checked.
32
65
 
33
66
  ### 🐞 Bug fixes
67
+ - **WebTorrent's `pieces()` was defined twice.** The later definition wins, so the first had
68
+ never run — which is why it still called an undefined `countHeld` and no test noticed.
69
+ - **A stuck HTTP connection could keep a shutdown waiting.** `closeServer` armed its force-close
70
+ timer after registering the handler that clears it, so a close callback arriving first would
71
+ `clearTimeout(undefined)` and leave the timer running.
72
+ - **Three thrown errors discarded the error that caused them**, losing the cause chain.
34
73
  - **Retention no longer reaches across a folder's other entries.** A watched folder's family was
35
74
  built from the directory alone, so several entries sharing one — which `match` exists to make
36
75
  possible — were treated as a single family. With `keep: 1`, importing this week's `monthly`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmtiles-swarm",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "BitTorrent distribution for PMTiles map archives: create torrents, watch folders, publish and subscribe to RSS feeds, and seed through qBittorrent or an embedded client",
5
5
  "type": "module",
6
6
  "main": "src/index.js",