Commit 1ede9209 authored by jan.koester's avatar jan.koester
Browse files

test

parent 5bcd401c
Loading
Loading
Loading
Loading
+11 −6
Changes for client/publishclient.cpp: 11 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -155,16 +155,21 @@ void PublishClient::publish(const QString &html, Callback cb) {
    QNetworkRequest req(url);
    req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
    req.setAttribute(QNetworkRequest::Http2AllowedAttribute, false);
    if (!_authToken.isEmpty()) {
        req.setRawHeader("Cookie", ("authid=" + _authToken).toUtf8());
    }

    QJsonArray commands;

    /* Publish the rendered HTML to the server */
    /* First command: authenticate with authid */
    if (!_authToken.isEmpty()) {
        QJsonObject authCmd;
        authCmd["authid"] = _authToken;
        commands.append(authCmd);
    }

    /* Second command: publish the rendered HTML via webedit */
    QJsonObject pubCmd;
    pubCmd["command"] = "publish_html";
    pubCmd["html"] = html;
    QJsonObject pubParams;
    pubParams["html"] = html;
    pubCmd["publish"] = pubParams;
    commands.append(pubCmd);

    QJsonDocument doc(commands);