Skip to content

feat(tv): on-device server URL for Roku + Android TV - #1268

Open
9M2PJU wants to merge 1 commit into
accius:Stagingfrom
9M2PJU:feat/tv-server-option
Open

9M2PJU wants to merge 1 commit into
accius:Stagingfrom
9M2PJU:feat/tv-server-option

Conversation

@9M2PJU

@9M2PJU 9M2PJU commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1259 review (non-blocking items 1+2).

Roku: Options/* opens KeyboardDialog (Save/Reset/Cancel), ECP serverUrl= deep-link with contentID fallback, persists to OpenHamClock/serverUrl registry, status shows effective host.

Android TV: Change-server button on offline screen + long-press MENU/INFO/GUIDE server dialog (short-press still reloads), --es serverUrl intent extra, SharedPreferences persist, cleartext enabled for user-configured LAN http only (default stays https).

Verified: android-tv BUILD SUCCESSFUL + leanback badging, roku package.sh 13-entry zip + XML parse.

Roku: Options/* opens KeyboardDialog (Save/Reset/Cancel), ECP
serverUrl= deep-link (contentID fallback), registry persists,
status shows effective host.

Android TV: Change-server button + long-press MENU server
dialog, --es serverUrl intent extra, SharedPreferences persist,
cleartext enabled for user-configured LAN http only.

@accius accius left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up both follow-ups so quickly. The on-device dialogs are exactly what I had in mind, and normalizeServerUrl rejecting anything that isn't http(s) on both platforms is good. Before this merges, though, two things need to change, because they let something other than the person holding the remote change where the app points.

1. A server URL from outside the app should not be saved silently (Android + Roku)

  • Android: MainActivity is exported (it has to be, it's the launcher), and resolveHomeUrl() saves any serverUrl intent extra to SharedPreferences. So any app installed on the TV can start the activity with --es serverUrl https://…, and from then on "OpenHamClock" loads that page every time, with nothing on screen to say it changed.
  • Roku: ECP is unauthenticated on the LAN, and main.brs writes the serverUrl / contentID launch parameter straight to the registry (before it's normalised). Any device on the network can repoint the channel for good.

Suggested fix, same on both: use an external value for that launch only, or open the existing server dialog prefilled with it so the viewer confirms with Save. Only the dialog's Save should persist. The adb/ECP route stays useful for setting up a TV without typing on the remote.

2. Cleartext is app-wide (Android)
android:usesCleartextTraffic="true" allows plain http for everything, not just the self-hosted server. And handleUrl keeps every http(s) link inside the WebView, so any http page the dashboard links to also loads unencrypted inside the app. A network security config can't express "private addresses", so I'd keep the flag and narrow it in code: in handleUrl, keep http:// navigation inside the WebView only when the host matches the configured server's host. Send other links to the system browser with ACTION_VIEW, or drop them. Then the app speaks plain http only to the server the user chose.

Smaller things, not blocking:

  • showServerDialog() prefills from webView.getUrl(), which after browsing is the current page, not the server. Prefill from the saved setting, or the default, instead.
  • Roku main.brs: normalise before writing, or just stop writing there once item 1 is done.

The rest looks good: Save/Reset/Cancel on both, long-press on Menu so short-press still reloads, and the status line showing which server is in use. Thanks again. 73 de K0CJH

This branch has not been deployed

No deployments
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.

2 participants