Skip to content

Commit

Permalink
Enable a skeleton backend web interface using new http server code
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarta committed Apr 30, 2021
1 parent 3e47b46 commit 9e73388
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/html/html.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TEMPLATE = aux
html.path = $${PREFIX}/share/mythtv/html/
html.files = frontend_index.qsp backend_index.qsp overview.html menu.qsp robots.txt favicon.ico
# mythfrontend.html is just a copy of frontend_index.qsp
html.files += mythfrontend.html
html.files += mythbackend.html mythfrontend.html
html.files += css images js misc setup samples tv
html.files += 3rdParty xslt video debug apps

Expand Down
19 changes: 19 additions & 0 deletions mythtv/html/mythbackend.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />

<title>MythTV Backend</title>

<link rel="stylesheet" href="/3rdParty/materialize/css/materialize.css">
<link rel="stylesheet" href="/3rdParty/fontawesome-free-5.15.1-web/css/fontawesome.css">
<link rel="stylesheet" href="/3rdParty/fontawesome-free-5.15.1-web/css/solid.css">
</head>

<body>
<div id="backend">
<p>Hello World, from the backend</p>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions mythtv/programs/mythbackend/main_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
#include "httpstatus.h"
#include "mythlogging.h"

// New webserver
#include "libmythbase/http/mythhttproot.h"
#include "libmythbase/http/mythhttpinstance.h"

#define LOC QString("MythBackend: ")
#define LOC_WARN QString("MythBackend, Warning: ")
#define LOC_ERR QString("MythBackend, Error: ")
Expand Down Expand Up @@ -730,6 +734,9 @@ int run_backend(MythBackendCommandLineParser &cmdline)
pHS->RegisterExtension( httpStatus );
}

auto root = std::bind(&MythHTTPRoot::RedirectRoot, std::placeholders::_1, "mythbackend.html");
MythHTTPScopedInstance webserver({{ "/", root}});

be_sd_notify("STATUS=Creating main server");
mainServer = new MainServer(
ismaster, port, &tvList, sched, expirer);
Expand Down

0 comments on commit 9e73388

Please sign in to comment.