From 18cc05a2fe5c6ceae596d11146446f649bca7604 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Sun, 8 Jun 2025 14:16:12 +0100 Subject: [PATCH] allows auth_for_site to receive do.main directly --- src/auto_archiver/core/base_module.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/auto_archiver/core/base_module.py b/src/auto_archiver/core/base_module.py index bcaa59b..6461ab7 100644 --- a/src/auto_archiver/core/base_module.py +++ b/src/auto_archiver/core/base_module.py @@ -98,12 +98,11 @@ class BaseModule(ABC): """ # TODO: think about if/how we can deal with sites that have multiple domains (main one is x.com/twitter.com) # for now the user must enter them both, like "x.com,twitter.com" in their config. Maybe we just hard-code? - - site = UrlUtil.domain_for_url(site).removeprefix("www.") + domain = UrlUtil.domain_for_url(site).removeprefix("www.") # add the 'www' version of the site to the list of sites to check authdict = {} - for to_try in [site, f"www.{site}"]: + for to_try in [site, domain, f"www.{domain}"]: if to_try in self.authentication: authdict.update(self.authentication[to_try]) break @@ -111,9 +110,9 @@ class BaseModule(ABC): # do a fuzzy string match just to print a warning - don't use it since it's insecure if not authdict: for key in self.authentication.keys(): - if key in site or site in key: + if key in domain or domain in key: logger.debug( - f"Could not find exact authentication information for site '{site}'. \ + f"Could not find exact authentication information for '{domain}'. \ did find information for '{key}' which is close, is this what you meant? \ If so, edit your authentication settings to make sure it exactly matches." )