Added domain strict mode & reset versioning
This commit is contained in:
parent
b71b68d2c3
commit
f87b60f128
@ -36,12 +36,14 @@ async def _handle_request(path: str):
|
|||||||
|
|
||||||
domains = Environment.get("DOMAINS", list[str], [])
|
domains = Environment.get("DOMAINS", list[str], [])
|
||||||
domain = await short_url.domain
|
domain = await short_url.domain
|
||||||
logger.debug(f"Domain: {domain}, request.host: {request.host}")
|
logger.debug(f"Domain: {domain.name if domain is not None else None}, request.host: {request.host}")
|
||||||
|
|
||||||
host = request.host
|
host = request.host
|
||||||
if ":" in host:
|
if ":" in host:
|
||||||
host = host.split(":")[0]
|
host = host.split(":")[0]
|
||||||
if host not in domains or domain is not None and domain.name not in domains:
|
|
||||||
|
domain_strict_mode = Environment.get("DOMAIN_STRICT_MODE", bool, False)
|
||||||
|
if domain is not None and (domain.name not in domains or (domain_strict_mode and not host.endswith(domain.name))):
|
||||||
return render_template("404.html"), 404
|
return render_template("404.html"), 404
|
||||||
|
|
||||||
user_agent = request.headers.get("User-Agent", "").lower()
|
user_agent = request.headers.get("User-Agent", "").lower()
|
||||||
|
@ -1 +1 @@
|
|||||||
1.2.3
|
1.2.0
|
Loading…
Reference in New Issue
Block a user