# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-from datetime import datetime
-from email import utils
-
import re
+from datetime import datetime
+from email.utils import format_datetime
from fastapi import Request, HTTPException, Query
from fastapi.responses import JSONResponse
from fastapi.responses import PlainTextResponse
"blocked" : row[1],
"block_level": row[2],
"reason" : "Provided reason: '" + row[3] + "'" if row[3] is not None and row[3] != "" else "No reason provided.",
- "first_seen" : utils.format_datetime(datetime.fromtimestamp(row[4])),
- "last_seen" : utils.format_datetime(datetime.fromtimestamp(row[5])),
+ "first_seen" : format_datetime(datetime.fromtimestamp(row[4])),
+ "last_seen" : format_datetime(datetime.fromtimestamp(row[5])),
})
return templates.TemplateResponse("rss.xml", {
"request" : request,
- "timestamp": utils.format_datetime(datetime.now()),
+ "timestamp": format_datetime(datetime.now()),
"domain" : domain,
"hostname" : config.get("hostname"),
"blocks" : blocklist
domain = item.decode_contents()
logger.debug("domain='%s'", domain)
- if not utils.is_domain_wanted(domain)
+ if not utils.is_domain_wanted(domain):
logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
continue
elif instances.is_registered(domain):
if instance == "":
logger.warning(f"Empty instance after tidyup.domain(), domain='{domain}'")
continue
- elif not utils.is_domain_wanted((instance):
+ elif not utils.is_domain_wanted(instance):
logger.debug("instance='%s' is not wanted - SKIPPED!", instance)
continue
elif instance.find("/profile/") > 0 or instance.find("/users/") > 0:
url = f"https://{domain}{url}"
components = urlparse(url)
- if not utils.is_domain_wanted((components.netloc):
+ if not utils.is_domain_wanted(components.netloc):
logger.debug("components.netloc='%s' is not wanted - SKIPPED!", components.netloc)
continue
logger.debug("domain='%s',reason='%s'", domain, reason)
- if not utils.is_domain_wanted((domain):
+ if not utils.is_domain_wanted(domain):
logger.debug("domain='%s' is blacklisted - SKIPPED!", domain)
continue
elif domain == "gab.com/.ai, develop.gab.com":
raise ValueError(f"peer[]='{type(peer)}' is not supported,key='{key}'")
logger.debug(f"peer='{peer}' - AFTER!")
- if not utils.is_domain_wanted((peer):
+ if not utils.is_domain_wanted(peer):
logger.debug("peer='%s' is not wanted - SKIPPED!", peer)
continue
reason = tidyup.reason(line.find_all("td")[1].text)
logger.debug(f"blocked='{blocked}',reason='{reason}'")
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
blocked = tidyup.domain(tag.contents[0])
logger.debug(f"blocked='{blocked}'")
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
nodeinfo_url = row[2]
logger.debug("Looking up instance by domain:", blocked)
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
instances.add(blocked, domain, inspect.currentframe().f_code.co_name, nodeinfo_url)
logger.debug("Looking up instance by domain:", blocked)
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
nodeinfo_url = row[2]
logger.debug(f"blocked='{blocked}'")
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
nodeinfo_url = row[2]
logger.debug(f"blocked='{blocked}'")
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
nodeinfo_url = row[2]
logger.debug(f"blocked='{blocked}'")
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
nodeinfo_url = row[2]
logger.debug(f"blocked='{blocked}'")
- if not utils.is_domain_wanted((blocked):
+ if not utils.is_domain_wanted(blocked):
logger.warning("blocked='%s' is not wanted - SKIPPED!", blocked)
continue
elif not instances.is_registered(blocked):
logger.debug(f"domain='{domain}' de-obscured to '{row[0]}'")
domain = row[0]
- if not is_domain_wanted(domain)
+ if not is_domain_wanted(domain):
logger.debug("domain='%s' is not wanted - SKIPPED!", domain)
return False
elif instances.is_recent(domain):