mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-06-05 07:18:48 +00:00
Merge branch 'main' into book-series-v1
This commit is contained in:
commit
b20b52af7f
8 changed files with 35 additions and 4 deletions
2
.github/workflows/black.yml
vendored
2
.github/workflows/black.yml
vendored
|
@ -13,3 +13,5 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
- uses: psf/black@22.12.0
|
- uses: psf/black@22.12.0
|
||||||
|
with:
|
||||||
|
version: 22.12.0
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
""" functionality outline for a book data connector """
|
""" functionality outline for a book data connector """
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from urllib.parse import quote_plus
|
||||||
import imghdr
|
import imghdr
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
@ -48,7 +49,7 @@ class AbstractMinimalConnector(ABC):
|
||||||
return f"{self.isbn_search_url}{normalized_query}"
|
return f"{self.isbn_search_url}{normalized_query}"
|
||||||
# NOTE: previously, we tried searching isbn and if that produces no results,
|
# NOTE: previously, we tried searching isbn and if that produces no results,
|
||||||
# searched as free text. This, instead, only searches isbn if it's isbn-y
|
# searched as free text. This, instead, only searches isbn if it's isbn-y
|
||||||
return f"{self.search_url}{query}"
|
return f"{self.search_url}{quote_plus(query)}"
|
||||||
|
|
||||||
def process_search_response(self, query, data, min_confidence):
|
def process_search_response(self, query, data, min_confidence):
|
||||||
"""Format the search results based on the formt of the query"""
|
"""Format the search results based on the formt of the query"""
|
||||||
|
|
|
@ -9,6 +9,14 @@
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
|
|
||||||
|
<div class="notification">
|
||||||
|
<p>
|
||||||
|
{% trans "You can set up monitoring to check if Celery is running by querying:" %}
|
||||||
|
{% url "settings-celery-ping" as url %}
|
||||||
|
<a href="{{ url }}" target="_blank" rel="nofollow noopener noreferrer">{{ url }}</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if queues %}
|
{% if queues %}
|
||||||
<section class="block content">
|
<section class="block content">
|
||||||
<h2>{% trans "Queues" %}</h2>
|
<h2>{% trans "Queues" %}</h2>
|
||||||
|
|
|
@ -334,6 +334,9 @@ urlpatterns = [
|
||||||
re_path(
|
re_path(
|
||||||
r"^settings/celery/?$", views.CeleryStatus.as_view(), name="settings-celery"
|
r"^settings/celery/?$", views.CeleryStatus.as_view(), name="settings-celery"
|
||||||
),
|
),
|
||||||
|
re_path(
|
||||||
|
r"^settings/celery/ping/?$", views.celery_ping, name="settings-celery-ping"
|
||||||
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^settings/email-config/?$",
|
r"^settings/email-config/?$",
|
||||||
views.EmailConfig.as_view(),
|
views.EmailConfig.as_view(),
|
||||||
|
|
|
@ -4,7 +4,7 @@ from .admin.announcements import Announcements, Announcement
|
||||||
from .admin.announcements import EditAnnouncement, delete_announcement
|
from .admin.announcements import EditAnnouncement, delete_announcement
|
||||||
from .admin.automod import AutoMod, automod_delete, run_automod
|
from .admin.automod import AutoMod, automod_delete, run_automod
|
||||||
from .admin.automod import schedule_automod_task, unschedule_automod_task
|
from .admin.automod import schedule_automod_task, unschedule_automod_task
|
||||||
from .admin.celery_status import CeleryStatus
|
from .admin.celery_status import CeleryStatus, celery_ping
|
||||||
from .admin.dashboard import Dashboard
|
from .admin.dashboard import Dashboard
|
||||||
from .admin.federation import Federation, FederatedServer
|
from .admin.federation import Federation, FederatedServer
|
||||||
from .admin.federation import AddFederatedServer, ImportServerBlocklist
|
from .admin.federation import AddFederatedServer, ImportServerBlocklist
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
""" celery status """
|
""" celery status """
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
|
from django.http import HttpResponse
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
from django.views.decorators.http import require_GET
|
||||||
import redis
|
import redis
|
||||||
|
|
||||||
from celerywyrm import settings
|
from celerywyrm import settings
|
||||||
|
@ -50,3 +52,18 @@ class CeleryStatus(View):
|
||||||
"errors": errors,
|
"errors": errors,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "settings/celery.html", data)
|
return TemplateResponse(request, "settings/celery.html", data)
|
||||||
|
|
||||||
|
|
||||||
|
@require_GET
|
||||||
|
# pylint: disable=unused-argument
|
||||||
|
def celery_ping(request):
|
||||||
|
"""Just tells you if Celery is on or not"""
|
||||||
|
try:
|
||||||
|
ping = celery.control.inspect().ping()
|
||||||
|
if ping:
|
||||||
|
return HttpResponse()
|
||||||
|
# pylint: disable=broad-except
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return HttpResponse(status=500)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
black==22.3.0
|
black==22.12.0
|
||||||
|
|
|
@ -2,7 +2,7 @@ aiohttp==3.8.3
|
||||||
bleach==5.0.1
|
bleach==5.0.1
|
||||||
celery==5.2.7
|
celery==5.2.7
|
||||||
colorthief==0.2.1
|
colorthief==0.2.1
|
||||||
Django==3.2.16
|
Django==3.2.17
|
||||||
django-celery-beat==2.4.0
|
django-celery-beat==2.4.0
|
||||||
django-compressor==4.3.1
|
django-compressor==4.3.1
|
||||||
django-imagekit==4.1.0
|
django-imagekit==4.1.0
|
||||||
|
|
Loading…
Reference in a new issue