From a7c945ad53a8fd94ed3f0c92b7dec83a06e97bfb Mon Sep 17 00:00:00 2001 From: badaix Date: Tue, 27 Oct 2020 08:30:36 +0100 Subject: [PATCH] Add content to default web page --- server/control_session_http.cpp | 34 +++++++++++++++++++- server/etc/index.html | 55 ++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/server/control_session_http.cpp b/server/control_session_http.cpp index 2b4da4da..77febfbc 100644 --- a/server/control_session_http.cpp +++ b/server/control_session_http.cpp @@ -30,6 +30,38 @@ static constexpr auto LOG_TAG = "ControlSessionHTTP"; static constexpr const char* HTTP_SERVER_NAME = "Snapcast"; +static constexpr const char* UNCONFIGURED = + "Snapcast Default Page" + "" + "

Snapcast Default Page

" + "

" + " This is the default welcome page used to test the correct operation of the Snapcast built-in webserver." + "

" + "

" + " This webserver is a websocket endpoint for control clients (ws://host:1780/jsonrpc) and streaming clients" + " (ws://host:1780/stream), but it can also host simple web pages. To serve a web page, you must configure the" + " document root in the snapserver configuration file snapserver.conf, usually located in" + " /etc/snapserver.conf" + "

" + "

" + " The Snapserver installation should include a copy of Snapweb," + " located in /usr/share/snapserver/snapweb/
" + " To activate it, please configure the doc_root as follows, and restart Snapserver to activate the changes:" + "

" + "
"
+    "# HTTP RPC #####################################\n"
+    "#\n"
+    "[http]\n"
+    "\n"
+    "...\n"
+    "\n"
+    "# serve a website from the doc_root location\n"
+    "doc_root = /usr/share/snapserver/snapweb/\n"
+    "\n"
+    "#\n"
+    "################################################
" + "" + ""; namespace { @@ -161,7 +193,7 @@ void ControlSessionHttp::handle_request(http::request Snapcast Default Page + - TODO: description how to configure the doc_root +

Snapcast Default Page

+

+ This is the default welcome page used to test the correct operation of the Snapcast built-in webserver. +

+

+ This webserver is a websocket endpoint for control clients (ws://host:1780/jsonrpc) and streaming clients + (ws://host:1780/stream), but it can also host simple web pages. To serve a web page, you must configure the + document root in the snapserver configuration file snapserver.conf, usually located in + /etc/snapserver.conf +

+

+ The Snapserver installation should include a copy of Snapweb, + located in + /usr/share/snapserver/snapweb/
+ To activate it, please configure the doc_root as follows, and restart Snapserver to activate the changes: +

+
+# HTTP RPC #####################################
+#
+[http]
+
+...
+
+# serve a website from the doc_root location
+doc_root = /usr/share/snapserver/snapweb/
+
+#
+################################################
\ No newline at end of file