diff --git a/.env.example b/.env.example index d0971660ef..1bf6d5406f 100644 --- a/.env.example +++ b/.env.example @@ -138,9 +138,9 @@ TWO_FACTOR_LOGIN_MAX_SECONDS=60 # Value should be a comma-separated list of host names. CSP_ADDITIONAL_HOSTS= -# The last number here means "megabytes" -# Increase if users are having trouble uploading BookWyrm export files. -DATA_UPLOAD_MAX_MEMORY_SIZE = (1024**2 * 100) - # Time before being logged out (in seconds) # SESSION_COOKIE_AGE=2592000 # current default: 30 days + +# Maximum allowed memory for file uploads (increase if users are having trouble +# uploading BookWyrm export files). +# DATA_UPLOAD_MAX_MEMORY_MiB=100 diff --git a/.github/workflows/django-tests.yml b/.github/workflows/django-tests.yml index 78b6e142ed..de71d9bcfc 100644 --- a/.github/workflows/django-tests.yml +++ b/.github/workflows/django-tests.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 1a641edd28..6df987aa4f 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 3811c97d38..ab8633b48c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install Dependencies run: | python -m pip install --upgrade pip diff --git a/bookwyrm/activitypub/base_activity.py b/bookwyrm/activitypub/base_activity.py index fbbc18f73e..efc9d8da2f 100644 --- a/bookwyrm/activitypub/base_activity.py +++ b/bookwyrm/activitypub/base_activity.py @@ -20,6 +20,7 @@ logger = logging.getLogger(__name__) +# pylint: disable=invalid-name TBookWyrmModel = TypeVar("TBookWyrmModel", bound=base_model.BookWyrmModel) @@ -423,6 +424,7 @@ def get_activitypub_data(url): "Date": now, "Signature": make_signature("get", sender, url, now), }, + timeout=15, ) except requests.RequestException: raise ConnectorException() diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index 8b6dcb8858..aa8edbeae9 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -3,7 +3,9 @@ from abc import ABC, abstractmethod from typing import Optional, TypedDict, Any, Callable, Union, Iterator from urllib.parse import quote_plus -import imghdr + +# pylint: disable-next=deprecated-module +import imghdr # Deprecated in 3.11 for removal in 3.13; no good alternative yet import logging import re import asyncio diff --git a/bookwyrm/isbn/isbn.py b/bookwyrm/isbn/isbn.py index 56062ff7b8..d14dc26196 100644 --- a/bookwyrm/isbn/isbn.py +++ b/bookwyrm/isbn/isbn.py @@ -26,7 +26,7 @@ class IsbnHyphenator: def update_range_message(self) -> None: """Download the range message xml file and save it locally""" - response = requests.get(self.__range_message_url) + response = requests.get(self.__range_message_url, timeout=15) with open(self.__range_file_path, "w", encoding="utf-8") as file: file.write(response.text) self.__element_tree = None diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 7f45573c92..2bb68ff857 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -446,4 +446,6 @@ # user with the same username - in which case you should change it! INSTANCE_ACTOR_USERNAME = "bookwyrm.instance.actor" -DATA_UPLOAD_MAX_MEMORY_SIZE = env.int("DATA_UPLOAD_MAX_MEMORY_SIZE", (1024**2 * 100)) +# We only allow specifying DATA_UPLOAD_MAX_MEMORY_SIZE in MiB from .env +# (note the difference in variable names). +DATA_UPLOAD_MAX_MEMORY_SIZE = env.int("DATA_UPLOAD_MAX_MEMORY_MiB", 100) << 20 diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index 6283e61c45..ced4e80061 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -36,7 +36,7 @@
{% if request.user.is_authenticated %} - {% trans "Search for a book, user, or list" as search_placeholder %} + {% trans "Search for a book, author, user, or list" as search_placeholder %} {% else %} {% trans "Search for a book" as search_placeholder %} {% endif %} diff --git a/bookwyrm/templates/preferences/export-user.html b/bookwyrm/templates/preferences/export-user.html index cd3119e3e7..955cff6561 100644 --- a/bookwyrm/templates/preferences/export-user.html +++ b/bookwyrm/templates/preferences/export-user.html @@ -14,31 +14,29 @@

{% trans "You can create an export file here. This will allow you to migrate your data to another BookWyrm account." %}

- {% blocktrans trimmed %}
-

Your file will include:

+

{% trans "Your file will include:" %}

    -
  • User profile
  • -
  • Most user settings
  • -
  • Reading goals
  • -
  • Shelves
  • -
  • Reading history
  • -
  • Book reviews
  • -
  • Statuses
  • -
  • Your own lists and saved lists
  • -
  • Which users you follow and block
  • +
  • {% trans "User profile" %}
  • +
  • {% trans "Most user settings" %}
  • +
  • {% trans "Reading goals" %}
  • +
  • {% trans "Shelves" %}
  • +
  • {% trans "Reading history" %}
  • +
  • {% trans "Book reviews" %}
  • +
  • {% trans "Statuses" %}
  • +
  • {% trans "Your own lists and saved lists" %}
  • +
  • {% trans "Which users you follow and block" %}
-

Your file will not include:

+

{% trans "Your file will not include:" %}

    -
  • Direct messages
  • -
  • Replies to your statuses
  • -
  • Groups
  • -
  • Favorites
  • +
  • {% trans "Direct messages" %}
  • +
  • {% trans "Replies to your statuses" %}
  • +
  • {% trans "Groups" %}
  • +
  • {% trans "Favorites" %}
- {% endblocktrans %}

{% trans "In your new BookWyrm account can choose what to import: you will not have to import everything that is exported." %}

@@ -49,6 +47,13 @@

Your file will not include:

{% if not site.user_exports_enabled %}

{% trans "New user exports are currently disabled." %} + {% if perms.bookwyrm.edit_instance_settings %} +
+ {% url 'settings-imports' as url %} + {% blocktrans trimmed %} + User exports settings can be changed from the Imports page in the Admin dashboard. + {% endblocktrans %} + {% endif%}

{% elif next_available %}

diff --git a/bookwyrm/templates/search/author.html b/bookwyrm/templates/search/author.html new file mode 100644 index 0000000000..d42c3b54f4 --- /dev/null +++ b/bookwyrm/templates/search/author.html @@ -0,0 +1,17 @@ +{% extends 'search/layout.html' %} + +{% block panel %} + +{% if results %} +

+{% endif %} + +{% endblock %} diff --git a/bookwyrm/templates/search/layout.html b/bookwyrm/templates/search/layout.html index 8cf47b3717..725a4f43f3 100644 --- a/bookwyrm/templates/search/layout.html +++ b/bookwyrm/templates/search/layout.html @@ -20,6 +20,7 @@