I hoped this fixes video uploading but nope

This commit is contained in:
ArsenArsen 2017-06-27 23:44:31 +02:00
parent 5d528b2435
commit cb45fff054
2 changed files with 9 additions and 3 deletions

View File

@ -17,7 +17,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;p style=&quot;vertical-align:middle;&quot;&gt;&lt;img src=&quot;:/icons/icon.svg&quot; width=&quot;50&quot;/&gt;&lt;span style=&quot;font-weight:600;&quot;&gt; KShare&lt;/span&gt; - The open source and cross platform screen sharing software&lt;/p&gt;&lt;p&gt;Version %0&lt;br&gt;Links: &lt;a href=&quot;https://github.com/ArsenArsen/KShare&quot;&gt;Source code&lt;/a&gt;, &lt;a href=&quot;https://github.com/ArsenArsen/KShare/issues&quot;&gt;Issue tracker&lt;/a&gt;, &lt;a href=&quot;http://kshare.arsenarsen.com&quot;&gt;Website&lt;/a&gt;, &lt;a href=&quot;https://patreon.com/arsen&quot;&gt;Patreon&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/icons/icon.svg&quot; width=&quot;50&quot; style=&quot;vertical-align: middle;&quot;/&gt;&lt;span style=&quot; font-weight:600; vertical-align:middle;&quot;&gt; KShare&lt;/span&gt;&lt;span style=&quot; vertical-align:middle;&quot;&gt; - The free and open source and cross platform screen sharing software&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Version %0&lt;br/&gt;Links: &lt;a href=&quot;https://github.com/ArsenArsen/KShare&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Source code&lt;/span&gt;&lt;/a&gt;, &lt;a href=&quot;https://github.com/ArsenArsen/KShare/issues&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Issue tracker&lt;/span&gt;&lt;/a&gt;, &lt;a href=&quot;http://kshare.arsenarsen.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Website&lt;/span&gt;&lt;/a&gt;, &lt;a href=&quot;https://patreon.com/arsen&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Patreon&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@ -3,18 +3,24 @@
#include <QBuffer>
#include <QJsonObject>
#include <QJsonValue>
#include <formats.hpp>
#include <io/ioutils.hpp>
#include <notifications.hpp>
#include <screenshotutil.hpp>
void ImgurUploader::doUpload(QByteArray byteArray, QString) {
void ImgurUploader::doUpload(QByteArray byteArray, QString format) {
if (byteArray.size() > 1e+7) {
notifications::notify("KShare imgur Uploader ", "Failed upload! Image too big");
return;
}
QString mime;
if (formats::normalFormatFromName(format) != formats::Normal::None)
mime = formats::normalFormatMIME(formats::normalFormatFromName(format));
else
mime = formats::recordingFormatMIME(formats::recordingFormatFromName(format));
ioutils::postJson(QUrl("https://api.imgur.com/3/image"),
QList<QPair<QString, QString>>()
<< QPair<QString, QString>("Content-Type", "application/x-www-form-urlencoded")
<< QPair<QString, QString>("Content-Type", mime.toLatin1())
<< QPair<QString, QString>("Authorization", "Client-ID 8a98f183fc895da"),
byteArray, [](QJsonDocument res, QByteArray, QNetworkReply *) {
QString result = res.object()["data"].toObject()["link"].toString();