Skip to content

feat: visual debug console, Tampermonkey dev scripts, and several bug fixes - #462

Open
KrX3D wants to merge 34 commits into
reisxd:mainfrom
KrX3D:add_logger_and_tempermonkey
Open

feat: visual debug console, Tampermonkey dev scripts, and several bug fixes#462
KrX3D wants to merge 34 commits into
reisxd:mainfrom
KrX3D:add_logger_and_tempermonkey

Conversation

@KrX3D

@KrX3D KrX3D commented Apr 19, 2026

Copy link
Copy Markdown

New features

In-page visual debug console (mods/features/visualConsole.js)

Adds a toggleable overlay console that captures console.log/warn/error output directly on the TV screen. Useful for debugging without needing a connected PC.

  • Toggle with the Yellow remote button (key code 405/170) or Y key on desktop
  • Configurable position (top-left, top-right, bottom-left, bottom-right, center) and height
  • Background logging mode keeps a buffer even when the console is hidden
  • Settings added under Settings → Miscellaneous → Debug Console

Tampermonkey dev scripts (scripts/tampermonkey/)

Two userscripts for browser-based development and testing without a TV:

  • tizentube-loader.user.js — loads TizenTube into a regular browser session on YouTube TV
  • tizentube-log-button.user.js — adds a log button to the page for manual log inspection

Bug fixes

moreSubtitles — interval never cleared on partial patch failure

The setInterval was always cleared after calling patchSubtitleMenu(), even if patching didn't actually succeed (isPatched was still false). It now only clears when isPatched === true, so it keeps retrying until the patch takes.

sponsorblock — observer attached to detached DOM node

The slider element was found via querySelector and observed immediately, but it could be a node that is no longer in the document. Added an .isConnected check before proceeding with observer.observe.

resolveCommand — double-patching and no retry on early call

patchResolveCommand could be called multiple times (e.g. from the init interval), patching the same resolveCommand instance repeatedly and wrapping it in nested closures. Added a __ttPatched flag to skip already-patched instances. Also added a setTimeout(patchResolveCommand, 500) retry for when it is called before _yttv is populated.

ui.js — init fires before _yttv is ready

The startup interval only waited for a <video> element before calling patchResolveCommand, but _yttv could still be empty at that point, causing the patch to find nothing and silently do nothing. The check now also requires Object.keys(window._yttv).length > 0.

ui.js — TrustedHTML CSP violation on innerHTML

The theme configuration UI was built with uiContainer.innerHTML = \...`. This triggers TrustedHTML policy violations in strict CSP environments. Replaced with explicit createElement/appendChild` calls.


Improvements

config.js — deduplicate populate warnings and null guard

configRead could emit the same console.warn on every call for a missing key. Added a populatedConfigWarnings Set so each key is only warned about once. Also added a null guard on localConfig in case JSON.parse produces a non-object.

ui.js — remove redundant event listeners and verbose logging

keypress and keyup listeners were registered in addition to keydown but served no purpose. Removed them. Also removed the console.info('Key event: ...') log that fired on every keypress.

Desktop color key mapping for development

Added mapDesktopColorKey() which maps R/G/Y/B, F1–F4, and 1–4 to the TV remote color key codes (403–406). This makes it possible to test color-button features in a regular browser without a remote.

KrX3D and others added 30 commits March 8, 2026 22:10
Brings in i18n support, language translations, sortSubscriptionsByAlphabet,
reloadHomeOnStartup, and other upstream improvements.
Preserves debug console feature (config keys and settings entries).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_browser

Sync upstream/main into get_debug_logs_on_browser
Removed unnecessary whitespace and updated comment formatting.
- Add _deArrowEnqueue / _deArrowRunNext queue (max 5 concurrent) to
  avoid hammering the DeArrow API when the homepage shows many tiles
- Switch to backward index iteration so splice-by-index is safe
- Add fallback videoId extraction from onSelectCommand.watchEndpoint
- Guard data.titles / data.thumbnails with Array.isArray before .length
- Use capturedItem to correctly close over the loop variable in async
  callbacks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant