mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 22:14:45 -04:00
Map: Add support for Ionosonde stations
This commit is contained in:
@@ -37,6 +37,7 @@ WebServer::WebServer(quint16 &port, QObject* parent) :
|
||||
m_mimeTypes.insert(".js", new MimeType("text/javascript"));
|
||||
m_mimeTypes.insert(".css", new MimeType("text/css"));
|
||||
m_mimeTypes.insert(".json", new MimeType("application/json"));
|
||||
m_mimeTypes.insert(".geojson", new MimeType("application/geo+json"));
|
||||
}
|
||||
|
||||
void WebServer::incomingConnection(qintptr socket)
|
||||
@@ -88,6 +89,11 @@ QString WebServer::substitute(QString path, QString html)
|
||||
return html;
|
||||
}
|
||||
|
||||
void WebServer::addFile(const QString &path, const QByteArray &data)
|
||||
{
|
||||
m_files.insert(path, data);
|
||||
}
|
||||
|
||||
void WebServer::sendFile(QTcpSocket* socket, const QByteArray &data, MimeType *mimeType, const QString &path)
|
||||
{
|
||||
QString header = QString("HTTP/1.0 200 Ok\r\nContent-Type: %1\r\n\r\n").arg(mimeType->m_type);
|
||||
@@ -163,9 +169,14 @@ void WebServer::readClient()
|
||||
sendFile(socket, data, mimeType, path);
|
||||
}
|
||||
#endif
|
||||
else if (m_files.contains(path))
|
||||
{
|
||||
// Path is a file held in memory
|
||||
sendFile(socket, m_files.value(path).data(), mimeType, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
// See if we can find a file
|
||||
// See if we can find a file on disk
|
||||
QFile file(path);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user