Conversation
Backend: - Add preset PIN mechanism to nvhttp (set/get/clear_preset_pin) - Auto-use preset PIN during getservercert pairing phase - Add POST /api/qr-pair endpoint that generates random 4-digit PIN, sets it as preset, and returns moonlight:// URL for QR encoding Frontend: - Add qrcode npm dependency for client-side QR generation - Create useQrPair.js composable (API call, QR generation, countdown) - Add QR code pairing card to Pin.vue with generate/refresh/cancel - Add i18n keys for en and zh locales The QR code encodes a moonlight://pair URL containing host, port, PIN and server name. The preset PIN expires after 120 seconds.
…back - Resolve loopback/VPN addresses to real LAN IP via UDP connect trick - Windows fallback: enumerate adapters via GetAdaptersAddresses, skip tunnel/PPP - Prefer user-configured external_ip for WAN/port-forwarded setups - Use random_device directly for secure PIN generation - Validate PIN format (4 digits) before setting preset - Rate limit pairing attempts per IP (5 per minute) - Add GET /api/qr-pair status polling (active/paired/expired/inactive) - Frontend polls every 2s, shows success UI on pairing completion - Extract resetQrDisplay() to deduplicate QR state clearing - Add i18n: qr_paired_success (en/zh) - Remove #pragma comment(lib) incompatible with MinGW
6fa0c2b to
e019624
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.
Summary
Add QR code pairing support to Sunshine, allowing Moonlight clients to pair by scanning a QR code from the Web UI instead of manually entering a PIN.
Changes
Core QR Pairing (
62025988)POST /api/qr-pairendpoint generates amoonlight://pair?host=...&port=...&pin=...URLset_preset_pin()/get_preset_pin()/clear_preset_pin()with 120s auto-expirygetservercertpairing phaseuseQrPair.jsfor state managementIP Detection & Security Hardening (
6fa0c2b0)GetAdaptersAddressesenumeration, skip tunnel/PPP adaptersexternal_ipconfig takes priority for WAN/port-forwarded setupsrandom_devicefor PIN generation, 4-digit format validation, per-IP rate limiting (5 attempts/min)GET /api/qr-pairreturns status (active/paired/expired/inactive), frontend polls every 2s and shows success UI on completionMisc