]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 13 Aug 2023 18:03:59 +0000 (20:03 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 13 Aug 2023 18:03:59 +0000 (20:03 +0200)
- switched: PLATFORM before GENERATOR, the last one can be "personalized"

fba/helpers/version.py
fba/http/federation.py
templates/views/scoreboard.html

index 1396b4e27cb444948cffc9a6ccac0cdcda62b543..5dda159b280b2f55d08785c8ba7d332a587a6656 100644 (file)
@@ -16,6 +16,8 @@
 import logging
 import re
 
+from fba.helpers import software as software_helper
+
 logging.basicConfig(level=logging.INFO)
 logger = logging.getLogger(__name__)
 
@@ -80,7 +82,7 @@ def remove(software: str) -> str:
     software = temp[0:end].strip()
     if " version" in software:
         logger.debug("software='%s' contains word ' version'", software)
-        software = strip_until(software, " version")
+        software = software_helper.strip_until(software, " version")
 
     logger.debug("software='%s' - EXIT!", software)
     return software
index 9b3bc2a168997ca103c130e7a8fb212107e21730..40564e338130d6c51b4664e53c64fad92247e283 100644 (file)
@@ -268,15 +268,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
         platform  = doc.find("meta", {"property": "og:platform"})
 
         logger.debug("generator[]='%s',site_name[]='%s',platform[]='%s'", type(generator), type(site_name), type(platform))
-        if isinstance(generator, bs4.element.Tag) and isinstance(generator.get("content"), str):
-            logger.debug("Found generator meta tag: domain='%s'", domain)
-            software = tidyup.domain(generator.get("content"))
-
-            logger.debug("software[%s]='%s'", type(software), software)
-            if software is not None and software != "":
-                logger.info("domain='%s' is generated by software='%s' - Setting detection_mode=GENERATOR ...", domain, software)
-                instances.set_detection_mode(domain, "GENERATOR")
-        elif isinstance(platform, bs4.element.Tag) and isinstance(platform.get("content"), str):
+        if isinstance(platform, bs4.element.Tag) and isinstance(platform.get("content"), str):
             logger.debug("Found property=og:platform, domain='%s'", domain)
             software = tidyup.domain(platform.get("content"))
 
@@ -284,6 +276,14 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str:
             if software is not None and software != "":
                 logger.debug("domain='%s' has og:platform='%s' - Setting detection_mode=PLATFORM ...", domain, software)
                 instances.set_detection_mode(domain, "PLATFORM")
+        elif isinstance(generator, bs4.element.Tag) and isinstance(generator.get("content"), str):
+            logger.debug("Found generator meta tag: domain='%s'", domain)
+            software = tidyup.domain(generator.get("content"))
+
+            logger.debug("software[%s]='%s'", type(software), software)
+            if software is not None and software != "":
+                logger.info("domain='%s' is generated by software='%s' - Setting detection_mode=GENERATOR ...", domain, software)
+                instances.set_detection_mode(domain, "GENERATOR")
         elif isinstance(site_name, bs4.element.Tag) and isinstance(site_name.get("content"), str):
             logger.debug("Found property=og:site_name, domain='%s'", domain)
             software = tidyup.domain(site_name.get("content"))
index 034c4052f2b55cf1b03d26903d179e3a77159e13..7f92de0f250191c000eebe75f14d17a6816c57aa 100644 (file)
@@ -85,8 +85,8 @@
             <ol>
                 <li><b>AUTO_DISCOVERY</b>: <code>/.well-known/nodeinfo</code> was reachable and software type was found in nodeinfo response</li>
                 <li><b>STATIC_CHECK</b>: Node information was found by probing for well-known URLs</li>
-                <li><b>GENERATOR</b>: Meta data <code>generator</code> was found in HTML code</li>
                 <li><b>PLATFORM</b>: Meta data <code>og:platform</code> was found in HTML code</li>
+                <li><b>GENERATOR</b>: Meta data <code>generator</code> was found in HTML code</li>
                 <li><b>SITE_NAME</b>: Meta data <code>og:site_name</code> was found in HTML code</li>
                 <li><b>None</b>: the instance was not reachable or the used software was not stated</li>
             </ol>