From db85a925446ab8082ead1e84d13d2fcf57603e83 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 13 Nov 2026 11:37:36 +0100 Subject: [PATCH 1/5] Up forms builder --- requirements/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index cbcc31b17..92fb217dc 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -23,7 +23,7 @@ django-admin-ordering==0.22 django-countries==9.1.0 -django-forms-builder @ git+https://github.com/rczajka/django-forms-builder@6533f9442f004d44ed362202b6bdab82b73dd5e9 +django-forms-builder @ git+https://github.com/rczajka/django-forms-builder@8364d3d1d460e015b045705cfbc87019e8d8a620 oauthlib==4.0.1 -- 2.20.1 From 5707b617718c2a5c9bc97e90aff2d38a4717528d Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 17 Nov 2026 11:37:43 +0100 Subject: [PATCH 2/5] bugfix for Django 5: QuerySet in FilteredRelation --- src/catalogue/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 8d32e64ee..b8f42b1e6 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -73,7 +73,7 @@ def differentiate_tags(request, tags, ambiguous_slugs): ) -from django.db.models import FilteredRelation, Q +from django.db.models import Q from django.views.decorators.cache import cache_control from django.views.decorators.vary import vary_on_headers from django.utils.decorators import method_decorator @@ -187,10 +187,8 @@ class BookList(ObjectListView): Q(text__icontains=term) ).distinct() else: - qs = qs.annotate( - meta=FilteredRelation('tag_relations', condition=Q(tag_relations__in=meta_rels)) - ) - qs = qs.filter(Q(title__icontains=term) | Q(meta__tag__name_pl__icontains=term)).distinct() + rels = meta_rels.filter(tag__name_pl__icontains=term) + qs = qs.filter(Q(title__icontains=term) | Q(tag_relations__in=rels)).distinct() return qs -- 2.20.1 From 1aa23677658744856f96a31492487683dcd80ca5 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 17 Nov 2026 12:16:39 +0100 Subject: [PATCH 3/5] Paypal fix --- src/paypal/rest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/paypal/rest.py b/src/paypal/rest.py index a5e7ebeee..cf80b46e1 100644 --- a/src/paypal/rest.py +++ b/src/paypal/rest.py @@ -1,12 +1,12 @@ # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # -from datetime import date, datetime, timedelta +from datetime import date, datetime, timedelta, timezone from decimal import Decimal import paypalrestsdk from django.contrib.sites.models import Site from django.urls import reverse -from django.utils import timezone +from django.utils.timezone import now from django.conf import settings from .models import BillingPlan, BillingAgreement @@ -69,7 +69,7 @@ def create_agreement(amount, key, app=False): plan_id = create_plan(amount) else: plan_id = plan.plan_id - start = (timezone.now() + timedelta(0, 3600*24)).astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ') + start = (now() + timedelta(0, 3600*24)).astimezone(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ') billing_agreement = paypalrestsdk.BillingAgreement({ "name": "Subskrypcja klubu WL", "description": "Stałe wsparcie Wolnych Lektur kwotą %s złotych" % amount, -- 2.20.1 From 7193ffdc9dab1b70030c491b972d972ee32c0abe Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 23 Nov 2026 14:07:54 +0100 Subject: [PATCH 4/5] Missing well-known files --- Dockerfile | 7 ++++--- docker-compose.yml | 4 ++-- scripts/{ => nginx}/nginx.conf | 8 +++++--- .../nginx/well-known/apple-app-site-association | 13 +++++++++++++ scripts/nginx/well-known/assetlinks.json | 14 ++++++++++++++ scripts/{ => postgres}/fold_hunspell.py | 0 scripts/{ => postgres}/postgres-polish.sql | 0 7 files changed, 38 insertions(+), 8 deletions(-) rename scripts/{ => nginx}/nginx.conf (93%) create mode 100644 scripts/nginx/well-known/apple-app-site-association create mode 100644 scripts/nginx/well-known/assetlinks.json rename scripts/{ => postgres}/fold_hunspell.py (100%) rename scripts/{ => postgres}/postgres-polish.sql (100%) diff --git a/Dockerfile b/Dockerfile index d9a71d9b0..1722739a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -111,7 +111,8 @@ FROM nginx:alpine AS nginx ARG UID ARG GID -# COPY nginx.conf conf.d/... +COPY scripts/nginx/nginx.conf /etc/nginx/conf.d/default.conf +COPY scripts/nginx/well-known /app/.well-known RUN addgroup -g $GID app && addgroup nginx app COPY --from=static-builder /app/var/static /app/var/static @@ -129,7 +130,7 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends hunspell-pl \ && rm -rf /var/lib/apt/lists/* -COPY scripts/fold_hunspell.py /usr/local/bin/fold_hunspell.py +COPY scripts/postgres/fold_hunspell.py /usr/local/bin/fold_hunspell.py RUN set -eu; \ mkdir /out; cd /tmp; \ @@ -152,7 +153,7 @@ COPY --from=polish-dict /out/ /tmp/polish-dict/ RUN mv /tmp/polish-dict/* "/usr/share/postgresql/$PG_MAJOR/tsearch_data/" \ && rmdir /tmp/polish-dict -COPY scripts/postgres-polish.sql /docker-entrypoint-initdb.d/10-postgres-polish.sql +COPY scripts/postgres/postgres-polish.sql /docker-entrypoint-initdb.d/10-postgres-polish.sql ########## diff --git a/docker-compose.yml b/docker-compose.yml index afa178665..025589fe5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: command: python -Wall ./manage.py runserver 0.0.0.0:8000 ports: # Dev: use http://localhost:8000/ directly - - "127.0.0.1:8000:8000" + - "8000:8000" celery: <<: *app-base @@ -65,7 +65,7 @@ services: - "127.0.0.1:8101:80" volumes: - ./var/media:/app/var/media:ro - - ./scripts/nginx.conf:/etc/nginx/conf.d/default.conf:ro + - ./scripts/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - web diff --git a/scripts/nginx.conf b/scripts/nginx/nginx.conf similarity index 93% rename from scripts/nginx.conf rename to scripts/nginx/nginx.conf index 561a5d4e4..a34ef5575 100644 --- a/scripts/nginx.conf +++ b/scripts/nginx/nginx.conf @@ -9,20 +9,22 @@ server { proxy_buffers 16 16k; proxy_buffer_size 32k; + root /app/var; + + location /.well-known/ {} + location /static/ { - root /app/var; expires 30d; } location /media/ { - root /app/var; expires 30d; } location ~ ^/media/.*\.(mp3|ogg|daisy\.zip)$ { add_header Content-Disposition "attachment"; } location ~ ^/media/.*\.txt$ { - add_header Content-Type "text/plain; charset=utf-8"; + charset utf-8; } location ~ ^/media/book/(pdf|epub|mobi|fb2|cover|xml)/ { # kill cache diff --git a/scripts/nginx/well-known/apple-app-site-association b/scripts/nginx/well-known/apple-app-site-association new file mode 100644 index 000000000..afeaa3e14 --- /dev/null +++ b/scripts/nginx/well-known/apple-app-site-association @@ -0,0 +1,13 @@ +{ + "applinks": { + "apps": [], + "details": [ + { + "appID": "WX9PLY5GYU.pl.app.wolnelektury", + "paths": [ + "/*" + ] + } + ] + } +} \ No newline at end of file diff --git a/scripts/nginx/well-known/assetlinks.json b/scripts/nginx/well-known/assetlinks.json new file mode 100644 index 000000000..9154b21b1 --- /dev/null +++ b/scripts/nginx/well-known/assetlinks.json @@ -0,0 +1,14 @@ +[ + { + "relation": [ + "delegate_permission/common.handle_all_urls" + ], + "target": { + "namespace": "android_app", + "package_name": "pl.app.wolnelektury", + "sha256_cert_fingerprints": [ + "4F:5E:3E:70:18:02:00:AF:7F:91:93:65:DC:55:B1:2D:81:C8:DF:62:9C:22:00:C3:D8:52:33:DF:41:E5:2C:BF" + ] + } + } +] diff --git a/scripts/fold_hunspell.py b/scripts/postgres/fold_hunspell.py similarity index 100% rename from scripts/fold_hunspell.py rename to scripts/postgres/fold_hunspell.py diff --git a/scripts/postgres-polish.sql b/scripts/postgres/postgres-polish.sql similarity index 100% rename from scripts/postgres-polish.sql rename to scripts/postgres/postgres-polish.sql -- 2.20.1 From 7956a3378cddda6f12b225e483d3c2281c9db154 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 23 Nov 2026 14:13:07 +0100 Subject: [PATCH 5/5] fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1722739a6..4264e9d7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -112,7 +112,7 @@ ARG UID ARG GID COPY scripts/nginx/nginx.conf /etc/nginx/conf.d/default.conf -COPY scripts/nginx/well-known /app/.well-known +COPY scripts/nginx/well-known /app/var/.well-known RUN addgroup -g $GID app && addgroup nginx app COPY --from=static-builder /app/var/static /app/var/static -- 2.20.1