From bb08f63a9f75a30c44d424b9fd1a49a36da3f0e2 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 7 May 2026 19:06:05 +0200 Subject: [PATCH] Improved releases page rendering --- RNS/Utilities/rngit/pages.py | 10 +++++++--- RNS/Utilities/rngit/server.py | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/RNS/Utilities/rngit/pages.py b/RNS/Utilities/rngit/pages.py index 82a092fe..3615eb69 100644 --- a/RNS/Utilities/rngit/pages.py +++ b/RNS/Utilities/rngit/pages.py @@ -1180,15 +1180,19 @@ class NomadNetworkNode(): created_ts = rel.get("created", 0) date_str = time.strftime("%Y-%m-%d", time.localtime(created_ts)) if created_ts else "unknown" artifacts = rel.get("artifacts", 0) - preview = rel.get("preview", "")[:256] - if len(rel.get("preview", "")) > len(preview): preview += "…" + rel_format = rel.get("format", "markdown") + preview = rel.get("preview", "").splitlines()[0][:2048] + if len(rel.get("preview", "").splitlines()[0]) > len(preview): preview += "…" link = self.m_link(tag, self.PATH_RELEASE, g=group_name, r=repo_name, t=tag) sep = self.icon("sep") artifacts_str = f"`*{artifacts} artifact{'s' if artifacts != 1 else ''}`*" content_parts.append(f"{link} {self.CLR_DIM}{date_str} {sep} {artifacts_str}`f\n") - if preview: content_parts.append(f"{self.m_escape(preview)}\n") + if preview: + if rel_format == "markdown": content_parts.append(f"{self.mdc.format_block(preview)}\n") + elif rel_format == "micron": content_parts.append(f"{preview}\n") + else: content_parts.append(f"{self.m_escape(preview)}\n") content_parts.append("\n") self.owner.view_succeeded(group_name, repo_name, remote_identity) diff --git a/RNS/Utilities/rngit/server.py b/RNS/Utilities/rngit/server.py index cd9758db..b2527341 100644 --- a/RNS/Utilities/rngit/server.py +++ b/RNS/Utilities/rngit/server.py @@ -1581,7 +1581,7 @@ class ReticulumGitNode(): group = self.groups[group_name] for entry in os.listdir(group_path): path = f"{group_path}/{entry}" - if os.path.isdir(path): + if os.path.isdir(path) and not path.endswith(".work") and not path.endswith(".releases"): if not self.__is_git_repository(path): RNS.log(f"The directory \"{path}\" is not a git repository, skipping", RNS.LOG_WARNING) else: if not self.__is_bare_repository(path): @@ -2006,19 +2006,28 @@ class ReticulumGitNode(): "created_by": meta.get("created_by", "") } notes_preview = "" - for notes_file in ["RELEASE.md", "RELEASE.mu"]: + notes_format = "markdown" + for notes_file in ["RELEASE.md", "RELEASE.mu", "RELEASE.txt"]: notes_path = os.path.join(release_dir, notes_file) if os.path.isfile(notes_path): try: with open(notes_path, "r", encoding="utf-8") as f: - first_line = f.readline().strip() - if first_line.startswith("#"): first_line = first_line.lstrip("#").strip() - notes_preview = first_line[:256] + notes_full = f.read() + notes_preview = "" + for line in notes_full.splitlines(): + if not line.startswith("#") and not line.startswith(">"): + notes_preview += f"{line}\n" + + notes_preview = notes_preview.strip() + + if notes_path.endswith(".mu"): notes_format = "micron" + elif notes_path.endswith(".txt"): notes_format = "text" except Exception: pass break release_info["preview"] = notes_preview + release_info["format"] = notes_format artifacts_dir = os.path.join(release_dir, "artifacts") if os.path.isdir(artifacts_dir):