Proof-of-concept QML test

WIP, do not review yet
This commit is contained in:
Joshua Goins
2025-08-05 19:17:37 -04:00
parent 45c5806c5a
commit a190c45988
7 changed files with 183 additions and 1 deletions

View File

@@ -12,6 +12,8 @@
#include <QSslKey>
#include <QUuid>
#include <QBuffer>
#include <QImage>
#include <Quotient/networkaccessmanager.h>
using namespace Qt::Literals::StringLiterals;
@@ -116,6 +118,20 @@ void Server::start()
});
m_server.route(u"/_matrix/client/r0/sync"_s, QHttpServerRequest::Method::Get, this, &Server::sync);
m_server.route(u"/_matrix/client/v1/media/download/<arg>/<arg>"_s,
QHttpServerRequest::Method::Get,
[](const QString &serverName, const QString &mediaId, QHttpServerResponder &responder) {
qInfo() << serverName << mediaId;
QImage image(128, 128, QImage::Format::Format_RGB32);
image.fill(Qt::white);
QByteArray bytes;
QBuffer buffer(&bytes);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "PNG");
responder.write(&buffer, "image/png", QHttpServerResponder::StatusCode::Ok);
});
QSslConfiguration config;
QFile key(QStringLiteral(DATA_DIR) + u"/localhost.key"_s);