From: Roland Häder Date: Wed, 5 Jul 2023 21:25:25 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4520869112a5dd22410c0a4e036db012408e8723;p=fba.git Continued: - added "official" name 'nextcloudpi', others like 'crowncloud', 'darkcloud' are just aliases created by their owners, I don't provide them a stage in my code - provided template variable 'domain' might be None --- diff --git a/daemon.py b/daemon.py index 85aa1f9..84d7832 100755 --- a/daemon.py +++ b/daemon.py @@ -113,9 +113,13 @@ def api_index(request: Request, mode: str, value: str, amount: int): domain = wildchar = punycode = reason = None - if mode == "detection_mode": + if mode in ("detection_mode", "software"): database.cursor.execute( - f"SELECT domain, origin, software, command, total_peers, total_blocks, first_seen, last_updated FROM instances WHERE {mode} = ? LIMIT ?", [value, amount] + f"SELECT domain, origin, software, command, total_peers, total_blocks, first_seen, last_updated \ +FROM instances \ +WHERE {mode} = ? \ +ORDER BY domain \ +LIMIT ?", [value, amount] ) domainlist = database.cursor.fetchall() diff --git a/fba/helpers/software.py b/fba/helpers/software.py index 89a3894..266a6dd 100644 --- a/fba/helpers/software.py +++ b/fba/helpers/software.py @@ -43,21 +43,24 @@ def alias(software: str) -> str: elif software in ["runtube.re", "islameye"]: logger.debug("Setting peertube: software='%s'", software) software = "peertube" - elif software == "nextcloud social": + elif software in ["nextcloud social", "nextcloudpi"]: logger.debug("Setting nextcloud: software='%s'", software) software = "nextcloud" elif software.find("/") > 0: logger.warning("Spliting of slash: software='%s'", software) - software = tidyup.domain(software.split("/")[-1]) + software = software.split("/")[-1] elif software.find("|") > 0: logger.warning("Spliting of pipe: software='%s'", software) - software = tidyup.domain(software.split("|")[0]) + software = software.split("|")[0] elif "powered by" in software: logger.debug("software='%s' has 'powered by' in it", software) software = version.strip_powered_by(software) elif isinstance(software, str) and " by " in software: logger.debug("software='%s' has ' by ' in it", software) software = version.strip_until(software, " by ") + elif isinstance(software, str) and " - " in software: + logger.debug("software='%s' has ' - ' in it", software) + software = version.strip_until(software, " - ") elif isinstance(software, str) and " see " in software: logger.debug("software='%s' has ' see ' in it", software) software = version.strip_until(software, " see ") @@ -66,6 +69,9 @@ def alias(software: str) -> str: if software == "": logger.warning("tidyup.domain() left no software name behind: software='%s'", software) software = None + else: + logger.debug("software='%s' is being cleaned up further ...") + software = software.rstrip("!") logger.debug("software[%s]='%s' - EXIT!", type(software), software) return software diff --git a/templates/views/scoreboard.html b/templates/views/scoreboard.html index d727ac6..a1d9cc1 100644 --- a/templates/views/scoreboard.html +++ b/templates/views/scoreboard.html @@ -42,13 +42,13 @@ {{loop.index}} - {% if mode in ('software', 'command', 'error_code', 'avg_peers', 'obfuscator', 'obfuscation') %} + {% if mode in ('command', 'error_code', 'avg_peers', 'obfuscator', 'obfuscation') %} {{entry['domain']}} {% elif entry['domain'] == None %} - {% elif mode == 'block_level' %} {{entry['domain']}} - {% elif mode == 'detection_mode' %} + {% elif mode in ('software', 'detection_mode') %} {{entry['domain']}} {% else %} {% with domain=entry['domain'] %} diff --git a/templates/widgets/links.html b/templates/widgets/links.html index e058c2e..4497cd1 100644 --- a/templates/widgets/links.html +++ b/templates/widgets/links.html @@ -1,4 +1,8 @@ -[D] -[R] -[I] -{{domain}} +{% if domain != None %} + [D] + [R] + [I] + {{domain}} +{% else %} + - +{% endif %}