pmtiles-swarm 0.99.0 → 0.99.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 CHANGED
@@ -7,6 +7,34 @@
7
7
  ### 🐞 Bug fixes
8
8
  - _...Add new stuff here..._
9
9
 
10
+ ## 0.99.2
11
+ ### ✨ Features and improvements
12
+
13
+ ### 🐞 Bug fixes
14
+ - **The stack editor named a pinned archive by its infohash.** The list of saved stacks was fixed in
15
+ 0.98.3, but the editor has its own row and kept showing `33394361a935…` — where the menu that
16
+ offered the archive a moment earlier had shown its filename. The editor works on the recipe, and
17
+ a pinned source in a recipe is an infohash and nothing else, so the row had nothing else to
18
+ print. It remembers the names the source menu already fetched now, and the infohash is on hover.
19
+
20
+ ## 0.99.1
21
+ ### ✨ Features and improvements
22
+
23
+ ### 🐞 Bug fixes
24
+ - **The sidecar stops segfaulting, which is what left a library half loaded after a restart.**
25
+ `pmtiles-torrent` 0.11.1. The traceback 0.99.0 made possible named the same frame every time: the
26
+ alert pump, inside `session.wait_for_alert()`. That call hands back a borrowed pointer to an
27
+ alert which the next `pop_alerts()` — the following statement — invalidates, and nothing ever
28
+ read the return value; it was only a way to sleep. The pump waits on its own stop event now.
29
+
30
+ This is the cause behind the `not loaded` archives, not another symptom of them. Each crash took
31
+ whatever restore had handed over before it, because the replacement sidecar holds none of it, so
32
+ the archives restored first were the ones that came back missing. The node stops that leaving a
33
+ mark either way — it hands them back — but they should now not be dropped in the first place.
34
+
35
+ Sidecar shutdown is quicker too: the pump answers the stop at once, where the old wait had to be
36
+ sat through to the end of its timeout.
37
+
10
38
  ## 0.99.0
11
39
  ### ✨ Features and improvements
12
40
  - **A sidecar crash now names the frame it happened in.** `pmtiles-torrent` 0.11.0 arms
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmtiles-swarm",
3
- "version": "0.99.0",
3
+ "version": "0.99.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",
@@ -49,7 +49,7 @@
49
49
  "maplibre-gl": "^6.2.0",
50
50
  "parse-torrent": "^11.0.24",
51
51
  "pmtiles": "^4.4.1",
52
- "pmtiles-torrent": "^0.11.0",
52
+ "pmtiles-torrent": "^0.11.1",
53
53
  "webtorrent": "^3.0.21"
54
54
  },
55
55
  "engines": {
@@ -8152,6 +8152,25 @@ Every piece is hashed against the ` +
8152
8152
  * one over an infohash pins to a build that will eventually be retired.
8153
8153
  * @returns {Promise<void>} - Resolves once filled.
8154
8154
  */
8155
+ /**
8156
+ * Archive names by infohash, learned while filling the source menu.
8157
+ *
8158
+ * The editor works on the recipe, and a pinned source in a recipe is an
8159
+ * infohash and nothing else -- so a row drawn from the draft alone can
8160
+ * only show forty characters of hex, which is what it used to do. The
8161
+ * menu that offered the archive had its name a moment earlier; this is
8162
+ * where that is kept so the row can use it.
8163
+ */
8164
+ const archiveNames = new Map();
8165
+
8166
+ /**
8167
+ * What to call a pinned archive in the editor.
8168
+ * @param {string} infoHash - The archive the recipe names.
8169
+ * @returns {string} - Its name, or the short hash where none is known.
8170
+ */
8171
+ const archiveLabel = (infoHash) =>
8172
+ archiveNames.get(infoHash) ?? shortHash(infoHash) ?? '';
8173
+
8155
8174
  const fillStackSourceChoices = async () => {
8156
8175
  const select = $('stack-add-source');
8157
8176
  const taken = new Set(
@@ -8212,6 +8231,14 @@ Every piece is hashed against the ` +
8212
8231
  // missing from a menu the operator is looking at. This is the same
8213
8232
  // endpoint the Archives view reads, and it answers a bare array.
8214
8233
  const held = await api('/api/torrents');
8234
+ // Every archive, before the menu is filtered down. The one the
8235
+ // editor most needs a name for is the one already in the draft,
8236
+ // which is exactly what `taken` removes below.
8237
+ for (const entry of held ?? []) {
8238
+ if (entry.infoHash && entry.name) {
8239
+ archiveNames.set(entry.infoHash, entry.name);
8240
+ }
8241
+ }
8215
8242
  // The same rule the tile route enforces, because a stack source is
8216
8243
  // read through exactly that path: a complete MBTiles belongs here,
8217
8244
  // and one still arriving does not -- a stack naming it would answer
@@ -8549,12 +8576,16 @@ Every piece is hashed against the ` +
8549
8576
  <div class="card tight">
8550
8577
  <div class="row">
8551
8578
  <span class="muted">${index}</span>
8552
- <code>${escapeHtml(
8579
+ <code${
8580
+ source.archive
8581
+ ? ` title="${escapeHtml(source.archive)}"`
8582
+ : ''
8583
+ }>${escapeHtml(
8553
8584
  remote
8554
8585
  ? (source.url || 'an address').replace(/^https?:\/\//, '')
8555
8586
  : (source.stack ??
8556
8587
  source.category ??
8557
- shortHash(source.archive) ??
8588
+ (source.archive ? archiveLabel(source.archive) : '') ??
8558
8589
  ''),
8559
8590
  )}</code>
8560
8591
  <span class="sub" title="${