From 1328a34e51e0a14aae8dbfe6469cc580ee739bce Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 Jun 2022 22:56:52 +0200 Subject: flameshot: make imgur great again --- krebs/5pkgs/override/default.nix | 19 +++--------- .../flameshot/flameshot_imgur_0.10.2.patch | 35 ++++++++++++++++++++++ .../override/flameshot/flameshot_imgur_0.6.0.patch | 34 --------------------- .../override/flameshot/flameshot_imgur_0.9.0.patch | 35 ---------------------- 4 files changed, 39 insertions(+), 84 deletions(-) create mode 100644 krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch delete mode 100644 krebs/5pkgs/override/flameshot/flameshot_imgur_0.6.0.patch delete mode 100644 krebs/5pkgs/override/flameshot/flameshot_imgur_0.9.0.patch diff --git a/krebs/5pkgs/override/default.nix b/krebs/5pkgs/override/default.nix index 1dd694b70..ae42bc1a3 100644 --- a/krebs/5pkgs/override/default.nix +++ b/krebs/5pkgs/override/default.nix @@ -17,21 +17,10 @@ self: super: { repo = "flameshot"; rev = "v${version}"; sha256 = "sha256-rZUiaS32C77tFJmEkw/9MGbVTVscb6LOCyWaWO5FyR4="; - }; - patches = old.patches or [] ++ { - "0.6.0" = [ - ./flameshot/flameshot_imgur_0.6.0.patch - ]; - "0.9.0" = [ - ./flameshot/flameshot_imgur_0.9.0.patch - ]; - "0.10.1" = [ - ./flameshot/flameshot_imgur_0.9.0.patch - ]; - "0.10.2" = [ - ./flameshot/flameshot_imgur_0.9.0.patch - ]; - }.${old.version} or []; + }; + patches = old.patches or [] ++ [ + ./flameshot/flameshot_imgur_0.10.2.patch + ]; }); # https://github.com/proot-me/PRoot/issues/106 diff --git a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch new file mode 100644 index 000000000..c4c0bf38a --- /dev/null +++ b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch @@ -0,0 +1,35 @@ +--- a/src/tools/imgur/imguruploader.cpp ++++ b/src/tools/imgur/imguruploader.cpp +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent) + : QWidget(parent) +@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply) + m_imageURL.setUrl(data[QStringLiteral("link")].toString()); + + auto deleteToken = data[QStringLiteral("deletehash")].toString(); ++ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL"); ++ if (deleteImageURLPattern == NULL) ++ deleteImageURLPattern = "https://imgur.com/delete/%1"; + m_deleteImageURL.setUrl( +- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken)); ++ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken)); + + // save history + QString imageName = m_imageURL.toString(); +@@ -133,7 +137,10 @@ void ImgurUploader::upload() + QString description = FileNameHandler().parsedPattern(); + urlQuery.addQueryItem(QStringLiteral("description"), description); + +- QUrl url(QStringLiteral("https://api.imgur.com/3/image")); ++ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL"); ++ if (createImageURLPattern == NULL) ++ createImageURLPattern = "https://api.imgur.com/3/image"; ++ QUrl url(QString::fromUtf8(createImageURLPattern)); + url.setQuery(urlQuery); + QNetworkRequest request(url); + request.setHeader(QNetworkRequest::ContentTypeHeader, diff --git a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.6.0.patch b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.6.0.patch deleted file mode 100644 index 92023554a..000000000 --- a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.6.0.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/src/tools/imgur/imguruploader.cpp -+++ b/src/tools/imgur/imguruploader.cpp -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - - ImgurUploader::ImgurUploader(const QPixmap &capture, QWidget *parent) : - QWidget(parent), m_pixmap(capture) -@@ -74,7 +75,10 @@ void ImgurUploader::handleReply(QNetworkReply *reply) { - QJsonObject json = response.object(); - QJsonObject data = json["data"].toObject(); - m_imageURL.setUrl(data["link"].toString()); -- m_deleteImageURL.setUrl(QString("https://imgur.com/delete/%1").arg( -+ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL"); -+ if (deleteImageURLPattern == NULL) -+ deleteImageURLPattern = "https://imgur.com/delete/%1"; -+ m_deleteImageURL.setUrl(QString(deleteImageURLPattern).arg( - data["deletehash"].toString())); - onUploadOk(); - } else { -@@ -105,7 +109,10 @@ void ImgurUploader::upload() { - QString description = FileNameHandler().parsedPattern(); - urlQuery.addQueryItem("description", description); - -- QUrl url("https://api.imgur.com/3/image"); -+ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL"); -+ if (createImageURLPattern == NULL) -+ createImageURLPattern = "https://api.imgur.com/3/image"; -+ QUrl url(createImageURLPattern); - url.setQuery(urlQuery); - QNetworkRequest request(url); - request.setHeader(QNetworkRequest::ContentTypeHeader, diff --git a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.9.0.patch b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.9.0.patch deleted file mode 100644 index c4c0bf38a..000000000 --- a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.9.0.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/src/tools/imgur/imguruploader.cpp -+++ b/src/tools/imgur/imguruploader.cpp -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - - ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent) - : QWidget(parent) -@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply) - m_imageURL.setUrl(data[QStringLiteral("link")].toString()); - - auto deleteToken = data[QStringLiteral("deletehash")].toString(); -+ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL"); -+ if (deleteImageURLPattern == NULL) -+ deleteImageURLPattern = "https://imgur.com/delete/%1"; - m_deleteImageURL.setUrl( -- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken)); -+ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken)); - - // save history - QString imageName = m_imageURL.toString(); -@@ -133,7 +137,10 @@ void ImgurUploader::upload() - QString description = FileNameHandler().parsedPattern(); - urlQuery.addQueryItem(QStringLiteral("description"), description); - -- QUrl url(QStringLiteral("https://api.imgur.com/3/image")); -+ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL"); -+ if (createImageURLPattern == NULL) -+ createImageURLPattern = "https://api.imgur.com/3/image"; -+ QUrl url(QString::fromUtf8(createImageURLPattern)); - url.setQuery(urlQuery); - QNetworkRequest request(url); - request.setHeader(QNetworkRequest::ContentTypeHeader, -- cgit v1.2.3