forked from j62/ctbrec
1
0
Fork 0

Add setting to switch on/off the server webinterface

This commit is contained in:
0xboobface 2019-07-27 17:55:42 +02:00
parent 1e5eff780c
commit bc724b2f42
3 changed files with 11 additions and 5 deletions

View File

@ -56,3 +56,6 @@ the port ctbrec tries to connect to, if it is run in remote mode.
- **splitRecordings** (app only) - [0 - 2147483647] in seconds. Split recordings after this amount of seconds. The recordings are split up into several individual recordings,
which have the defined length (roughly). 0 means no splitting. The server does not support splitRecordings.
- **webinterface** (server only) - [`true`,`false`] Enables the webinterface for the server. You can access it with http://host:port/static/index.html Don't activate this on
a machine, which can be accessed from the internet, because this is totally unprotected at the moment.

View File

@ -114,4 +114,5 @@ public class Settings {
public int windowWidth = 1340;
public int windowX;
public int windowY;
public boolean webinterface = false;
}

View File

@ -142,11 +142,13 @@ public class HttpServer {
holder = new ServletHolder(hlsServlet);
handler.addServletWithMapping(holder, "/hls/*");
String staticContext = "/static/*";
LOG.info("Register static file servlet under {}", staticContext);
StaticFileServlet staticFileServlet = new StaticFileServlet("/html");
holder = new ServletHolder(staticFileServlet);
handler.addServletWithMapping(holder, staticContext);
if (this.config.getSettings().webinterface) {
String staticContext = "/static/*";
LOG.info("Register static file servlet under {}", staticContext);
StaticFileServlet staticFileServlet = new StaticFileServlet("/html");
holder = new ServletHolder(staticFileServlet);
handler.addServletWithMapping(holder, staticContext);
}
try {
server.start();