mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 08:04:25 +02:00
Update loading of CryptoJS
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#include "TomahawkVersion.h"
|
#include "TomahawkVersion.h"
|
||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
@@ -214,8 +215,8 @@ JSResolver::init()
|
|||||||
// add c++ part of tomahawk javascript library
|
// add c++ part of tomahawk javascript library
|
||||||
d->engine->mainFrame()->addToJavaScriptWindowObject( "Tomahawk", d->resolverHelper );
|
d->engine->mainFrame()->addToJavaScriptWindowObject( "Tomahawk", d->resolverHelper );
|
||||||
|
|
||||||
|
// Load CrytoJS
|
||||||
{
|
{
|
||||||
// Load CrytoJS core
|
|
||||||
d->engine->setScriptPath( "cryptojs-core.js" );
|
d->engine->setScriptPath( "cryptojs-core.js" );
|
||||||
QFile jslib( RESPATH "js/cryptojs-core.js" );
|
QFile jslib( RESPATH "js/cryptojs-core.js" );
|
||||||
jslib.open( QIODevice::ReadOnly );
|
jslib.open( QIODevice::ReadOnly );
|
||||||
@@ -223,12 +224,18 @@ JSResolver::init()
|
|||||||
jslib.close();
|
jslib.close();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// Load a SHA256 implementation from CryptoJS
|
QStringList jsfiles;
|
||||||
d->engine->setScriptPath( "cryptojs-sha256.js" );
|
jsfiles << "*.js";
|
||||||
QFile jslib( RESPATH "js/cryptojs-sha256.js" );
|
QDir cryptojs( RESPATH "js/cryptojs" );
|
||||||
jslib.open( QIODevice::ReadOnly );
|
foreach ( QString jsfile, cryptojs.entryList( jsfiles ) )
|
||||||
d->engine->mainFrame()->evaluateJavaScript( jslib.readAll() );
|
{
|
||||||
jslib.close();
|
qWarning() << Q_FUNC_INFO << ( RESPATH "js/cryptojs/" + jsfile );
|
||||||
|
d->engine->setScriptPath( RESPATH "js/cryptojs/" + jsfile );
|
||||||
|
QFile jslib( RESPATH "js/cryptojs/" + jsfile );
|
||||||
|
jslib.open( QIODevice::ReadOnly );
|
||||||
|
d->engine->mainFrame()->evaluateJavaScript( jslib.readAll() );
|
||||||
|
jslib.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// Load the tomahawk javascript utilities
|
// Load the tomahawk javascript utilities
|
||||||
|
Reference in New Issue
Block a user