Skip to content

Add a "TV" Mode.#720

Open
rjison wants to merge 3 commits intotronbyt:mainfrom
rjison:TVMode
Open

Add a "TV" Mode.#720
rjison wants to merge 3 commits intotronbyt:mainfrom
rjison:TVMode

Conversation

@rjison
Copy link

@rjison rjison commented Feb 15, 2026

Add a TV Mode to the manager. So you have a URL that you can call on your TVs browser and see multiple APPs running at once. You could configure a new "TV" device, or simply monitor an existing app.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rjison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a new 'TV Mode' feature, enabling users to view a live, grid-based display of multiple applications running on a specific device. This mode is accessible via a dedicated URL, making it suitable for display on large screens like smart TVs. The changes include new backend logic to serve the view, a new frontend template for the display, and UI integration to easily access this feature from device management.

Highlights

  • New TV Mode Feature: Introduced a 'TV Mode' allowing users to monitor multiple applications running on a device simultaneously via a dedicated URL, designed for display on a TV browser.
  • Backend API Endpoint: Added a new GET endpoint /devices/{id}/tv handled by handleDeviceTV to serve the TV mode interface, including preloading device applications.
  • Frontend UI for TV Mode: Created a new HTML template device_tv.html that displays enabled applications in a responsive grid, features a fullscreen toggle, and automatically refreshes app previews every minute.
  • User Interface Integration: Integrated a 'TV Mode' button into the existing device card partial, providing a direct link to access the new monitoring view for each device.
Changelog
  • internal/server/handlers_device.go
    • Added handleDeviceTV function to handle requests for the new TV mode, retrieving device details and preloading associated applications before rendering the device_tv template.
  • internal/server/server.go
    • Registered the new device_tv.html template in the templateFiles map.
    • Added a new GET route /devices/{id}/tv and associated it with the handleDeviceTV handler, requiring user login and device context.
  • web/templates/manager/device_tv.html
    • Created a new HTML template for the TV Mode interface, featuring a responsive grid layout for displaying enabled applications, a fullscreen button, and JavaScript to refresh app preview images periodically.
  • web/templates/partials/device_card.html
    • Added a new 'TV Mode' button to the device card, which links to the /devices/{id}/tv endpoint and opens in a new tab.
Activity
  • The pull request introduces a new feature based on the title and description, with no prior comments or reviews indicated.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@rjison
Copy link
Author

rjison commented Feb 15, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a 'TV Mode' feature, which provides a URL to display multiple apps simultaneously, suitable for a TV browser. The changes include a new HTTP handler and route, a corresponding HTML template with styling and JavaScript for this mode, and a link to access it from the device card.

My review identifies a couple of areas for improvement:

  • In internal/server/handlers_device.go, the new handleDeviceTV handler contains redundant logic. It performs an unnecessary nil check and a database query that is already handled by the middleware. Removing this will simplify the code and improve performance.
  • In web/templates/manager/device_tv.html, there is a duplicated CSS rule for .app-grid which should be removed to improve maintainability.

Overall, the changes are a good addition. Addressing these points will make the implementation cleaner and more efficient.

@tavdog
Copy link
Member

tavdog commented Feb 15, 2026

So you'd need to login on your TV browser ?

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new "TV Mode" feature, allowing users to view multiple apps running on a device simultaneously through a dedicated URL. The changes include adding a new handler in handlers_device.go, registering a new route and template in server.go, creating a new HTML template device_tv.html, and adding a "TV Mode" button to the device card in device_card.html. The new mode includes fullscreen functionality and automatic image refreshing. Overall, the implementation is straightforward, but there are a few areas for improvement regarding database efficiency and CSS maintainability.

Comment on lines 239 to 241
func (s *Server) handleUpdateDeviceGet(w http.ResponseWriter, r *http.Request) {
user := GetUser(r)
device := GetDevice(r)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The device object passed to handleDeviceTV via the RequireDevice middleware should already have its Apps preloaded. The s.DB.Preload("Apps").First(device, "id = ?", device.ID) call here is redundant and performs an unnecessary database query, impacting efficiency. You can remove this block as the device.Apps field should already be populated.

</script>
<style>
body, html {
background-color: black !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using !important in CSS is generally discouraged as it can lead to specificity wars and make stylesheets harder to maintain and debug. Consider refactoring your CSS to achieve the desired styling without relying on !important by adjusting selector specificity or order.

Suggested change
background-color: black !important;
background-color: black;

.app-grid {
display: grid;
/* Changed to auto-fit and increased min-width to 350px
so apps look better on large screens */
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This grid-template-columns declaration is duplicated on line 89. Please remove one of the redundant declarations to keep the CSS clean and avoid confusion.

@rjison
Copy link
Author

rjison commented Feb 15, 2026

So you'd need to login on your TV browser ?

I didn't actually test on my TV.. that's a good point. Early in development I got stuck because it wouldn't let me add that /tv because it wasn't requiring you to be logged in.

Any suggestions?

@rjison
Copy link
Author

rjison commented Feb 15, 2026

I don't think having to log in is a big deal actually. It's a pain once, but not that bad.

@tavdog
Copy link
Member

tavdog commented Feb 15, 2026

I don't think having to log in is a big deal actually. It's a pain once, but not that bad.

Yeah it's fine require a login i think. Better for security too. Although we could allow it on local ip's like we do for auto login feature.

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