From 06c796807005e823e06008009dd4253a702ae4ac Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 9 Apr 2023 13:35:13 +0700 Subject: [PATCH] fix silly host_clean and direct access TA_PASSWORD --- tubearchivist/config/settings.py | 2 +- tubearchivist/home/src/ta/helper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tubearchivist/config/settings.py b/tubearchivist/config/settings.py index 436f659..cf92db6 100644 --- a/tubearchivist/config/settings.py +++ b/tubearchivist/config/settings.py @@ -27,7 +27,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ -PW_HASH = hashlib.sha256(environ.get("TA_PASSWORD").encode()) +PW_HASH = hashlib.sha256(environ["TA_PASSWORD"].encode()) SECRET_KEY = PW_HASH.hexdigest() # SECURITY WARNING: don't run with debug turned on in production! diff --git a/tubearchivist/home/src/ta/helper.py b/tubearchivist/home/src/ta/helper.py index 2a9a95f..1fdf15a 100644 --- a/tubearchivist/home/src/ta/helper.py +++ b/tubearchivist/home/src/ta/helper.py @@ -156,7 +156,7 @@ def ta_host_parser(ta_host): for host in ta_host.split(): host_clean = host.strip() if not host_clean.startswith("http"): - host_clean = f"http://{host}" + host_clean = f"http://{host_clean}" parsed = urlparse(host_clean) allowed_hosts.append(f"{parsed.hostname}")