blob: b6c3f497a373a159ae24a711ce57fd7d12e35c27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
diff --git a/src/tools/imgupload/storages/imgur/imguruploader.cpp b/src/tools/imgupload/storages/imgur/imguruploader.cpp
index d6748b5a..5bb8d7de 100644
--- a/src/tools/imgupload/storages/imgur/imguruploader.cpp
+++ b/src/tools/imgupload/storages/imgur/imguruploader.cpp
@@ -16,6 +16,7 @@
#include <QNetworkRequest>
#include <QShortcut>
#include <QUrlQuery>
+#include <stdlib.h>
ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
: ImgUploaderBase(capture, parent)
@@ -70,7 +71,13 @@ void ImgurUploader::upload()
QString description = FileNameHandler().parsedPattern();
urlQuery.addQueryItem(QStringLiteral("description"), description);
- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
+ const char *IMGUR_CREATE_URL = secure_getenv("IMGUR_CREATE_URL");
+ QString createUrlPattern =
+ IMGUR_CREATE_URL != NULL
+ ? QString::fromUtf8(IMGUR_CREATE_URL)
+ : QStringLiteral("https://api.imgur.com/3/image")
+ ;
+ QUrl url(createUrlPattern);
url.setQuery(urlQuery);
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader,
@@ -87,8 +94,14 @@ void ImgurUploader::deleteImage(const QString& fileName,
const QString& deleteToken)
{
Q_UNUSED(fileName)
+ const char *IMGUR_DELETE_URL = secure_getenv("IMGUR_DELETE_URL");
+ QString deleteImageURLPattern =
+ IMGUR_DELETE_URL != NULL
+ ? QString::fromUtf8(IMGUR_DELETE_URL)
+ : QStringLiteral("https://imgur.com/delete/%1")
+ ;
bool successful = QDesktopServices::openUrl(
- QUrl(QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken)));
+ QUrl(deleteImageURLPattern.arg(deleteToken)));
if (!successful) {
notification()->showMessage(tr("Unable to open the URL."));
}
|