<commit_before>#include "NuulsUploader.hpp"

#include "common/Env.hpp"
#include "common/NetworkRequest.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"

#include <QBuffer>
#include <QHttpMultiPart>
#include <QMimeDatabase>
#include <QMutex>

#define UPLOAD_DELAY 2000
// Delay between uploads in milliseconds

namespace {

boost::optional<QByteArray> convertToPng(QImage image)
{
    QByteArray imageData;
    QBuffer buf(&imageData);
    buf.open(QIODevice::WriteOnly);
    bool success = image.save(&buf, "png");
    if (success)
    {
        return boost::optional<QByteArray>(imageData);
    }
    else
    {
        return boost::optional<QByteArray>(boost::none);
    }
}
}  // namespace

namespace chatterino {
// These variables are only used from the main thread.
auto uploadMutex = QMutex();
std::queue<RawImageData> uploadQueue;

void uploadImageToNuuls(RawImageData imageData, ChannelPtr channel,
                        ResizingTextEdit &textEdit)
{
    const static char *boundary = "thisistheboudaryasd";
    const static QString contentType =
        QString("multipart/form-data; boundary=%1").arg(boundary);
    static QUrl url(Env::get().imageUploaderUrl);

    QHttpMultiPart *payload = new QHttpMultiPart(QHttpMultiPart::FormDataType);
    QHttpPart part = QHttpPart();<commit_msg>Internal changes<commit_after>#include "NuulsUploader.hpp"

#include "common/Env.hpp"
#include "common/NetworkRequest.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"

#include <QBuffer>
#include <QHttpMultiPart>
#include <QMimeDatabase>
#include <QMutex>

#define UPLOAD_DELAY 2000
// Delay between uploads in milliseconds

namespace {

boost::optional<QByteArray> convertToPng(QImage image)
{
    QByteArray imageData;
    QBuffer buf(&imageData);
    buf.open(QIODevice::WriteOnly);
    bool success = image.save(&buf, "png");
    if (success)
    {
        return boost::optional<QByteArray>(imageData);
    }
    else
    {
        return boost::optional<QByteArray>(boost::none);
    }
}
}  // namespace

namespace chatterino {
// These variables are only used from the main thread.
static auto uploadMutex = QMutex();
static std::queue<RawImageData> uploadQueue;

void uploadImageToNuuls(RawImageData imageData, ChannelPtr channel,
                        ResizingTextEdit &textEdit)
{
    const static char *const boundary = "thisistheboudaryasd";
    const static QString contentType =
        QString("multipart/form-data; boundary=%1").arg(boundary);
    static QUrl url(Env::get().imageUploaderUrl);

    QHttpMultiPart *payload = new QHttpMultiPart(QHttpMultiPart::FormDataType);
    QHttpPart part = QHttpPart();
{'fraction_non_alphanumeric': 0.11258027956176804, 'fraction_numerical': 0.0037778617302606727, 'mean_word_length': 4.349494949494949, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '744178', 'n_tokens_mistral': 830, 'n_tokens_neox': 818, 'n_words': 181}