mirror of
https://github.com/nirvana-7777/script.service.ultimate.git
synced 2026-10-07 00:12:29 +02:00
Fix QR code generation: omit format kwarg for pure PNG backend, add qrcode/pypng deps
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user