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", "name": "real-debrid-downloader",
"version": "1.6.42", "version": "1.6.43",
"description": "Desktop downloader", "description": "Desktop downloader",
"main": "build/main/main/main.js", "main": "build/main/main/main.js",
"author": "Sucukdeluxe", "author": "Sucukdeluxe",

View File

@ -1001,18 +1001,39 @@ export function App(): ReactElement {
} }
let changelogBlock = ""; let changelogBlock = "";
if (result.releaseNotes) { if (result.releaseNotes) {
// Strip markdown formatting for plain-text confirm dialog // Build compact changelog: only top-level list items, no sub-items or long descriptions
let notes = result.releaseNotes const lines = result.releaseNotes.split("\n");
.replace(/^#{1,6}\s+/gm, "") // ## headings const compactLines: string[] = [];
.replace(/\*\*([^*]+)\*\*/g, "$1") // **bold** for (const line of lines) {
.replace(/\*([^*]+)\*/g, "$1") // *italic* // Skip indented sub-items (2+ spaces before dash)
.replace(/`([^`]+)`/g, "$1") // `code` if (/^\s{2,}[-*]/.test(line)) continue;
.replace(/^\s*[-*]\s+/gm, "- ") // normalize list bullets // Skip heading markers
.replace(/\n{3,}/g, "\n\n") // collapse excess blank lines 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(); .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}`; changelogBlock = `\n\n--- Changelog ---\n${notes}`;
} }
}
const approved = await askConfirmPrompt({ const approved = await askConfirmPrompt({
title: "Update verfügbar", title: "Update verfügbar",
message: `${result.latestTag} (aktuell v${result.currentVersion})${changelogBlock}\n\nJetzt automatisch herunterladen und installieren?`, message: `${result.latestTag} (aktuell v${result.currentVersion})${changelogBlock}\n\nJetzt automatisch herunterladen und installieren?`,