fixed referer ranking

This commit is contained in:
matthias@arch 2022-11-28 23:35:06 +01:00
parent 7be6e67aaf
commit 592d93c2a9
2 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,4 @@
"""Gather analytics from nginx access logs and visualize them through generated images and a generated html"""
# __package__ = 'regina'
# from db_operation import database, visualize, collect
import regina.db_operation
import regina.utility
print("running __init__.py")
from regina.db_operation import database, visualize, collect

View File

@ -321,9 +321,11 @@ def cleanup_referer(referer: str) -> str:
domain = m.groups()[1].replace(subdomains, "")
location = m.groups()[3]
assert(len(domain.split(".")) == 2)
if len(domain.split(".")) == 2: # if domain.tld
referer = domain.split(".")[0]
if not settings["referer_ranking_ignore_tld"]: referer += "." + domain.split(".")[1]
else:
referer = domain
if not settings["referer_ranking_ignore_subdomain"]: referer = subdomains + referer
if not settings["referer_ranking_ignore_subdomain"]: referer = subdomains + referer
if not settings["referer_ranking_ignore_protocol"]: referer = protocol + "://" + referer