Show a QR code for device-code login (text dialog fallback)#710
Open
magne4000 wants to merge 1 commit into
Open
Show a QR code for device-code login (text dialog fallback)#710magne4000 wants to merge 1 commit into
magne4000 wants to merge 1 commit into
Conversation
The device-code login now displays a scannable QR code of the Twitch activation URL alongside the short user code, so viewers can sign in by pointing their phone camera at the TV instead of typing a URL. Both the regular and the private (Turbo/ad-free) login get this, since they share do_device_login(). The QR is rendered dependency-free: a vendored QR generator (Project Nayuki, MIT) produces the module matrix and a tiny zlib-based PNG writer emits the image, so no PIL/Pillow or other binary library is required. It is shown in a lightweight WindowDialog that polls in a background thread. Anything that can go wrong with the QR path (rendering failure, an image-less skin, an exception building the window) falls back to the previous text-only DialogProgress flow, which is preserved unchanged, so login still works everywhere. Polling, slow_down handling, cancel, expiry and Kodi-shutdown behaviour are shared between both paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The device-code login now shows a scannable QR code of the Twitch activation URL alongside the short user code, so viewers can sign in with their phone camera instead of typing a URL. Both the regular and the private (Turbo/ad-free) login get it, since they share
do_device_login().How it works
WindowDialogthat polls for the token on a background thread.DialogProgressflow, which is preserved unchanged, so login still works everywhere. Polling,slow_down, cancel, expiry and Kodi-shutdown handling are shared by both paths.Changes
routes/device_login.py— QR window + shared poller, text flow kept as fallback.addon/qr.py(new) — QR→PNG rendering.addon/vendor/qrcodegen.py(new, vendored, MIT) +addon/vendor/__init__.py.#30334–#30336.Backward compatibility
Additive; no settings or stored-token changes. Falls back to the current text flow on any device where the QR window can't be shown.
New strings
#30334"Scan the QR code, or go to [B]%s[/B]"#30335"Enter this code: [B]%s[/B]"#30336"Waiting for authorization... (press Back to cancel)"Testing
Note: the vendored
qrcodegen.pyaccounts for most of the diff size.Independent of my other two PRs.