diff --git a/api/src/core/get_value.py b/api/src/core/get_value.py index 8aac73c..89974ae 100644 --- a/api/src/core/get_value.py +++ b/api/src/core/get_value.py @@ -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 ] diff --git a/api/src/redirector.py b/api/src/redirector.py index ad0398e..1f81f54 100644 --- a/api/src/redirector.py +++ b/api/src/redirector.py @@ -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: diff --git a/version.txt b/version.txt index 867e524..cb174d5 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2.0 \ No newline at end of file +1.2.1 \ No newline at end of file diff --git a/web/src/assets/i18n/de.json b/web/src/assets/i18n/de.json index 63315f2..6d40c4a 100644 --- a/web/src/assets/i18n/de.json +++ b/web/src/assets/i18n/de.json @@ -40,6 +40,7 @@ "news": "News", "role": "Rolle", "save": "Speichern", + "short_url": "Url", "updated": "Bearbeitet", "upload": "Hochladen", "urls": "URLs", diff --git a/web/src/assets/i18n/en.json b/web/src/assets/i18n/en.json index 4598ba3..27c6fde 100644 --- a/web/src/assets/i18n/en.json +++ b/web/src/assets/i18n/en.json @@ -40,6 +40,7 @@ "news": "News", "role": "Role", "save": "Save", + "short_url": "Url", "updated": "Updated", "upload": "Upload", "urls": "URLs",