flameshot: add imgur patch for 0.9.0
For nixpkgs 21.05
This commit is contained in:
parent
12dbb95b1b
commit
c4c40afca5
@ -11,44 +11,14 @@ self: super: {
|
||||
});
|
||||
|
||||
flameshot = super.flameshot.overrideAttrs (old: rec {
|
||||
patches = old.patches or [] ++ [
|
||||
(self.writeText "flameshot-imgur.patch" /* diff */ ''
|
||||
--- a/src/tools/imgur/imguruploader.cpp
|
||||
+++ b/src/tools/imgur/imguruploader.cpp
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <QTimer>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
+#include <stdlib.h>
|
||||
|
||||
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,
|
||||
'')
|
||||
];
|
||||
patches = old.patches or [] ++ {
|
||||
"0.6.0" = [
|
||||
./flameshot/flameshot_imgur_0.6.0.patch
|
||||
];
|
||||
"0.9.0" = [
|
||||
./flameshot/flameshot_imgur_0.9.0.patch
|
||||
];
|
||||
}.${old.version};
|
||||
});
|
||||
|
||||
# https://github.com/proot-me/PRoot/issues/106
|
||||
|
34
krebs/5pkgs/override/flameshot/flameshot_imgur_0.6.0.patch
Normal file
34
krebs/5pkgs/override/flameshot/flameshot_imgur_0.6.0.patch
Normal file
@ -0,0 +1,34 @@
|
||||
--- a/src/tools/imgur/imguruploader.cpp
|
||||
+++ b/src/tools/imgur/imguruploader.cpp
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <QTimer>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
+#include <stdlib.h>
|
||||
|
||||
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,
|
35
krebs/5pkgs/override/flameshot/flameshot_imgur_0.9.0.patch
Normal file
35
krebs/5pkgs/override/flameshot/flameshot_imgur_0.9.0.patch
Normal file
@ -0,0 +1,35 @@
|
||||
--- a/src/tools/imgur/imguruploader.cpp
|
||||
+++ b/src/tools/imgur/imguruploader.cpp
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QTimer>
|
||||
#include <QUrlQuery>
|
||||
#include <QVBoxLayout>
|
||||
+#include <stdlib.h>
|
||||
|
||||
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,
|
Loading…
Reference in New Issue
Block a user