Repository navigation
chore(auth): draw the login QR code with uqr, on stderr - #163
Merged
Merged
Conversation
qrcode-terminal has had no release since 2018. Render the code from uqr's module matrix as black-on-white half blocks with a four-module quiet zone, so it scans in dark and light themes, and print it and its status lines to stderr so they stay apart from the JSON on stdout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
neoromantic
force-pushed
the
chore/replace-qrcode-terminal
branch
from
November 17, 2026 20:24
3ec5433 to
69c5f3f
Compare
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.
What and why
tg auth login-qrdrew its QR code withqrcode-terminal, which has had no release since 2018. This replaces it with uqr 0.1.3 (no dependencies) and removessrc/types/qrcode-terminal.d.ts.src/utils/qr.tsrenders uqr's module matrix as half blocks (▀ ▄ █, two module rows per line), black on white through ANSI colours, with the standard four-module quiet zone. uqr's ownrenderUnicodeCompactdraws light modules in the terminal's text colour, which only scans on dark themes; fixed colours scan on both.AuthDependencies.qrGenerator(shaped after qrcode-terminal's callback API) becomesrenderQr: (url) => string.Before / After
Before: stdout got the
=== QR Code Login ===header, a QR code that read as inverted on light themes, the status lines, then the JSON.After: stdout gets only the JSON; stderr gets the header, a black-on-white QR code with a quiet zone, and the status lines. The login flow is otherwise unchanged.
Testing
src/__tests__/qr.test.ts: reads the rendered text back into a module matrix and checks it equalsencode()'s matrix for a made-uptg://loginURL, plus the quiet zone on every side and two rows per line.auth.test.ts: the QR login prints the rendered code to stderr and nothing to stdout (mocked client).qrencode -l L -m 4output bit for bit when both use the same mask.bun run buildcompilesdist/tgwith uqr bundled;dist/tg --versionruns.bun run check,bun run test(2245 pass),bun run test:e2e(369 pass).Fixes #10
🤖 Generated with Claude Code