diff --git a/src/ws.cpp b/src/ws.cpp index a75590415..f6ace2d13 100644 --- a/src/ws.cpp +++ b/src/ws.cpp @@ -32,7 +32,8 @@ #include #include -static lastfm::ws::Scheme theScheme = lastfm::ws::Http; +static lastfm::ws::Scheme theScheme = lastfm::ws::Https; +static QString theHost = LASTFM_WS_HOSTNAME; static QMap< QThread*, QNetworkAccessManager* > threadNamHash; static QSet< QThread* > ourNamSet; static QMutex namAccessMutex; @@ -96,15 +97,13 @@ lastfm::ws::setScheme( lastfm::ws::Scheme scheme ) QString lastfm::ws::host() { - QStringList const args = QCoreApplication::arguments(); - if (args.contains( "--debug")) - return "ws.staging.audioscrobbler.com"; - - int const n = args.indexOf( "--host" ); - if (n != -1 && args.count() > n+1) - return args[n+1]; + return theHost; +} - return LASTFM_WS_HOSTNAME; +void +lastfm::ws::setHost( QString host ) +{ + theHost = host; } static QUrl baseUrl() diff --git a/src/ws.h b/src/ws.h index 8d2a41e8e..e6da343d0 100644 --- a/src/ws.h +++ b/src/ws.h @@ -44,7 +44,7 @@ namespace lastfm namespace ws { - /** both of these are provided when you register at http://last.fm/api */ + /** both of these are provided when you register at https://www.last.fm/api/ */ LASTFM_DLLEXPORT extern const char* SharedSecret; LASTFM_DLLEXPORT extern const char* ApiKey; @@ -54,8 +54,8 @@ namespace lastfm /** Some webservices require authentication. See the following * documentation: - * http://www.last.fm/api/authentication - * http://www.last.fm/api/desktopauth + * https://www.last.fm/api/authentication + * https://www.last.fm/api/desktopauth * You have to authenticate and then assign to SessionKey, liblastfm does * not do that for you. Also we do not store this. You should store this! * You only need to authenticate once, and that key lasts forever! @@ -122,9 +122,10 @@ namespace lastfm LASTFM_DLLEXPORT void setScheme( Scheme scheme ); LASTFM_DLLEXPORT Scheme scheme(); + LASTFM_DLLEXPORT void setHost( QString host ); LASTFM_DLLEXPORT QString host(); - /** the map needs a method entry, as per http://last.fm/api */ + /** the map needs a method entry, as per https://www.last.fm/api/ */ LASTFM_DLLEXPORT QUrl url( QMap, bool sessionKey = true); LASTFM_DLLEXPORT QNetworkReply* get( QMap ); /** generates api sig, includes api key, and posts, don't add the api diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f85bf70a4..496fd0dd1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,9 @@ include(lastfm_add_test.cmake) include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src) +if(NOT BUILD_WITH_QT4) + find_package(Qt5Test REQUIRED) +endif() + lastfm_add_test(UrlBuilder) lastfm_add_test(Track)