mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Feat: Add SSL support for webserver + websocket (#612)
* Feat: Add SSL support for webserver + websocket Finally, Hyperion reaches the SSL century! - Uses by default a internal key and certificate to provide working HTTPS out-of-the-box - Your browser won't like that, for a green ssl seal next to the browser address bar you need to use Let's Encrypt with a own legit domain. This is out of the scope of Hyperion
This commit is contained in:
@@ -15,11 +15,24 @@ class BonjourServiceRegister;
|
||||
class StaticFileServing;
|
||||
class QtHttpServer;
|
||||
|
||||
/*
|
||||
OPENSSL command that generated the embedded key and cert file
|
||||
|
||||
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
|
||||
-keyout hyperion.key -out hyperion.crt -extensions san -config \
|
||||
<(echo "[req]";
|
||||
echo distinguished_name=req;
|
||||
echo "[san]";
|
||||
echo subjectAltName=DNS:hyperion-project.org,IP:127.0.0.1
|
||||
) \
|
||||
-subj /CN=hyperion-project.org
|
||||
*/
|
||||
|
||||
class WebServer : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WebServer (const QJsonDocument& config, QObject * parent = 0);
|
||||
WebServer (const QJsonDocument& config, const bool& useSsl, QObject * parent = 0);
|
||||
|
||||
virtual ~WebServer (void);
|
||||
|
||||
@@ -67,6 +80,7 @@ public slots:
|
||||
|
||||
private:
|
||||
QJsonDocument _config;
|
||||
bool _useSsl;
|
||||
Logger* _log;
|
||||
QString _baseUrl;
|
||||
quint16 _port;
|
||||
@@ -74,8 +88,10 @@ private:
|
||||
QtHttpServer* _server;
|
||||
bool _inited = false;
|
||||
|
||||
const QString WEBSERVER_DEFAULT_PATH = ":/webconfig";
|
||||
const quint16 WEBSERVER_DEFAULT_PORT = 8090;
|
||||
const QString WEBSERVER_DEFAULT_PATH = ":/webconfig";
|
||||
const QString WEBSERVER_DEFAULT_CRT_PATH = ":/hyperion.crt";
|
||||
const QString WEBSERVER_DEFAULT_KEY_PATH = ":/hyperion.key";
|
||||
quint16 WEBSERVER_DEFAULT_PORT = 8090;
|
||||
|
||||
BonjourServiceRegister * _serviceRegister = nullptr;
|
||||
};
|
||||
|
Reference in New Issue
Block a user