diff --git a/lib/streaming_providers/base/ui/qr_generator.py b/lib/streaming_providers/base/ui/qr_generator.py index e1d9506..1194f8f 100644 --- a/lib/streaming_providers/base/ui/qr_generator.py +++ b/lib/streaming_providers/base/ui/qr_generator.py @@ -43,9 +43,10 @@ def generate_qr_code_png(data: str, size: int = 512) -> Optional[bytes]: # Generate image using pure Python PNG backend img = qr.make_image(image_factory=PyPNGImage, fill_color="black", back_color="white") - # Convert to PNG bytes + # Convert to PNG bytes. PyPNGImage.save() always writes PNG and does + # not accept a `format` kwarg (unlike PIL), so it must be omitted here. buffer = io.BytesIO() - img.save(buffer, format="PNG") + img.save(buffer) png_data = buffer.getvalue() return png_data diff --git a/requirements.txt b/requirements.txt index a4641c5..dbb4ffb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,6 +17,12 @@ requests~=2.32.5 Unidecode~=1.3.7 PyYAML~=6.0.3 +# QR-code login (magenta2 SAM3 remote login). pypng provides qrcode's pure +# Python PNG backend so no Pillow/system image libs are required in the +# standalone/Docker runtime. +qrcode>=7.4 +pypng>=0.0.21 + # Optional but recommended aiohttp>=3.8.5 cryptography>=41.0.4