fix flameshot 0x0 patch

This commit is contained in:
krizej 2024-11-08 22:02:57 +01:00
parent 281ec88147
commit be6f324934
2 changed files with 9 additions and 6 deletions

View file

@ -33,7 +33,7 @@ index c7eadcad..a0e27094 100644
}); });
} }
diff --git a/src/tools/imgupload/storages/imgur/imguruploader.cpp b/src/tools/imgupload/storages/imgur/imguruploader.cpp diff --git a/src/tools/imgupload/storages/imgur/imguruploader.cpp b/src/tools/imgupload/storages/imgur/imguruploader.cpp
index d6748b5a..ae80c659 100644 index d6748b5a..7ea3bddd 100644
--- a/src/tools/imgupload/storages/imgur/imguruploader.cpp --- a/src/tools/imgupload/storages/imgur/imguruploader.cpp
+++ b/src/tools/imgupload/storages/imgur/imguruploader.cpp +++ b/src/tools/imgupload/storages/imgur/imguruploader.cpp
@@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
@ -45,10 +45,11 @@ index d6748b5a..ae80c659 100644
ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent) ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
: ImgUploaderBase(capture, parent) : ImgUploaderBase(capture, parent)
@@ -32,25 +34,8 @@ void ImgurUploader::handleReply(QNetworkReply* reply) @@ -31,26 +33,10 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
{
spinner()->deleteLater(); spinner()->deleteLater();
m_currentImageName.clear(); m_currentImageName.clear();
if (reply->error() == QNetworkReply::NoError) { - if (reply->error() == QNetworkReply::NoError) {
- QJsonDocument response = QJsonDocument::fromJson(reply->readAll()); - QJsonDocument response = QJsonDocument::fromJson(reply->readAll());
- QJsonObject json = response.object(); - QJsonObject json = response.object();
- QJsonObject data = json[QStringLiteral("data")].toObject(); - QJsonObject data = json[QStringLiteral("data")].toObject();
@ -62,18 +63,19 @@ index d6748b5a..ae80c659 100644
- if (lastSlash >= 0) { - if (lastSlash >= 0) {
- m_currentImageName = m_currentImageName.mid(lastSlash + 1); - m_currentImageName = m_currentImageName.mid(lastSlash + 1);
- } - }
-
- // save image to history - // save image to history
- History history; - History history;
- m_currentImageName = - m_currentImageName =
- history.packFileName("imgur", deleteToken, m_currentImageName); - history.packFileName("imgur", deleteToken, m_currentImageName);
- history.save(pixmap(), m_currentImageName); - history.save(pixmap(), m_currentImageName);
+ if (reply->error() == QNetworkReply::NoError) {
+ QString img_url = QString(reply->readAll().toStdString().c_str()).trimmed(); + QString img_url = QString(reply->readAll().toStdString().c_str()).trimmed();
+ setImageURL(img_url); + setImageURL(img_url);
emit uploadOk(imageURL()); emit uploadOk(imageURL());
} else { } else {
@@ -65,22 +50,18 @@ void ImgurUploader::upload() @@ -65,22 +51,20 @@ void ImgurUploader::upload()
QBuffer buffer(&byteArray); QBuffer buffer(&byteArray);
pixmap().save(&buffer, "PNG"); pixmap().save(&buffer, "PNG");
@ -101,6 +103,8 @@ index d6748b5a..ae80c659 100644
- .toUtf8()); - .toUtf8());
- m_NetworkAM->post(request, byteArray); - m_NetworkAM->post(request, byteArray);
+ request.setHeader(QNetworkRequest::UserAgentHeader, QVariant("Flameshot/https://git.jacekpoz.pl/krizej/nix/src/branch/master/files/flameshot-0x0-upload.patch"));
+
+ m_NetworkAM->post(request, multiPart); + m_NetworkAM->post(request, multiPart);
} }

View file

@ -1,4 +1,3 @@
- FIX FLAMESHOT 0X0.ST UPLOAD!!!
- clean up modules/system.nix - clean up modules/system.nix
- investigate firefox config - investigate firefox config
- all the remaining individual todos - all the remaining individual todos