Skip to content

Commit

Permalink
Remove curl dep
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Oct 10, 2020
1 parent c248c21 commit 9f8679e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ jobs:
echo "KLOGG_ARCH=${{ matrix.config.arch }}" >> $GITHUB_ENV
# Install build dependencies
- name: Install curl
if: ${{ matrix.config.os == 'ubuntu' }}
run: |
sudo apt-get install libcurl4-openssl-dev
- name: Cache openssl
id: cache-openssl
if: ${{ matrix.config.os == 'windows' }}
Expand Down Expand Up @@ -165,7 +160,7 @@ jobs:
- name: Check rpm package
if: ${{ matrix.config.os == 'ubuntu' }}
run: |
docker run --rm -v "$(pwd)/$KLOGG_BUILD_ROOT/packages":/usr/local centos:7 /bin/bash -c "yum install /usr/local/klogg*.rpm"
docker run --rm -v "$(pwd)/$KLOGG_BUILD_ROOT/packages":/usr/local centos:8 /bin/bash -c "yum install -y --setopt tsflags=test /usr/local/klogg*.rpm"
- name: Linux AppImage
if: ${{ matrix.config.os == 'ubuntu' }}
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ add_subdirectory(maddy)
add_subdirectory(whereami)

set(SENTRY_BACKEND "crashpad" CACHE INTERNAL "" FORCE)
set(SENTRY_TRANSPORT "none" CACHE INTERNAL "" FORCE)
set(SENTRY_BUILD_EXAMPLES ON CACHE INTERNAL "" FORCE)
set(CRASHPAD_ENABLE_INSTALL OFF CACHE INTERNAL "" FORCE)
set(CRASHPAD_ENABLE_INSTALL_DEV OFF CACHE INTERNAL "" FORCE)
Expand Down
51 changes: 0 additions & 51 deletions src/app/crashhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <QDialogButtonBox>
#include <QDir>
#include <QHBoxLayout>
#include <QJsonDocument>
#include <QLabel>
#include <QProcess>
#include <QPushButton>
Expand Down Expand Up @@ -75,31 +74,6 @@ void logSentry( sentry_level_t level, const char* message, va_list args, void* u
PLOG( severity ).printf( message, args );
}

QJsonDocument extractJson( const QByteArray& data, int& lastOffset )
{
QJsonParseError parseError;
auto envelopeJson = QJsonDocument::fromJson( data, &parseError );
if ( parseError.error != QJsonParseError::NoError ) {
envelopeJson = QJsonDocument::fromJson( data.mid( 0, parseError.offset ) );
}

lastOffset = parseError.offset;
return envelopeJson;
}

std::vector<QJsonDocument> extractMessage( const QByteArray& envelopeString )
{
std::vector<QJsonDocument> messages;
int position = 0;
auto offset = 0;
do {
messages.push_back( extractJson( envelopeString.mid( position ), offset ) );
position += offset;
} while ( offset > 0 && position < envelopeString.size() );

return messages;
}

QDialog::DialogCode askUserConfirmation( const QString& formattedReport, const QString& reportPath )
{
auto message = std::make_unique<QLabel>();
Expand Down Expand Up @@ -161,25 +135,6 @@ QDialog::DialogCode askUserConfirmation( const QString& formattedReport, const Q
return static_cast<QDialog::DialogCode>( confirmationDialog->exec() );
}

int askUserConfirmation( sentry_envelope_t* envelope, void* )
{
size_t size_out = 0;
char* rawEnvelope = sentry_envelope_serialize( envelope, &size_out );
auto envelopeString = QByteArray( rawEnvelope );
sentry_free( rawEnvelope );

const auto messages = extractMessage( envelopeString );
QString formattedReport;
for ( const auto& message : messages ) {
formattedReport.append( QString::fromUtf8( message.toJson( QJsonDocument::Indented ) ) );
}

return askUserConfirmation( formattedReport, sentryDatabasePath().append( "/last_crash" ) )
== QDialog::Accepted
? 0
: 1;
}

void checkCrashpadReports( const QString& databasePath )
{
using namespace crashpad;
Expand Down Expand Up @@ -261,12 +216,6 @@ CrashHandler::CrashHandler()
sentry_options_set_environment( sentryOptions, "development" );
sentry_options_set_release( sentryOptions, kloggVersion().data() );

auto transport = sentry_transport_new_default();

sentry_transport_set_ask_consent_func( transport, askUserConfirmation );

sentry_options_set_transport( sentryOptions, transport );

sentry_init( sentryOptions );

sentry_set_tag( "commit", kloggCommit().data() );
Expand Down

0 comments on commit 9f8679e

Please sign in to comment.