Web Application

From MythTV Official Wiki
Revision as of 19:43, 2 June 2025 by Pgbennett (talk | contribs) (Add "Reverse Proxy" section)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Version:
34
This page applies to MythTV V34 and later.

Overview

The web application is new with MythTV v34. It replaces the incomplete web front end. It supports backend setup and provides most of the features of mythweb.

The web app is accessed via a browser on the same network as mythbackend. The port used is the Status port as set in the backend setup. This defaults to 6544. You can access it from the backend machine itself or from another machine on the local network. For example http://backend:6544 .

In a new installation where the database is not yet available, mythbackend starts and the web app is available on port 6544, for creating the initial backend setup.

Ports

The following ports are used for http access to MythTV, starting in V34:

Server Purpose Port Number Setup Default Notes
Backend Web Application and API, http Backend Setup: Status Port 6544 Normal Access
Backend Web Application and API, https Backend Setup: Status Port + 10 6554 Requires SSL certificate and DNS entry
Backend Web Application and API, http Backend Setup: Status Port + 200 6744 Duplicate of normal access port
Backend Old Web Frontend and API (deprecated) Backend Setup: Status Port + 6 6550 Incomplete, no longer maintained, will not work after QT6
Frontend Web Page and API, http config.xml UPnP/MythFrontend/ServicePort 6547
Frontend Web Page and API, https config.xml UPnP/MythFrontend/ServicePort + 10 6557 Requires SSL certificate and DNS entry
Frontend Old Web Page and API (deprecated) config.xml UPnP/MythFrontend/ServicePort + 4 6551 Will not work after QT6

Unless you have set up an SSL certificate, the SSL ports will not be available.

Top Banner

Two icons at the right hand side of the top banner select Theme and Language.

These themes are unrelated to MytTV themes. The themes present different color schemes as well as different font sizes and spacing. Some themes have excessive space between rows. If that is troublesome, try a different theme.

The language that you select in the top banner is only applicable to the web app on the current browser. After changing language, refresh to get the page updated.

To set a language for mythfrontend, use the Backend Setup pages.

On a narrow screen or a phone, the icons are replaced by a menu that provides the same operations.

Left Bar

The left navigation bar has buttons for selecting the two main sections of the web app, Dashboard and Backend Setup. On a narrow screen or phone, the left bar disappears and there is a menu button at the top to provide the links normally hosted in the left bar.

Dashboard

This is a tabbed page that supports a variety of display and maintenance actions. It implements most of what is in mythweb.

On a narrow screen or a phone, the tab list is scrollable, with arrow keys, tab keys and buttons at the left and right of the tabs.

The channel editor in the dashboard supports updating and adding channels. More capabilities are in the channel editor in the backed setup part of the web application.

The program guide tab supports scheduling recordings or amending a schedule by clicking on an entry in the guide. It can search by title or people. Clicking a channel name shows a complete schedule for that channel.

The Upcoming tab has a menu for changing deleting or overriding schedules.

The Recording Rules tab supports modifying and deleting rules, and creating manual or custom recording rules.

In the tabs for Recordings and Videos, there is a download icon on each row. Instead of downloading the video, you can play it from any computer running the web app. Right click the download icon and select "copy link address". In vlc media player, select "Open network stream" and paste the URL. Alternatively, run "vlc <url>" in a command prompt.

Sorting Lists

Version:
36
This section Sorting Lists applies to MythTV V36 and later.

Several pages include lists that can be sorted by clicking the heading. if you refresh the page or switch tabs within the page, the sort field is remembered. If you open a new browser or browser tab, sort fields revert to the default.

If desired, you can change this behavior so that the sort fields are remembered in new browser tabs or windows. To change it do the following:

  1. Open the web app, press F12. Select Application, Storage, Local Storage. In Firefox, select Storage, Local Storage.
  2. Change the value of RememberSort from N to Y.
  3. Refresh the web app page.

Program Guide

see Web Application:Program Guide

Backend Setup

Complete setup of MythTV backend can be done with the web app. The mythtv-setup application is no longer required and will be deprecated.

Setup is accessed from the cogwheel icon in the left border of the page.

For detailed instructions, see Configuring MythTV

SSL

mythbackend supports SSL for the web app. To set this up, obtain an SSL certificate from a SSL certificate provider. You need a certificate file and a key file. In your backend home directory create a directory called $HOME/.mythtv/certificates. Store your certificate file and key file there, named as cert.pem and key.pem. When connecting to mythbackend via SSL, add 10 to the port number. By default you will use port 6554 for SSL, for example https://backend.example.com:6554/

API and Web App Authentication

Version:
36
Authentication applies to MythTV V36 and later.

To protect MythTV against outside interference, there is now an authentication framework. This protects the methods of the service API. This is important if you expose the web app on the internet.

There is by default an overall prohibition on any connections to MythTV from outside your local subnet. This is regardless of any setting in API authentication. You can disable this to access MythTV outside your local subnet. Enable "Allow Connections from all Subnets" in MythTV Setup, General, Host Address Backend Setup. When doing that it is recommended to enable API Authentication.

Warning.png Warning: If you enable API Authentication, any apps that use the Service API will be affected, for example Kodi with MythTV plugin.

To protect your passwords and access tokens you should use SSL for the web app (see above) and only expose the SSL port to the internet.

User Setup

User setup is done in the web app, at Dashboard => Settings => Users.

MythTV comes with the admin user preinstalled, with user id "admin" and password "mythtv". The admin user cannot be deleted. I recommend that you change the admin password if you plan to enable authentication.

Before you enable "Authentication Required", you can create users and update the admin user password. Only the admin user can enable or disable authentication. Other users you create can only update their own password. There is no permission structure for other users, they all have full permission, apart from user setup.

Without enabling "Authentication Required", you can still log in to any user and you will be restricted or permitted by the permissions of that user.

Enable or Disable Authentication

There are two options for requiring authentication, Remote IP Addresses or All IP Addresses. If you select the Remote IP Addresses option, only users outside your local subnet will require authentication. In your local subnet you can continue to access the system unauthenticated.

Once you have set up your users, login as admin using the Log in link at the top of the page. You can now enable Authentication Required for Remote or All IP addresses. After that, any user of web app or the service API in the appropriate IP address range will have to Log In.

If you have a slave backend, you need to setup Authentication Required separately on that machine, if you want to require authentication on the slave.

If you are using applications other than the web app that use the API, you may need MythTV to bypass authorization checks for your local IP addresses. You will still need to log in as admin for user maintenance.

Change Password

Any user can change their own password by going into Dashboard => Settings => Users and selecting the pencil icon next to their own id. The admin user can change anybody's password. If authentication is not required or only required for remote IP addresses, users that have not logged in can change anybody's password.

Forgotten Password

If any user forgets their password, it can be set using admin. Admin can set passwords without knowing the prior password. The non-admin users can change their password only if they know the prior password.

If admin forgets their password I recommend this process: Stop mythbackend and start it with the option "-O APIAuthReqd=NONE". In this mode anybody can change any user's password without logging in. Change the admin user password and restart without the option.

Security PIN

in backend setup General => Host Address Backend Setup, there is a Security PIN specified. The default is 0000. Using this pin, Myth/GetConnectionInfo can get your database information. This is used by mythfrontend. Myth/GetConnectionInfo is not protected by user name / password authentication. If you are authenticating and exposing the web app on the internet, you need to change the PIN if you don't want people to find out your database information. The PIN can be a string of any length. It does not have to be numeric. You will need to enter it the first time a new mythfrontend is set up.

Reverse Proxy

Version:
36
Reverse Proxy setup applies to MythTV V36 and later.

A reverse proxy allows you to access a web site as a directory in another web site. In many cases this is how an internal web site is exposed to external users. For example you could have a web site called example.com with existing content and you could then have MythTV web app available on http://example.com/mythwebapp/. Everything under http://example.com/mythwebapp/ would be part of the web app.

The MythTV web app now uses relative URLS throughout so that you can set up a reverse proxy. There is one caveat. You have to update the MythTV web app's index.html to insert the correct base href.

To get it to work, after installing MythTV, you can edit the file /usr/share/mythtv/html/apps/backend/index.html and change the line <base href="/"> to <base href="/mythwebapp/">. After that all works through the reverse proxy but not if you invoke it directly via backend:6544.

Alternatively the reverse proxy server can be programmed to change <base href="/"> to <base href="/mythwebapp/"> when loading index.html. That would be the best solution and would support both direct access and reverse proxy access.

You can set up a reverse proxy in apache with the following configuration:

  ProxyPass /mythwebapp http://backend.lan:6544
  ProxyPassReverse /mythwebapp  http://backend.lan:6544

Using a reverse proxy will nullify the effect of disabling Allow Connections from all Subnets in mythbackend setup. All traffic will appear to come from internal URLs. You need to take other steps to prevent outside connections if needed. Probably you should set up log in access in the web app for all IP addresses.