Fixed upload to Imgur Drop debug package use secure VCS uris add hardening=+all make builds reproducible (Closes: #813167)ubuntu/disco debian/1.95+20160128-1
parent
b9ad1df2b1
commit
68505468fb
@ -1,21 +1,15 @@
|
||||
#!/usr/bin/make -f
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
|
||||
%:
|
||||
dh $@ --buildsystem=cmake --parallel
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- DESTDIR=$(CURDIR)/debian/screengrab
|
||||
|
||||
override_dh_install:
|
||||
rm -f $(currdir)/debian/screengrab/usr/share/doc/screengrab/LICENSE.txt
|
||||
dh_install
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package screengrab-dbg
|
||||
|
||||
|
||||
override_dh_makeshlibs:
|
||||
# do nothing
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,137 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader_mediacrush.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QtNetwork/QHttpMultiPart>
|
||||
#include <QtNetwork/QHttpPart>
|
||||
|
||||
#include "uploaderconfig.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
Uploader_MediaCrush::Uploader_MediaCrush(const QString& format, QObject* parent): Uploader(parent)
|
||||
{
|
||||
_host = "mediacru.sh";
|
||||
qDebug() << " create MediaCrush uploader";
|
||||
UpdateUploadedStrList();
|
||||
setCurrentFormat(format);
|
||||
}
|
||||
|
||||
Uploader_MediaCrush::~Uploader_MediaCrush()
|
||||
{
|
||||
qDebug() << " kill MediaCrush uploader";
|
||||
}
|
||||
|
||||
/*!
|
||||
* Start upload process
|
||||
*/
|
||||
void Uploader_MediaCrush::startUploading()
|
||||
{
|
||||
createData();
|
||||
createRequest(imageData, apiUrl());
|
||||
|
||||
_request.setRawHeader("Host", _host);
|
||||
Uploader::startUploading();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set type of uploading image, for generate right direct link on it.
|
||||
*/
|
||||
void Uploader_MediaCrush::setCurrentFormat(const QString& format)
|
||||
{
|
||||
_currentFormat = format.toLatin1();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Return url for upload image
|
||||
*/
|
||||
QUrl Uploader_MediaCrush::apiUrl()
|
||||
{
|
||||
UploaderConfig config;
|
||||
// QUrl("https://mediacru.sh/api/upload/file")
|
||||
|
||||
return config.loadSingleParam("mediacru.sh", KEY_MCSH_URL).toUrl();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Prepare image data for uploading
|
||||
*/
|
||||
void Uploader_MediaCrush::createData(bool inBase64)
|
||||
{
|
||||
Uploader::createData(inBase64);
|
||||
|
||||
_multipartData = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
||||
|
||||
QHttpPart imagePart;
|
||||
if (_formatString == "jpg")
|
||||
{
|
||||
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
|
||||
}
|
||||
else
|
||||
{
|
||||
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/" + _formatString));
|
||||
}
|
||||
QByteArray disposition = "form-data; name=\"file\"; filename='"+ _uploadFilename.toLatin1() +"'";
|
||||
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(disposition));
|
||||
imagePart.setBody(imageData);
|
||||
|
||||
_multipartData->append(imagePart);
|
||||
|
||||
imageData.clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Process server reply data
|
||||
*/
|
||||
void Uploader_MediaCrush::replyFinished(QNetworkReply* reply)
|
||||
{
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QByteArray response = reply->readAll();
|
||||
|
||||
if (response.split(':').count() >= 2)
|
||||
{
|
||||
response = response.split(':').at(1);
|
||||
response = response.mid(2, 12);
|
||||
}
|
||||
|
||||
_uploadedStrings[UL_DIRECT_LINK].first = "https://" + _host + "/" + response + "." + _currentFormat;
|
||||
_uploadedStrings[UL_DELETE_URL].first = "https://" + _host + "/" + response + "/delete";
|
||||
|
||||
Q_EMIT uploadDoneStr(_uploadedStrings[UL_DIRECT_LINK].first);
|
||||
Q_EMIT uploadDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_EMIT uploadFail(reply->errorString().toLatin1());
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
void Uploader_MediaCrush::UpdateUploadedStrList()
|
||||
{
|
||||
QStringList nonUsed = QStringList() << UL_BB_CODE << UL_BB_CODE_THUMB << UL_HTML_CODE << UL_HTML_CODE_THUMB;
|
||||
|
||||
for (int i =0; i < nonUsed.count(); ++i)
|
||||
{
|
||||
_uploadedStrings.remove(nonUsed.at(i).toLatin1());
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_MEDIACRUSH_H
|
||||
#define UPLOADER_MEDIACRUSH_H
|
||||
|
||||
#include <uploader.h>
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
class Uploader_MediaCrush : public Uploader
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Uploader_MediaCrush(const QString& format, QObject* parent = 0);
|
||||
virtual ~Uploader_MediaCrush();
|
||||
|
||||
virtual void startUploading();
|
||||
|
||||
protected:
|
||||
virtual QUrl apiUrl();
|
||||
virtual void createData(bool inBase64 = false);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void replyFinished(QNetworkReply* reply);
|
||||
|
||||
private:
|
||||
void setCurrentFormat(const QString& format);
|
||||
|
||||
QByteArray _host;
|
||||
QByteArray _currentFormat;
|
||||
void UpdateUploadedStrList();
|
||||
};
|
||||
|
||||
#endif // UPLOADER_MEDIACRUSH_H
|
||||
|
@ -1,32 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader_mediacrush_widget.h"
|
||||
#include "ui_uploader_mediacrush_widget.h"
|
||||
|
||||
Uploader_MediaCrush_Widget::Uploader_MediaCrush_Widget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Uploader_MediaCrush_Widget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
Uploader_MediaCrush_Widget::~Uploader_MediaCrush_Widget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_MEDIACRUSH_WIDGET_H
|
||||
#define UPLOADER_MEDIACRUSH_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class Uploader_MediaCrush_Widget;
|
||||
}
|
||||
|
||||
class Uploader_MediaCrush_Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Uploader_MediaCrush_Widget(QWidget *parent = 0);
|
||||
~Uploader_MediaCrush_Widget();
|
||||
|
||||
private:
|
||||
Ui::Uploader_MediaCrush_Widget *ui;
|
||||
};
|
||||
|
||||
#endif // UPLOADER_MEDIACRUSH_WIDGET_H
|
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Uploader_MediaCrush_Widget</class>
|
||||
<widget class="QWidget" name="Uploader_MediaCrush_Widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>417</width>
|
||||
<height>203</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="text">
|
||||
<string>Upload to MediaCrush</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>168</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,56 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploaderconfigwidget_mediacrush.h"
|
||||
#include "ui_uploaderconfigwidget_mediacrush.h"
|
||||
|
||||
#include "uploaderconfig.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
UploaderConfigWidget_MediaCrush::UploaderConfigWidget_MediaCrush(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::UploaderConfigWidget_MediaCrush)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// load settings
|
||||
UploaderConfig config;
|
||||
|
||||
QVariantMap loadedValues;
|
||||
loadedValues.insert(KEY_MCSH_URL, "");
|
||||
|
||||
loadedValues = config.loadSettings("mediacru.sh", loadedValues);
|
||||
ui->editUrl->setText(loadedValues[KEY_MCSH_URL].toString());
|
||||
|
||||
}
|
||||
|
||||
UploaderConfigWidget_MediaCrush::~UploaderConfigWidget_MediaCrush()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void UploaderConfigWidget_MediaCrush::saveSettings()
|
||||
{
|
||||
UploaderConfig config;
|
||||
|
||||
QVariantMap savingValues;
|
||||
savingValues.insert(KEY_MCSH_URL, ui->editUrl->text());
|
||||
|
||||
config.saveSettings("mediacru.sh", savingValues);
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADERCONFIGWIDGET_MEDIACRUSH_H
|
||||
#define UPLOADERCONFIGWIDGET_MEDIACRUSH_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class UploaderConfigWidget_MediaCrush;
|
||||
}
|
||||
|
||||
class UploaderConfigWidget_MediaCrush : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UploaderConfigWidget_MediaCrush(QWidget *parent = 0);
|
||||
~UploaderConfigWidget_MediaCrush();
|
||||
|
||||
public Q_SLOTS:
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
Ui::UploaderConfigWidget_MediaCrush *ui;
|
||||
};
|
||||
|
||||
#endif // UPLOADERCONFIGWIDGET_MEDIACRUSH_H
|
@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UploaderConfigWidget_MediaCrush</class>
|
||||
<widget class="QWidget" name="UploaderConfigWidget_MediaCrush">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="text">
|
||||
<string>Configuration for mediacru.sh upload</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDesclabUrlription">
|
||||
<property name="text">
|
||||
<string>URL forupload</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editUrl"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDescription">
|
||||
<property name="text">
|
||||
<string>Central server MediaCrush is down, but you can set up self-hosted instance. And add here url to it.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labUrlExample">
|
||||
<property name="text">
|
||||
<string notr="true">e.g. "https://mediacru.sh/api/upload/file"</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>87</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in new issue