From 5d9afbd06eb2c6da27237638b12ec74ea81db479 Mon Sep 17 00:00:00 2001 From: mein Name Date: Thu, 6 Feb 2025 09:55:33 +0000 Subject: [PATCH] fix fedi item error detection --- catalog/sites/fedi.py | 4 +++- catalog/urls.py | 3 ++- docs/configuration.md | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/catalog/sites/fedi.py b/catalog/sites/fedi.py index a33a5a10..37ed1c5b 100644 --- a/catalog/sites/fedi.py +++ b/catalog/sites/fedi.py @@ -74,6 +74,7 @@ class FediverseInstance(AbstractSite): from takahe.utils import Takahe val = URLValidator() + host = None try: val(url) u = cls.url_to_id(url) @@ -85,7 +86,8 @@ class FediverseInstance(AbstractSite): return False return cls.get_json_from_url(u) is not None except Exception as e: - logger.error(f"Fedi item url validation error: {url} {e}") + if host and host in Takahe.get_neodb_peers(): + logger.error(f"Fedi item url validation error: {url} {e}") return False @classmethod diff --git a/catalog/urls.py b/catalog/urls.py index 06726ae0..9b9f7b5a 100644 --- a/catalog/urls.py +++ b/catalog/urls.py @@ -1,4 +1,5 @@ from django.urls import path, re_path +from django.views.generic import RedirectView from .models import * from .views import * @@ -157,7 +158,7 @@ urlpatterns = [ mark_list, name="mark_list", ), - path("search/", search, name="search_legacy"), + path("search/", RedirectView.as_view(url="/search", query_string=True)), path("search/external", external_search, name="external_search"), path("fetch_refresh/", fetch_refresh, name="fetch_refresh"), path("refetch", refetch, name="refetch"), diff --git a/docs/configuration.md b/docs/configuration.md index be5360fd..2f675981 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -42,7 +42,7 @@ if you are doing debug or development: ## Settings for administration - `DISCORD_WEBHOOKS` - Discord channel to send notification about user submitted suggestion and changes, e.g. `suggest=https://discord.com/api/webhooks/123/abc,audit=https://discord.com/api/webhooks/123/def`. Both suggest and audit channels must be in forum mode. - - `NEODB_SENTRY_DSN` , `TAKAHE_SENTRY_DSN` - [Sentry](https://neodb.sentry.io/) DSN to log errors. + - `NEODB_SENTRY_DSN` , `TAKAHE_SENTRY_DSN` - [Sentry](https://sentry.io/) DSN to log errors. ## Settings for Federation