2018-09-17 19:22:53 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "webapplication.h"
|
|
|
|
|
|
2018-10-04 23:32:24 +02:00
|
|
|
#include <QDir>
|
|
|
|
|
|
2018-09-17 19:22:53 +02:00
|
|
|
class QJsonObject;
|
|
|
|
|
|
2018-09-22 07:23:06 +02:00
|
|
|
class WebServer;
|
|
|
|
|
|
2018-09-17 19:22:53 +02:00
|
|
|
class FileserverApplication : public WebApplication
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2018-10-04 23:32:24 +02:00
|
|
|
static const QString SERVER_NAME;
|
|
|
|
|
static const QDir PLUGIN_RESOURCES_DIR;
|
2018-09-17 19:22:53 +02:00
|
|
|
|
|
|
|
|
public:
|
2018-09-22 07:23:06 +02:00
|
|
|
FileserverApplication(const QJsonObject &config, WebServer &webServer);
|
2018-09-17 19:22:53 +02:00
|
|
|
|
|
|
|
|
void start() Q_DECL_OVERRIDE;
|
2018-09-22 03:07:20 +02:00
|
|
|
|
|
|
|
|
void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE;
|
2018-09-22 07:23:06 +02:00
|
|
|
|
|
|
|
|
private:
|
2018-10-04 23:32:24 +02:00
|
|
|
static QString formatSize(qint64 size);
|
|
|
|
|
|
2018-09-22 07:23:06 +02:00
|
|
|
WebServer &m_webServer;
|
2018-10-04 23:32:24 +02:00
|
|
|
QDir m_rootPath;
|
2018-09-17 19:22:53 +02:00
|
|
|
};
|