1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

Web API: re-organize online documentation and integrate Swagger-UI

This commit is contained in:
f4exb
2018-01-24 18:17:13 +01:00
parent 3d77c9af9b
commit 4a442e97e7
28 changed files with 2165 additions and 11 deletions
+4 -6
View File
@@ -16,7 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
//#include <QDirIterator>
#include <QDirIterator>
#include <QJsonDocument>
#include <QJsonArray>
@@ -47,7 +47,7 @@ WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
m_adapter(0)
{
qtwebapp::HttpDocrootSettings docrootSettings;
docrootSettings.path = ":/";
docrootSettings.path = ":/webapi";
m_staticFileController = new qtwebapp::StaticFileController(docrootSettings, parent);
}
@@ -119,11 +119,9 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelSettingsURLRe)) {
devicesetChannelSettingsService(std::string(desc_match[1]), std::string(desc_match[2]), request, response);
}
else
else // serve static documentation pages
{
QByteArray path = "/index.html";
response.setStatus(400, "API URL does not exist");
m_staticFileController->service(path, response);
m_staticFileController->service(request, response);
}
// QDirIterator it(":", QDirIterator::Subdirectories);