fix(connection): Happ TV connect works on Apple TV too (one API for both)

Correction: check.happ.su/sendtv is a single API serving both Android TV and
Apple TV, not Android-only. Re-enable the TV connect widget for Apple TV
(gate on androidTV || appleTV again) and make the code input flexible again
(inputMode text, alphanumeric) since the code isn't guaranteed numeric.
This commit is contained in:
c0mrade
2026-06-03 16:34:20 +03:00
parent f8ac4895fa
commit ce7a3eaedf
2 changed files with 9 additions and 9 deletions

View File

@@ -150,11 +150,11 @@ export default function InstallationGuide({
); );
const userIsOnTv = detectedPlatform === 'androidTV' || detectedPlatform === 'appleTV'; const userIsOnTv = detectedPlatform === 'androidTV' || detectedPlatform === 'appleTV';
// Happ's TV quick-connect (check.happ.su/sendtv, 5-digit code) is an ANDROID TV // Happ's TV quick-connect (check.happ.su/sendtv) is ONE API serving BOTH
// -only API. Apple TV uses a different mechanism (tv.happ.su temporary code), so // Android TV and Apple TV — show the widget on either.
// the block must NOT show there — it would POST to the wrong endpoint. const selectedPlatform = activePlatformKey || availablePlatforms[0];
const isAndroidTvLayout = const isTvLayout =
(activePlatformKey || availablePlatforms[0]) === 'androidTV' && !userIsOnTv; (selectedPlatform === 'androidTV' || selectedPlatform === 'appleTV') && !userIsOnTv;
const currentPlatformKey = activePlatformKey || availablePlatforms[0]; const currentPlatformKey = activePlatformKey || availablePlatforms[0];
const currentPlatformData = currentPlatformKey const currentPlatformData = currentPlatformKey
@@ -194,11 +194,11 @@ export default function InstallationGuide({
const blockType = appConfig.uiConfig?.installationGuidesBlockType || 'cards'; const blockType = appConfig.uiConfig?.installationGuidesBlockType || 'cards';
const Renderer = RENDERERS[blockType] || CardsBlock; const Renderer = RENDERERS[blockType] || CardsBlock;
// For the Happ Android TV app, inject the TV connect widget into a step as // For the Happ TV app (Android TV / Apple TV), inject the TV connect widget as
// customNode so it renders THROUGH the active block style (cards/timeline/ // customNode so it renders THROUGH the active block style (cards/timeline/
// accordion/minimal) instead of as separate clashing cards that break it. // accordion/minimal) instead of as separate clashing cards that break it.
const showTvConnect = Boolean( const showTvConnect = Boolean(
selectedApp && isAndroidTvLayout && isHappApp(selectedApp) && appConfig.subscriptionUrl, selectedApp && isTvLayout && isHappApp(selectedApp) && appConfig.subscriptionUrl,
); );
let renderBlocks: RenderBlock[] = selectedApp?.blocks ?? []; let renderBlocks: RenderBlock[] = selectedApp?.blocks ?? [];
if (selectedApp && showTvConnect && appConfig.subscriptionUrl) { if (selectedApp && showTvConnect && appConfig.subscriptionUrl) {

View File

@@ -213,9 +213,9 @@ export default function TvQuickConnect({ subscriptionUrl, isLight }: Props) {
maxLength={5} maxLength={5}
value={code} value={code}
onChange={(e) => setCode(e.target.value.toUpperCase().replace(/[^A-Z0-9]/g, ''))} onChange={(e) => setCode(e.target.value.toUpperCase().replace(/[^A-Z0-9]/g, ''))}
placeholder="12345" placeholder="A1B2C"
autoComplete="one-time-code" autoComplete="one-time-code"
inputMode="numeric" inputMode="text"
className={inputClass} className={inputClass}
/> />
<button <button