pmtiles-swarm 0.24.1 → 0.24.3
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 +27 -0
- package/package.json +2 -2
- package/src/api.js +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@
|
|
|
7
7
|
### 🐞 Bug fixes
|
|
8
8
|
- _...Add new stuff here..._
|
|
9
9
|
|
|
10
|
+
## 0.24.3
|
|
11
|
+
### 🐞 Bug fixes
|
|
12
|
+
- **Takes pmtiles-torrent 0.4.6.** Two things a node reading pieces on demand wanted. The sidecar
|
|
13
|
+
no longer discards the alerts that explain a failed read — `torrent_error_alert` and
|
|
14
|
+
`file_error_alert` were drained from the queue and thrown away by the one loop running while a
|
|
15
|
+
read was outstanding, so a full disk, an unwritable save path and a torrent that could not verify
|
|
16
|
+
its pieces all arrived as the same silent timeout. And the last piece of an archive is now
|
|
17
|
+
fetched before any header has been read: everything else is prioritised from the header, so until
|
|
18
|
+
one can be read nothing points anywhere but at the header, and planetiler writes the JSON
|
|
19
|
+
metadata and the leaf directories after all the tile data — where a partial mirror is least
|
|
20
|
+
likely to have them.
|
|
21
|
+
|
|
22
|
+
The floor is raised in the lockfile as well as the range. `^0.4.5` already permitted 0.4.6, and a
|
|
23
|
+
deployment installs from the lockfile, so without moving it `npm ci` would have gone on fetching
|
|
24
|
+
the version without either fix.
|
|
25
|
+
|
|
26
|
+
## 0.24.2
|
|
27
|
+
### 🐞 Bug fixes
|
|
28
|
+
- **An empty `publicUrl` was read as an empty base rather than as no setting.** `??` treats only
|
|
29
|
+
null and undefined as absent, so `"publicUrl": ""` — which is how an operator naturally writes
|
|
30
|
+
"I do not want this" into a key already in the file — produced URLs like
|
|
31
|
+
`/archives/<hash>/{z}/{x}/{y}.pbf`. Those half-work, which is the trap: a browser resolves them
|
|
32
|
+
against the TileJSON it just fetched and renders perfectly, while everything needing an absolute
|
|
33
|
+
URL quietly gets something unusable — a torrent client handed the `torrent` link, another node
|
|
34
|
+
syncing from the feed. Empty and whitespace now mean unset, and the base falls back to the
|
|
35
|
+
request, which is what a node syncing internally by IP depends on.
|
|
36
|
+
|
|
10
37
|
## 0.24.1
|
|
11
38
|
### 🐞 Bug fixes
|
|
12
39
|
- **Takes pmtiles-torrent 0.4.5, which stops a torrent that is not ready yet reporting a corrupt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmtiles-swarm",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.3",
|
|
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.6",
|
|
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.
|