From f3635f90b465d14262ddbb0f2cad63f9b82350f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 8 Dec 2023 04:40:46 +0100 Subject: [PATCH] Continued: - added column original_software, it contains the original software name, but without any version number or " powered by " in it --- blocks_empty.db | Bin 40960 -> 40960 bytes fba/http/federation.py | 3 +++ fba/models/instances.py | 20 ++++++++++++++++++-- templates/views/infos.html | 13 ++++++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/blocks_empty.db b/blocks_empty.db index e6c495ffffe5b885d56acc638368c8192f5cc274..dec6ada3e62839974aaa9f105364a7ed5bf80a1e 100644 GIT binary patch delta 118 zcmZoTz|?SnX@ayM8v_Fa7ZAfh;6xo`c{T<;?}@zJMGTy*?-}?bINkX*S>N;J^Vx6} zaNBd<-q={k%GDOi!Y(c^&)8GBS(}ZSSzaN(C^J1XFEJ;+I6tkVJh3QMAIsOd^TJK j-1eNeHwy|ZX60&AW?>hXmuKt|-Taf4nR&Aw=cQ=?k@yie 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']}} -- 2.39.5