Redirector domain support
All checks were successful
Build dev on push / build-redirector (push) Successful in 29s
Build dev on push / build-api (push) Successful in 29s
Build dev on push / build-web (push) Successful in 50s

This commit is contained in:
Sven Heidemann 2025-01-11 01:17:19 +01:00
parent 1001b6db5f
commit 8d99cd5ccf
5 changed files with 11 additions and 4 deletions

View File

@ -24,18 +24,18 @@ def get_value(
if key in source:
value = source[key]
if isinstance(value, cast_type):
if isinstance(value, cast_type if not hasattr(cast_type, "__origin__") else cast_type.__origin__):
return value
try:
if cast_type == bool:
return value.lower() in ["true", "1"]
if cast_type == list:
if (cast_type if not hasattr(cast_type, "__origin__") else cast_type.__origin__) == list:
subtype = (
cast_type.__args__[0] if hasattr(cast_type, "__args__") else None
)
value = ast.literal_eval(value)
value = value.split(list_delimiter)
return [
subtype(item) if subtype is not None else item for item in value
]

View File

@ -34,6 +34,11 @@ async def _handle_request(path: str):
if short_url is None:
return render_template("404.html"), 404
domains = Environment.get("DOMAINS", list[str], [])
domain = await short_url.domain
if domain is not None and domain.name not in domains:
return render_template("404.html"), 404
user_agent = request.headers.get("User-Agent", "").lower()
if "wheregoes" in user_agent or "someothertool" in user_agent:

View File

@ -1 +1 @@
1.2.0
1.2.1

View File

@ -40,6 +40,7 @@
"news": "News",
"role": "Rolle",
"save": "Speichern",
"short_url": "Url",
"updated": "Bearbeitet",
"upload": "Hochladen",
"urls": "URLs",

View File

@ -40,6 +40,7 @@
"news": "News",
"role": "Role",
"save": "Save",
"short_url": "Url",
"updated": "Updated",
"upload": "Upload",
"urls": "URLs",