Show compact changelog in update dialog, strip sub-items and long descriptions

Only top-level list items are shown in the updater changelog.
Indented sub-items, headings, and long descriptions are removed
for a clean, compact display. Detailed notes remain on the
Gitea release page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-05 03:02:41 +01:00
parent 2a528a126c
commit 12dade0240
2 changed files with 33 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{
"name": "real-debrid-downloader",
"version": "1.6.42",
"version": "1.6.43",
"description": "Desktop downloader",
"main": "build/main/main/main.js",
"author": "Sucukdeluxe",

View File

@ -1001,18 +1001,39 @@ export function App(): ReactElement {
}
let changelogBlock = "";
if (result.releaseNotes) {
// Strip markdown formatting for plain-text confirm dialog
let notes = result.releaseNotes
.replace(/^#{1,6}\s+/gm, "") // ## headings
.replace(/\*\*([^*]+)\*\*/g, "$1") // **bold**
.replace(/\*([^*]+)\*/g, "$1") // *italic*
.replace(/`([^`]+)`/g, "$1") // `code`
.replace(/^\s*[-*]\s+/gm, "- ") // normalize list bullets
.replace(/\n{3,}/g, "\n\n") // collapse excess blank lines
// Build compact changelog: only top-level list items, no sub-items or long descriptions
const lines = result.releaseNotes.split("\n");
const compactLines: string[] = [];
for (const line of lines) {
// Skip indented sub-items (2+ spaces before dash)
if (/^\s{2,}[-*]/.test(line)) continue;
// Skip heading markers
if (/^#{1,6}\s/.test(line)) continue;
// Skip empty lines
if (!line.trim()) continue;
// Strip markdown: **bold**, *italic*, `code`
let clean = line
.replace(/\*\*([^*]+)\*\*/g, "$1")
.replace(/\*([^*]+)\*/g, "$1")
.replace(/`([^`]+)`/g, "$1")
.replace(/^\s*[-*]\s+/, "- ")
.trim();
if (notes.length > 500) notes = `${notes.slice(0, 500)}`;
// Truncate long lines after the first colon/sentence
const colonIdx = clean.indexOf(":");
if (colonIdx > 0 && colonIdx < clean.length - 1) {
const afterColon = clean.slice(colonIdx + 1).trim();
// Keep short descriptions, cut long ones
if (afterColon.length > 60) {
clean = clean.slice(0, colonIdx + 1).trim();
}
}
if (clean) compactLines.push(clean);
}
const notes = compactLines.join("\n");
if (notes) {
changelogBlock = `\n\n--- Changelog ---\n${notes}`;
}
}
const approved = await askConfirmPrompt({
title: "Update verfügbar",
message: `${result.latestTag} (aktuell v${result.currentVersion})${changelogBlock}\n\nJetzt automatisch herunterladen und installieren?`,