pmtiles-swarm 0.24.2 → 0.24.4

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,42 @@
7
7
  ### 🐞 Bug fixes
8
8
  - _...Add new stuff here..._
9
9
 
10
+ ## 0.24.4
11
+ ### 🐞 Bug fixes
12
+ - **The feed advertised a .torrent nobody could fetch.** Every item named
13
+ `/api/torrents/<infohash>/file`, and that address is unreachable to exactly the audience a feed
14
+ is written for: the API is not on the public listener, so it answers 404 there, and on the
15
+ console listener it answers 401. Our own subscriptions got one or the other, and so did any
16
+ ordinary torrent client pointed at the same URL.
17
+
18
+ It failed quietly, which is why it lasted. `subscriptions.js` falls back to the magnet and logs a
19
+ line about it, so a mirror still joined and still downloaded. What the fallback costs is not
20
+ visible from there: BEP 9 carries only the info dict, and a v2 torrent's piece layers live
21
+ outside it, so an archive joined by magnet can never obtain them. On a hybrid torrent the mirror
22
+ then holds metadata it cannot verify pieces against and republishes a .torrent that claims v2
23
+ while omitting the hashes — 413 KB against the origin's 1,074 KB, the difference being precisely
24
+ 20,636 pieces x 32 bytes. Anything mirroring from that mirror inherits it.
25
+
26
+ Items now name `/archives/<infohash>/archive.torrent`, which is public, unauthenticated, and the
27
+ same URL the TileJSON has always given for the same archive. Those two disagreeing was the bug;
28
+ a test now pins that they agree and that what they name answers 200 on the public surface.
29
+
30
+ ## 0.24.3
31
+ ### 🐞 Bug fixes
32
+ - **Takes pmtiles-torrent 0.4.6.** Two things a node reading pieces on demand wanted. The sidecar
33
+ no longer discards the alerts that explain a failed read — `torrent_error_alert` and
34
+ `file_error_alert` were drained from the queue and thrown away by the one loop running while a
35
+ read was outstanding, so a full disk, an unwritable save path and a torrent that could not verify
36
+ its pieces all arrived as the same silent timeout. And the last piece of an archive is now
37
+ fetched before any header has been read: everything else is prioritised from the header, so until
38
+ one can be read nothing points anywhere but at the header, and planetiler writes the JSON
39
+ metadata and the leaf directories after all the tile data — where a partial mirror is least
40
+ likely to have them.
41
+
42
+ The floor is raised in the lockfile as well as the range. `^0.4.5` already permitted 0.4.6, and a
43
+ deployment installs from the lockfile, so without moving it `npm ci` would have gone on fetching
44
+ the version without either fix.
45
+
10
46
  ## 0.24.2
11
47
  ### 🐞 Bug fixes
12
48
  - **An empty `publicUrl` was read as an empty base rather than as no setting.** `??` treats only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmtiles-swarm",
3
- "version": "0.24.2",
3
+ "version": "0.24.4",
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",
@@ -46,7 +46,7 @@
46
46
  "maplibre-gl": "^6.2.0",
47
47
  "parse-torrent": "^11.0.24",
48
48
  "pmtiles": "^4.4.1",
49
- "pmtiles-torrent": "^0.4.5",
49
+ "pmtiles-torrent": "^0.4.6",
50
50
  "webtorrent": "^3.0.21"
51
51
  },
52
52
  "engines": {
package/src/feed.js CHANGED
@@ -84,7 +84,27 @@ ${items}
84
84
  * @returns {string} - The item XML.
85
85
  */
86
86
  function renderItem(entry, baseUrl) {
87
- const torrentUrl = `${baseUrl}/api/torrents/${entry.infoHash}/file`;
87
+ // The public route, which is the only one a subscriber can use.
88
+ //
89
+ // This named /api/torrents/<hash>/file, and that address is unreachable to
90
+ // everyone the feed is written for: the API is not on the public listener at
91
+ // all, so it answers 404 there, and on the console listener it answers 401.
92
+ // A feed is a public document whose whole purpose is to be followed by
93
+ // somebody else, and every consumer of it -- our own subscriptions, and any
94
+ // ordinary torrent client pointed at the same URL -- got one of those two.
95
+ //
96
+ // Nothing broke loudly, because subscriptions.js falls back to the magnet and
97
+ // logs a line about it. What that fallback costs is invisible from here and
98
+ // considerable: BEP 9 carries only the info dict, and a v2 torrent's piece
99
+ // layers live outside it, so an archive joined by magnet can never obtain
100
+ // them. On a hybrid torrent the mirror then holds metadata it cannot verify
101
+ // pieces against, and republishes a .torrent that claims v2 and omits the
102
+ // hashes -- measured at 413 KB against the origin's 1,074 KB, the difference
103
+ // being exactly 20,636 pieces x 32 bytes.
104
+ //
105
+ // Kept identical to what the TileJSON advertises for the same archive, in
106
+ // api.js. Those two disagreeing is what this was.
107
+ const torrentUrl = `${baseUrl}/archives/${entry.infoHash}/archive.torrent`;
88
108
  const map = entry.pmtiles;
89
109
 
90
110
  const mapFields = map