From 3b76bc604b9d08cea557d315b4c59bca0486a4ae Mon Sep 17 00:00:00 2001 From: bbhtt Date: Thu, 8 Aug 2024 18:25:39 +0530 Subject: [PATCH] Add support for sourcehut pages in rDNS check --- flatpak_builder_lint/domainutils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flatpak_builder_lint/domainutils.py b/flatpak_builder_lint/domainutils.py index 7f076ceb..09f44236 100644 --- a/flatpak_builder_lint/domainutils.py +++ b/flatpak_builder_lint/domainutils.py @@ -16,6 +16,7 @@ "net.sourceforge.", "org.gnome.gitlab.", "org.freedesktop.gitlab.", + "site.srht.", ) REQUEST_TIMEOUT = (120.05, None) @@ -146,6 +147,16 @@ def get_proj_url(appid: str) -> str | None: # not case-sensitive url = f"sourceforge.net/projects/{second_cpt}/".lower() + if appid.startswith("site.srht."): + second_cpt = demangle(appid.split(".")[2]) + if appid.count(".") == 3: + third_cpt = appid.split(".")[3] + # needs root path "/" otherwise HTTP 308 + url = f"sr.ht/~{second_cpt}/{third_cpt}/" + else: + third_cpt = demangle(appid.split(".")[3]) + url = f"sr.ht/~{second_cpt}/{third_cpt}/" + # not case-sensitive -> lower elif appid.startswith("io.github."): second_cpt = demangle(appid.split(".")[2])