mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 00:24:12 +02:00
*Api_v1 serves static files as requested when whitelisted.
This commit is contained in:
@@ -316,13 +316,19 @@ void
|
|||||||
Api_v1::staticdata( QxtWebRequestEvent* event, const QString& str )
|
Api_v1::staticdata( QxtWebRequestEvent* event, const QString& str )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << "STATIC request:" << event << str;
|
tDebug( LOGVERBOSE ) << "STATIC request:" << event << str;
|
||||||
if ( str.contains( "tomahawk_auth_logo.png" ) )
|
|
||||||
|
bool whitelisted = ( str == QString( "tomahawk_auth_logo.png" ) );
|
||||||
|
if ( whitelisted )
|
||||||
{
|
{
|
||||||
QFile f( RESPATH "www/tomahawk_banner_small.png" );
|
QFile f( RESPATH "www/" + str );
|
||||||
f.open( QIODevice::ReadOnly );
|
f.open( QIODevice::ReadOnly );
|
||||||
QByteArray data = f.readAll();
|
QByteArray data = f.readAll();
|
||||||
QxtWebPageEvent * e = new QxtWebPageEvent( event->sessionID, event->requestID, data );
|
|
||||||
e->contentType = "image/png";
|
QxtWebPageEvent* e = new QxtWebPageEvent( event->sessionID, event->requestID, data );
|
||||||
|
|
||||||
|
if ( str.endsWith( ".png" ) )
|
||||||
|
e->contentType = "image/png";
|
||||||
|
|
||||||
postEvent( e );
|
postEvent( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ public slots:
|
|||||||
void stat( QxtWebRequestEvent* event );
|
void stat( QxtWebRequestEvent* event );
|
||||||
void statResult( const QString& clientToken, const QString& name, bool valid );
|
void statResult( const QString& clientToken, const QString& name, bool valid );
|
||||||
void resolve( QxtWebRequestEvent* event );
|
void resolve( QxtWebRequestEvent* event );
|
||||||
void staticdata( QxtWebRequestEvent* event,const QString& );
|
void staticdata( QxtWebRequestEvent* event, const QString& str );
|
||||||
void get_results( QxtWebRequestEvent* event );
|
void get_results( QxtWebRequestEvent* event );
|
||||||
void sendJSON( const QVariantMap& m, QxtWebRequestEvent* event );
|
void sendJSON( const QVariantMap& m, QxtWebRequestEvent* event );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user