Merge branch 'develop' into opensubsonic-extra-fields

This commit is contained in:
emeric
2023-10-08 20:36:14 +02:00
3 changed files with 12 additions and 17 deletions
+1 -1
View File
@@ -491,7 +491,7 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug)
//MP4
else if (TagLib::MP4::File* mp4File {dynamic_cast<TagLib::MP4::File*>(f.file())})
{
auto& coverItem {mp4File->tag()->itemListMap()["covr"]};
TagLib::MP4::Item coverItem {mp4File->tag()->item("covr")};
TagLib::MP4::CoverArtList coverArtList {coverItem.toCoverArtList()};
if (!coverArtList.isEmpty())
track.hasCover = true;
+1 -6
View File
@@ -277,14 +277,9 @@ int main(int argc, char* argv[])
Service<Scrobbling::IScrobblingService> scrobblingService {Scrobbling::createScrobblingService(ioContext, database)};
std::unique_ptr<Wt::WResource> subsonicResource;
// bind API resources
if (config->getBool("api-subsonic", true))
{
subsonicResource = API::Subsonic::createSubsonicResource(database);
server.addResource(subsonicResource.get(), "/rest");
}
server.addResource(API::Subsonic::createSubsonicResource(database), "/rest");
// bind UI entry point
server.addEntryPoint(Wt::EntryPointType::Application,
+10 -10
View File
@@ -21,12 +21,12 @@
#include <iomanip>
#include <Wt/Http/Cookie.h>
#include <Wt/WEnvironment.h>
#include <Wt/WCheckBox.h>
#include <Wt/WFormModel.h>
#include <Wt/WLineEdit.h>
#include <Wt/WCheckBox.h>
#include <Wt/WPushButton.h>
#include <Wt/WRandom.h>
#include "services/auth/IAuthTokenService.hpp"
#include "services/auth/IPasswordService.hpp"
@@ -50,16 +50,12 @@ void
createAuthToken(Database::UserId userId, const Wt::WDateTime& expiry)
{
const std::string secret {Service<::Auth::IAuthTokenService>::get()->createAuthToken(userId, expiry)};
Wt::Http::Cookie cookie{ authCookieName, secret, expiry };
cookie.setSecure(LmsApp->environment().urlScheme() == "https");
LmsApp->setCookie(authCookieName,
secret,
expiry.toTime_t() - Wt::WDateTime::currentDateTime().toTime_t(),
"",
"",
LmsApp->environment().urlScheme() == "https");
LmsApp->setCookie(cookie);
}
std::optional<Database::UserId>
processAuthToken(const Wt::WEnvironment& env)
{
@@ -72,8 +68,12 @@ processAuthToken(const Wt::WEnvironment& env)
{
case ::Auth::IAuthTokenService::AuthTokenProcessResult::State::Denied:
case ::Auth::IAuthTokenService::AuthTokenProcessResult::State::Throttled:
LmsApp->setCookie(authCookieName, std::string {}, 0, "", "", env.urlScheme() == "https");
{
Wt::Http::Cookie cookie{ authCookieName };
cookie.setSecure(LmsApp->environment().urlScheme() == "https");
LmsApp->removeCookie(cookie);
return std::nullopt;
}
case ::Auth::IAuthTokenService::AuthTokenProcessResult::State::Granted:
createAuthToken(res.authTokenInfo->userId, res.authTokenInfo->expiry);