Просмотр исходного кода

fix(web): render the release captures in the changelog page (#2195)

Nacho 1 неделя назад
Родитель
Сommit
34f4b7a298
4 измененных файлов с 21 добавлено и 9 удалено
  1. 10 1
      web/build-changelog.mjs
  2. 7 7
      web/changelog.html
  3. 1 1
      web/changelog.template.html
  4. 3 0
      web/styles.css

+ 10 - 1
web/build-changelog.mjs

@@ -31,11 +31,15 @@ function md(src) {
       list = null
     }
   }
+  const IMG = /^!\[([^\]]*)\]\(([^)]+)\)$/
+  const img = (alt, src) => `<img src="${src}" alt="${alt}" loading="lazy" decoding="async" />`
   const inline = (t) =>
     esc(t)
       .replace(/`([^`]+)`/g, '<code>$1</code>')
       .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
-      .replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '$1')
+      // Las capturas de las notas son la mitad del contenido: antes se
+      // sustituían por su texto alternativo y la página las perdía.
+      .replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (_m, alt, src) => img(alt, src))
       .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>')
 
   for (const raw of lines) {
@@ -78,6 +82,11 @@ function md(src) {
       continue
     }
     flush()
+    const onlyImg = line.trim().match(IMG)
+    if (onlyImg) {
+      out.push(`<p class="changelog-figure">${img(onlyImg[1], onlyImg[2])}</p>`)
+      continue
+    }
     out.push(`<p>${inline(line)}</p>`)
   }
   flush()

+ 7 - 7
web/changelog.html

@@ -28,7 +28,7 @@
   <meta name="twitter:image" content="https://netpulse.cloudless.club/og.png" />
   <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='10' y1='78' x2='90' y2='20' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%2322D3EE'/%3E%3Cstop offset='1' stop-color='%23A78BFA'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M10 60 H27 L33 60 L40 38 L48 78 L54 48 L58 60 H64' stroke='url(%23g)' stroke-width='5.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='73' cy='60' r='6' fill='url(%23g)'/%3E%3Cpath d='M62.4 49.4 A15 15 0 0 1 83.6 49.4' stroke='url(%23g)' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M55.3 39.7 A25 25 0 0 1 90.7 39.7' stroke='url(%23g)' stroke-width='5' stroke-linecap='round' opacity='0.6'/%3E%3C/svg%3E" />
   <link rel="stylesheet" href="fonts/fonts.css" />
-  <link rel="stylesheet" href="styles.css?v=20261121a" />
+  <link rel="stylesheet" href="styles.css?v=20261127a" />
   <script src="i18n.js" defer></script>
   <script src="app.js" defer></script>
 </head>
@@ -77,10 +77,10 @@
 <h3>NetPulse 2.55.0</h3>
 <p>Most of this release is about noise the panel was making. A unit polled over SSH was getting an HTTP request on its SSH port every cycle, a MediaTek router was writing twenty kernel errors per cycle because the agent asked a down interface for its transmit power, and the neighbours of an ISP segment were being listed as devices of your network. The alert log also gets the controls it should have had from the start.</p>
 <h4>Read it, snooze it, or open it</h4>
-<p>The three actions on an alert row and the snooze menu picking tomorrow at 9:00</p>
+<p class="changelog-figure"><img src="https://raw.githubusercontent.com/gnacho/netpulse/v2.55.0/docs/releases/2.55.0/alert-actions.gif" alt="The three actions on an alert row and the snooze menu picking tomorrow at 9:00" loading="lazy" decoding="async" /></p>
 <p>Every alert row carries its three actions now instead of hiding them behind a click on the row: mark as read, snooze, and open the details. Snoozing does not hide it. It pauses notifications and escalation for that incident for one hour, two, eight, until tomorrow at 9:00 or seven days, and the row stays in the log with the time it comes back. Monitoring continues and the resolution is still detected. #2186 built it from the request in #2185.</p>
 <h4>A name, and where it came from</h4>
-<p>The client detail showing the name source moving from a DHCP lease to mDNS, reverse DNS, a reservation and a manual name</p>
+<p class="changelog-figure"><img src="https://raw.githubusercontent.com/gnacho/netpulse/v2.55.0/docs/releases/2.55.0/name-source.gif" alt="The client detail showing the name source moving from a DHCP lease to mDNS, reverse DNS, a reservation and a manual name" loading="lazy" decoding="async" /></p>
 <p>The client detail says which source named the device: a DHCP lease, mDNS, reverse DNS, a reservation, a known MAC alias, the router firmware or the name you typed. The attribution is stored, so it survives retention and a restart, which is what makes a name that changed explainable. The rules did not change. A manual name always wins and a reservation beats an announcement. #2177 is the first phase of #2163. A global preference and a per-client choice need every candidate kept, not only the winner, and that is the next phase.</p>
 <h4>Also in this release</h4>
 <ul><li><strong>AdGuard over HTTPS.</strong> Remote AdGuard Home instances can be reached over TLS now, with an explicit opt-in for a self-signed certificate on a private one. HTTP and strict verification stay the default, and <code>ADGUARD_INSECURE_SKIP_VERIFY=1</code> does the same for environment setups. @tam481 reported the 400 in #2167.</li><li><strong>Names from mDNS.</strong> An mDNS hostname now feeds the device type rules (#2157) and replaces a generated DHCP placeholder without touching a reservation, an alias or a manual name (#2159). TXT metadata separates products that share a service, so an LG TV and a Marantz speaker over AirPlay stop looking the same (#2158).</li><li><strong>The README lists the four languages.</strong> It still said ES/EN, which @Bann-DEV noticed in #2156.</li><li><strong>The language choice survives a strict CSP.</strong> The early bootstrap moved out of the inline script that the production policy blocks (#2173).</li><li><strong>Update history actions.</strong> Expand, collapse and download are separate controls, and the download is no longer a button inside a button (#2168).</li></ul>
@@ -97,16 +97,16 @@
 <h3>NetPulse 2.54.0</h3>
 <p>This release is about what the screen was not telling you. Four features make the panel explain more, and a batch of fixes make it stop lying in the places where it was.</p>
 <h4>Icons that name the device</h4>
-<p>Searching the icon picker by the word Fridge and the row taking the new icon</p>
+<p class="changelog-figure"><img src="https://raw.githubusercontent.com/gnacho/netpulse/v2.54.0/docs/releases/2.54.0/icon-picker.gif" alt="Searching the icon picker by the word Fridge and the row taking the new icon" loading="lazy" decoding="async" /></p>
 <p>Sixty smart-home icons in ten categories, searchable by their name in your language. A fridge stops looking like a generic box, and the search finds it by typing what it is. The catalog came from @Bann-DEV in #2107, and #2113 is the test that keeps it honest when someone adds a tile.</p>
 <h4>What each device asks for</h4>
-<p>DNS activity for one device with the 1 hour and 24 hour windows</p>
+<p class="changelog-figure"><img src="https://raw.githubusercontent.com/gnacho/netpulse/v2.54.0/docs/releases/2.54.0/dns-activity.gif" alt="DNS activity for one device with the 1 hour and 24 hour windows" loading="lazy" decoding="async" /></p>
 <p>Per-device DNS activity from the AdGuard query log: the domains a client resolves, how often, and which ones were blocked, in a one hour or one day window. It sits in the device detail, next to the client that asked. #2081 built it, and #2119 made it show something, because it was reading with a lower case MAC while the log was stored in upper case.</p>
 <h4>Quiet is not offline</h4>
-<p>A neighbour entry in STALE coming back to REACHABLE and the host staying online</p>
+<p class="changelog-figure"><img src="https://raw.githubusercontent.com/gnacho/netpulse/v2.54.0/docs/releases/2.54.0/presence.gif" alt="A neighbour entry in STALE coming back to REACHABLE and the host staying online" loading="lazy" decoding="async" /></p>
 <p>A wired host with a static address that goes quiet used to drop off the map. Now the unit pings its stale neighbour and re-reads the table, so the address and the MAC are confirmed and an idle host stays online. #2108 added the recheck, #2109 extended it to IPv6 over NDP, and #2110 sweeps the subnets a unit routes to find hosts that never left an entry at all. The report behind it is #2063.</p>
 <h4>Chinese and Russian</h4>
-<p>The same panel in English, Spanish, Chinese and Russian, with dates following each language</p>
+<p class="changelog-figure"><img src="https://raw.githubusercontent.com/gnacho/netpulse/v2.54.0/docs/releases/2.54.0/languages.gif" alt="The same panel in English, Spanish, Chinese and Russian, with dates following each language" loading="lazy" decoding="async" /></p>
 <p>The whole interface in Chinese and in Russian, catalogs complete and reviewed. Dates and numbers follow each language too, not only the labels. Chinese came in #2070, from @Bann-DEV, and Russian in #2083, from @sers88.</p>
 <h4>Also in this release</h4>
 <ul><li><strong>What's new page.</strong> The app now explains each release with animated cards, in all four languages. #2116 added it, and the dot on the version stamp stays until you open it.</li><li><strong>Traffic per client.</strong> The device detail shows down, up and total over 1 hour, 24 hours, 30 days and 12 months, with the series for the same window. @tombacchetta asked for it in #2076 and the panel answers with the per-client history the server already had.</li><li><strong>Wi-Fi clients with no IP</strong> are marked as such, and leave one info entry in the activity log after two minutes instead of looking broken. #2111 closed the request @crowedavid opened in #1984.</li><li><strong>Docker.</strong> An optional server image with the UI and the agents inside, published to GHCR on every tag for amd64 and arm64. @sers88 wrote it in #2101 and the pipeline in #2105.</li><li><strong>A smaller agent.</strong> Built without <code>encoding/json/v2</code>: 7.8 MB down to 7.4 MB on amd64, which is 5.8% less. #2096 measured it before and after.</li><li><strong>The client table</strong> rebalances its columns and uses a single line in the 2xl tier, from #2106.</li><li><strong>A quieter panel.</strong> The SNMP community field says it is read-only (#2080), the unit column is translated (#2098), the splash background follows the theme (#2099) and the landing page counts demo clicks (#2093).</li></ul>

+ 1 - 1
web/changelog.template.html

@@ -28,7 +28,7 @@
   <meta name="twitter:image" content="https://netpulse.cloudless.club/og.png" />
   <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='10' y1='78' x2='90' y2='20' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%2322D3EE'/%3E%3Cstop offset='1' stop-color='%23A78BFA'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M10 60 H27 L33 60 L40 38 L48 78 L54 48 L58 60 H64' stroke='url(%23g)' stroke-width='5.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='73' cy='60' r='6' fill='url(%23g)'/%3E%3Cpath d='M62.4 49.4 A15 15 0 0 1 83.6 49.4' stroke='url(%23g)' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M55.3 39.7 A25 25 0 0 1 90.7 39.7' stroke='url(%23g)' stroke-width='5' stroke-linecap='round' opacity='0.6'/%3E%3C/svg%3E" />
   <link rel="stylesheet" href="fonts/fonts.css" />
-  <link rel="stylesheet" href="styles.css?v=20261121a" />
+  <link rel="stylesheet" href="styles.css?v=20261127a" />
   <script src="i18n.js" defer></script>
   <script src="app.js" defer></script>
 </head>

+ 3 - 0
web/styles.css

@@ -784,6 +784,9 @@ html[dir="rtl"] .honest-list li::before { left: auto; right: 0; }
 .changelog-body ul, .changelog-body ol { margin: 0.5rem 0 0.9rem 1.2rem; }
 .changelog-body li { margin: 0.35rem 0; line-height: 1.55; }
 .changelog-body p { margin: 0.6rem 0; line-height: 1.6; }
+/* Capturas de las notas: se generan desde la app, no se recortan. */
+.changelog-figure { margin: 0.9rem 0; }
+.changelog-body img { display: block; width: 100%; max-width: 660px; height: auto; border: 1px solid rgb(var(--border)); border-radius: 10px; background: rgb(var(--surface)); }
 .changelog-body code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.9em; background: rgb(var(--surface-2, var(--surface))); padding: 0.1rem 0.3rem; border-radius: 4px; }
 .changelog-body pre { background: rgb(var(--surface-2, var(--surface))); padding: 0.75rem; border-radius: 8px; overflow-x: auto; }
 .changelog-body a { color: rgb(var(--accent)); text-decoration: underline; }