From: Roland Häder Date: Fri, 8 Dec 2023 03:40:46 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f3635f90b465d14262ddbb0f2cad63f9b82350f2;p=fba.git Continued: - added column original_software, it contains the original software name, but without any version number or " powered by " in it --- diff --git a/blocks_empty.db b/blocks_empty.db index e6c495f..dec6ada 100644 Binary files a/blocks_empty.db and b/blocks_empty.db differ diff --git a/fba/http/federation.py b/fba/http/federation.py index eab7df3..2cb50f4 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -451,6 +451,9 @@ def determine_software(domain: str, path: str = None) -> str: logger.debug("Returning None - EXIT!") return None + logger.debug("Setting original software='%s' ...", software) + instances.set_original_software(domain, software) + logger.debug("software='%s'- BEFORE!", software) software = software_helper.alias(software) logger.debug("software['%s']='%s' - AFTER!", type(software), software) diff --git a/fba/models/instances.py b/fba/models/instances.py index 67a5c16..619d05b 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -70,7 +70,9 @@ _pending = { "last_error_details" : {}, # Wether obfuscation has been used "has_obfuscation" : {}, - # Determined software + # Original software + "original_software" : {}, + # Aliased software "software" : {}, } @@ -510,6 +512,20 @@ def set_has_obfuscation(domain: str, status: bool): _set_data("has_obfuscation", domain, status) logger.debug("EXIT!") +def set_original_software(domain: str, software: str): + logger.debug("domain='%s',software='%s' - CALLED!", domain, software) + domain_helper.raise_on(domain) + + if not isinstance(software, str) and software is not None: + raise ValueError(f"Parameter software[]='{type(software)}' is not of type 'str'") + elif software == "": + raise ValueError("Parameter 'software' is empty") + + # Set original software + _set_data("original_software", domain, software) + logger.debug("EXIT!") + + def set_software(domain: str, software: str): logger.debug("domain='%s',software='%s' - CALLED!", domain, software) domain_helper.raise_on(domain) @@ -519,7 +535,7 @@ def set_software(domain: str, software: str): elif software == "": raise ValueError("Parameter 'software' is empty") - # Set timestamp + # Set software (maybe aliased to generic name) _set_data("software", domain, software) logger.debug("EXIT!") diff --git a/templates/views/infos.html b/templates/views/infos.html index 274360f..776c6f5 100644 --- a/templates/views/infos.html +++ b/templates/views/infos.html @@ -25,7 +25,18 @@ - Software: + Original software: + + {% if instance['original_software'] != None %} + {{instance['original_software']}} + {% else %} + - + {% endif %} + + + + + Aliased software: {% if instance['software'] != None %} {{instance['software']}}