Improved releases page rendering

This commit is contained in:
Mark Qvist
2026-05-07 19:06:05 +02:00
parent bdfad57d3f
commit bb08f63a9f
2 changed files with 21 additions and 8 deletions
+7 -3
View File
@@ -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)
+14 -5
View File
@@ -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):