mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
Add user agent to pong request
This commit is contained in:
@@ -623,6 +623,27 @@ crash()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const QString
|
||||||
|
operatingSystemVersionDetail()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
return QSettings( "/etc/os-release", QSettings::IniFormat ).value( "PRETTY_NAME", "Linux" ).toString();
|
||||||
|
#else
|
||||||
|
return "Unknown";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const QString
|
||||||
|
userAgentString( const QString& applicationName, const QString& applicationVersion )
|
||||||
|
{
|
||||||
|
return QString( "%1/%2 (%3)" )
|
||||||
|
.arg( applicationName )
|
||||||
|
.arg( applicationVersion )
|
||||||
|
.arg( operatingSystemVersionDetail() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
installTranslator( QObject* parent )
|
installTranslator( QObject* parent )
|
||||||
{
|
{
|
||||||
|
@@ -206,6 +206,11 @@ namespace TomahawkUtils
|
|||||||
|
|
||||||
DLLEXPORT void crash();
|
DLLEXPORT void crash();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User-Agent header helpers
|
||||||
|
*/
|
||||||
|
DLLEXPORT const QString operatingSystemVersionDetail();
|
||||||
|
DLLEXPORT const QString userAgentString( const QString& applicationName, const QString& applicationVersion );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Qt4 / Qt5 compatibility layer
|
* Qt4 / Qt5 compatibility layer
|
||||||
|
@@ -693,7 +693,13 @@ TomahawkApp::onInfoSystemReady()
|
|||||||
GlobalActionManager::instance();
|
GlobalActionManager::instance();
|
||||||
|
|
||||||
// check if our spotify playlist api server is up and running, and enable spotify playlist drops if so
|
// check if our spotify playlist api server is up and running, and enable spotify playlist drops if so
|
||||||
QNetworkReply* r = Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( SPOTIFY_PLAYLIST_API_URL "/pong" ) ) );
|
QNetworkRequest request( QUrl( SPOTIFY_PLAYLIST_API_URL "/pong" ) );
|
||||||
|
|
||||||
|
QByteArray userAgent = TomahawkUtils::userAgentString( TOMAHAWK_APPLICATION_NAME, TOMAHAWK_VERSION ).toUtf8();
|
||||||
|
tLog() << "User-Agent: " << userAgent;
|
||||||
|
request.setRawHeader( "User-Agent", userAgent );
|
||||||
|
|
||||||
|
QNetworkReply* r = Tomahawk::Utils::nam()->get( request );
|
||||||
connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) );
|
connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) );
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
Reference in New Issue
Block a user