mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 17:45:48 -05:00
SkyMap: Fix CORS and enabling caching.
This commit is contained in:
parent
e0839fce82
commit
c9c605f448
@ -80,12 +80,6 @@ target_link_libraries(${TARGET_NAME}
|
||||
|
||||
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})
|
||||
|
||||
if(WIN32)
|
||||
# Run deployqt for QtQuick etc
|
||||
include(DeployQt)
|
||||
windeployqt(${TARGET_NAME} ${SDRANGEL_BINARY_BIN_DIR} ${PROJECT_SOURCE_DIR}/skymap)
|
||||
endif()
|
||||
|
||||
# Install debug symbols
|
||||
if (WIN32)
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET_NAME}> CONFIGURATIONS Debug RelWithDebInfo DESTINATION ${INSTALL_FOLDER} )
|
||||
|
@ -97,7 +97,7 @@ void WebServer::addFile(const QString &path, const QByteArray &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\nAccess-Control-Allow-Origin \"*\"\r\n\r\n").arg(mimeType->m_type);
|
||||
QString header = QString("HTTP/1.0 200 Ok\r\nContent-Type: %1\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Methods: *\r\nAccess-Control-Allow-Origin: *\r\n\r\n").arg(mimeType->m_type);
|
||||
if (mimeType->m_binary)
|
||||
{
|
||||
// Send file as binary
|
||||
|
@ -21,11 +21,23 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QDebug>
|
||||
#include <QNetworkDiskCache>
|
||||
|
||||
WTML::WTML()
|
||||
{
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
QObject::connect(m_networkManager, &QNetworkAccessManager::finished, this, &WTML::handleReply);
|
||||
|
||||
QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
|
||||
QDir writeableDir(locations[0]);
|
||||
if (!writeableDir.mkpath(QStringLiteral("cache") + QDir::separator() + QStringLiteral("wtml"))) {
|
||||
qDebug() << "Failed to create cache/wtml";
|
||||
}
|
||||
|
||||
m_cache = new QNetworkDiskCache();
|
||||
m_cache->setCacheDirectory(locations[0] + QDir::separator() + QStringLiteral("cache") + QDir::separator() + QStringLiteral("wtml"));
|
||||
m_cache->setMaximumCacheSize(100000000);
|
||||
m_networkManager->setCache(m_cache);
|
||||
}
|
||||
|
||||
WTML::~WTML()
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class QNetworkDiskCache;
|
||||
|
||||
// World Wide Telescope WTML files containing imageset catalogs
|
||||
class WTML : public QObject
|
||||
@ -48,6 +49,7 @@ signals:
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkDiskCache *m_cache;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user