pmtiles-swarm 0.24.1 → 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 +11 -0
- package/package.json +1 -1
- package/src/api.js +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@
|
|
|
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
|
+
|
|
10
21
|
## 0.24.1
|
|
11
22
|
### 🐞 Bug fixes
|
|
12
23
|
- **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.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",
|
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.
|