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:
parent
2a528a126c
commit
12dade0240
@ -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",
|
||||||
|
|||||||
@ -1001,17 +1001,38 @@ 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;
|
||||||
.trim();
|
// Skip empty lines
|
||||||
if (notes.length > 500) notes = `${notes.slice(0, 500)}…`;
|
if (!line.trim()) continue;
|
||||||
changelogBlock = `\n\n--- Changelog ---\n${notes}`;
|
// Strip markdown: **bold**, *italic*, `code`
|
||||||
|
let clean = line
|
||||||
|
.replace(/\*\*([^*]+)\*\*/g, "$1")
|
||||||
|
.replace(/\*([^*]+)\*/g, "$1")
|
||||||
|
.replace(/`([^`]+)`/g, "$1")
|
||||||
|
.replace(/^\s*[-*]\s+/, "- ")
|
||||||
|
.trim();
|
||||||
|
// 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({
|
const approved = await askConfirmPrompt({
|
||||||
title: "Update verfügbar",
|
title: "Update verfügbar",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user