1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Web API: handle pre-flight requests

This commit is contained in:
f4exb 2018-07-21 22:28:35 +02:00
parent 1456725237
commit e37c90c8d0
5 changed files with 20 additions and 3 deletions

View File

@ -35,7 +35,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
*/
QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangel");
QCoreApplication::setApplicationVersion("4.0.4");
QCoreApplication::setApplicationVersion("4.0.5");
#if 1
qApp->setStyle(QStyleFactory::create("fusion"));

View File

@ -57,7 +57,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangelBench");
QCoreApplication::setApplicationVersion("4.0.4");
QCoreApplication::setApplicationVersion("4.0.5");
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));

View File

@ -56,7 +56,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
QCoreApplication::setOrganizationName("f4exb");
QCoreApplication::setApplicationName("SDRangelSrv");
QCoreApplication::setApplicationVersion("4.0.4");
QCoreApplication::setApplicationVersion("4.0.5");
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
sdrangel (4.0.5-1) unstable; urgency=medium
* Web API: handle pre-flight requests
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 22 Jul 2018 09:14:18 +0200
sdrangel (4.0.4-1) unstable; urgency=medium
* Fixed PlutoSDR output sample width. Fixes issue #198

View File

@ -76,6 +76,17 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
{
QByteArray path=request.getPath();
// Handle pre-flight requests
if (request.getMethod() == "OPTIONS")
{
qDebug("WebAPIRequestMapper::service: method OPTIONS: assume pre-flight");
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
response.setStatus(200, "OK");
return;
}
if (path == WebAPIAdapterInterface::instanceSummaryURL) {
instanceSummaryService(request, response);
} else if (path == WebAPIAdapterInterface::instanceDevicesURL) {