]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 5 Jul 2023 21:25:25 +0000 (23:25 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 5 Jul 2023 21:25:25 +0000 (23:25 +0200)
- 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

daemon.py
fba/helpers/software.py
templates/views/scoreboard.html
templates/widgets/links.html

index 85aa1f9880e6968905b5980d1d53aa77743405e0..84d7832eee6cb48b98896a27ee57564eac40a46c 100755 (executable)
--- 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()
index 89a38948c0e48fc1d3375edf9be24b71aef6ed19..266a6ddc9d42fa874820fcd143d0c5d62f565708 100644 (file)
@@ -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
index d727ac6cc334b2d1010ebb4ed3283b3db949db1e..a1d9cc11ca44ff2955a5700ffccf7a1620f2d93e 100644 (file)
                 <tr>
                     <td>{{loop.index}}</td>
                     <td>
-                        {% 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' %}
                             <a href="top?mode={{mode}}&amp;value={{entry['domain']}}&amp;amount=50">{{entry['domain']}}</a>
-                        {% elif mode == 'detection_mode' %}
+                        {% elif mode in ('software', 'detection_mode') %}
                             <a href="list?mode={{mode}}&amp;value={{entry['domain']}}&amp;amount=50">{{entry['domain']}}</a>
                         {% else %}
                             {% with domain=entry['domain'] %}
index e058c2e5da212dd299790aa2ee2f3eb99997daee..4497cd1fde856239e77a1d7a77fa12a33c0f07be 100644 (file)
@@ -1,4 +1,8 @@
-[<a class="listlink" href="top?mode=domain&amp;value={{domain}}" title="Search {{domain}}">D</a>]
-[<a class="listlink" href="top?mode=reverse&amp;value={{domain}}" title="Reverse search {{domain}}">R</a>]
-[<a class="listlink" href="infos?domain={{domain}}" title="Information on domain {{domain}}">I</a>]
-<a href="https://{{domain}}" rel="nofollow noopener noreferrer">{{domain}}</a>
+{% if domain != None %}
+    [<a class="listlink" href="top?mode=domain&amp;value={{domain}}" title="Search {{domain}}">D</a>]
+    [<a class="listlink" href="top?mode=reverse&amp;value={{domain}}" title="Reverse search {{domain}}">R</a>]
+    [<a class="listlink" href="infos?domain={{domain}}" title="Information on domain {{domain}}">I</a>]
+    <a href="https://{{domain}}" rel="nofollow noopener noreferrer">{{domain}}</a>
+{% else %}
+    -
+{% endif %}