pmtiles-swarm 0.24.0 → 0.24.2
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 +30 -0
- package/package.json +2 -2
- package/src/api.js +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,36 @@
|
|
|
7
7
|
### 🐞 Bug fixes
|
|
8
8
|
- _...Add new stuff here..._
|
|
9
9
|
|
|
10
|
+
## 0.24.2
|
|
11
|
+
### 🐞 Bug fixes
|
|
12
|
+
- **An empty `publicUrl` was read as an empty base rather than as no setting.** `??` treats only
|
|
13
|
+
null and undefined as absent, so `"publicUrl": ""` — which is how an operator naturally writes
|
|
14
|
+
"I do not want this" into a key already in the file — produced URLs like
|
|
15
|
+
`/archives/<hash>/{z}/{x}/{y}.pbf`. Those half-work, which is the trap: a browser resolves them
|
|
16
|
+
against the TileJSON it just fetched and renders perfectly, while everything needing an absolute
|
|
17
|
+
URL quietly gets something unusable — a torrent client handed the `torrent` link, another node
|
|
18
|
+
syncing from the feed. Empty and whitespace now mean unset, and the base falls back to the
|
|
19
|
+
request, which is what a node syncing internally by IP depends on.
|
|
20
|
+
|
|
21
|
+
## 0.24.1
|
|
22
|
+
### 🐞 Bug fixes
|
|
23
|
+
- **Takes pmtiles-torrent 0.4.5, which stops a torrent that is not ready yet reporting a corrupt
|
|
24
|
+
one.** Reading a piece from an archive whose metadata had not arrived — or that was still checking
|
|
25
|
+
what is on disk, which is how a resync starts — came back as `invalid piece index in slot list`.
|
|
26
|
+
The piece count is zero until metadata lands, so every index is out of range including the valid
|
|
27
|
+
ones, and what is really "ask again in a moment" arrived under a name that reads as a damaged
|
|
28
|
+
archive. Head warming took that at its word and applied its full doubling backoff, so an archive
|
|
29
|
+
sat unservable for minutes on a node that was downloading it at 60 MiB/s throughout.
|
|
30
|
+
|
|
31
|
+
The floor is raised rather than the range widened, because `^0.4.2` already permitted 0.4.5 and
|
|
32
|
+
the lockfile is what a deployment installs from: `npm ci` would have kept fetching 0.4.2 and none
|
|
33
|
+
of this would have reached a node.
|
|
34
|
+
|
|
35
|
+
Worth knowing how much rides on that single read. The PMTiles v3 specification requires the root
|
|
36
|
+
directory to lie within the first 16,384 bytes, so a 16 KiB read at offset 0 fetches the header
|
|
37
|
+
and the root directory together — one piece, after which the archive is servable. A mirror is
|
|
38
|
+
unservable until exactly that read succeeds.
|
|
39
|
+
|
|
10
40
|
## 0.24.0
|
|
11
41
|
### ✨ Features and improvements
|
|
12
42
|
- **A mirror now inherits the archive summary from the feed it follows.** `renderItem` has always
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmtiles-swarm",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
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.
|
|
49
|
+
"pmtiles-torrent": "^0.4.5",
|
|
50
50
|
"webtorrent": "^3.0.21"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
package/src/api.js
CHANGED
|
@@ -213,8 +213,21 @@ export function createApp({
|
|
|
213
213
|
* @param {import('express').Request} req - The request.
|
|
214
214
|
* @returns {string} - Base URL without a trailing slash.
|
|
215
215
|
*/
|
|
216
|
-
const baseUrl = (req) =>
|
|
217
|
-
|
|
216
|
+
const baseUrl = (req) => {
|
|
217
|
+
// An empty publicUrl means "not set", not "use an empty base".
|
|
218
|
+
//
|
|
219
|
+
// `??` reads only null and undefined as absent, so `"publicUrl": ""` --
|
|
220
|
+
// which is how an operator naturally writes "I do not want this" in a JSON
|
|
221
|
+
// file that already has the key -- produced a base of "" and URLs like
|
|
222
|
+
// `/archives/<hash>/{z}/{x}/{y}.pbf`. Those half-work, which is the worst
|
|
223
|
+
// of both: a browser resolves them against the TileJSON it fetched and
|
|
224
|
+
// renders perfectly, while every consumer that needs an absolute URL --
|
|
225
|
+
// a torrent client handed the `torrent` link, another node syncing from
|
|
226
|
+
// the feed -- silently gets something it cannot use.
|
|
227
|
+
const configured = String(config.publicUrl ?? '').trim();
|
|
228
|
+
const base = configured || `${req.protocol}://${req.host}`;
|
|
229
|
+
return base.replace(/\/$/, '');
|
|
230
|
+
};
|
|
218
231
|
|
|
219
232
|
/**
|
|
220
233
|
* Whether an archive should answer a missing tile with 404 rather than 204.
|