Added fork and mirror sync time to repo pages

This commit is contained in:
Mark Qvist
2026-05-17 21:14:26 +02:00
parent c83b71f49a
commit 15f2d1635e
2 changed files with 16 additions and 4 deletions
+4 -1
View File
@@ -457,10 +457,13 @@ class NomadNetworkNode():
source_link = f"{mu_link}"
except Exception as e: source_link = ""
synced_ago = max(0, time.time()-self.owner.last_upstream_sync(repo["path"]))
sync_time = RNS.prettytime(synced_ago, compact=True).split(" ")[0]
sync_str = f" `*{self.CLR_DIM_H}synced {sync_time} ago`f`*\n"
source_desc = f"{source_type}ed from"
source_indent = " "*(len(f"Node / {group_name} / {repo_name}")-len(source_desc))
if source_link: source_url = source_link
nav_parts.append(f"{self.CLR_DIM}{source_desc.capitalize()}{source_indent} {source_url}`f\n")
nav_parts.append(f"{self.CLR_DIM}{source_desc.capitalize()}{source_indent} {source_url}`f{sync_str}\n")
if not repo:
content = self.m_heading("Not Found", 1) + "\nThe requested repository was not found.\n"
+12 -3
View File
@@ -1927,8 +1927,13 @@ class ReticulumGitNode():
RNS.log(f"Failed to sync fork {group_name}/{repository_name} from {source_url}: {result.stderr}", RNS.LOG_ERROR)
return False
RNS.log(f"Fork {group_name}/{repository_name} synced successfully from {source_url}", RNS.LOG_INFO)
return True
if self.__set_mirror_synced(repository_path):
RNS.log(f"Fork {group_name}/{repository_name} synced successfully from {source_url}", RNS.LOG_INFO)
return True
else:
RNS.log(f"Fork synced but could not update sync timestamp for {group_name}/{repository_name}", RNS.LOG_WARNING)
return True
except Exception as e:
RNS.log(f"Error syncing fork {group_name}/{repository_name}: {e}", RNS.LOG_ERROR)
@@ -2505,6 +2510,10 @@ class ReticulumGitNode():
except: return False
def last_upstream_sync(self, path):
sync_time = self.__mirror_synced(path)
return sync_time if sync_time else 0
######################
# Connectivity Setup #
@@ -2958,7 +2967,7 @@ class ReticulumGitNode():
RNS.log(f"Failed to set rngit.upstream.source config: {result.stderr}", RNS.LOG_WARNING)
return self.RES_REMOTE_FAIL.to_bytes(1, "big") + f"Failed to configure repository upstream source: {result.stderr}".encode("utf-8")
if repo_type == "mirror":
if repo_type in ["mirror", "fork"]:
if not self.__set_mirror_synced(repo_temp_path):
RNS.log(f"Failed to set rngit.upstream.sync config: {result.stderr}", RNS.LOG_WARNING)
return self.RES_REMOTE_FAIL.to_bytes(1, "big") + f"Failed to configure repository type: {result.stderr}".encode("utf-8")