Merge branch 'develop' into opensubsonic-extra-fields
This commit is contained in:
@@ -491,7 +491,7 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug)
|
|||||||
//MP4
|
//MP4
|
||||||
else if (TagLib::MP4::File* mp4File {dynamic_cast<TagLib::MP4::File*>(f.file())})
|
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()};
|
TagLib::MP4::CoverArtList coverArtList {coverItem.toCoverArtList()};
|
||||||
if (!coverArtList.isEmpty())
|
if (!coverArtList.isEmpty())
|
||||||
track.hasCover = true;
|
track.hasCover = true;
|
||||||
|
|||||||
+1
-6
@@ -277,14 +277,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
Service<Scrobbling::IScrobblingService> scrobblingService {Scrobbling::createScrobblingService(ioContext, database)};
|
Service<Scrobbling::IScrobblingService> scrobblingService {Scrobbling::createScrobblingService(ioContext, database)};
|
||||||
|
|
||||||
std::unique_ptr<Wt::WResource> subsonicResource;
|
|
||||||
|
|
||||||
// bind API resources
|
// bind API resources
|
||||||
if (config->getBool("api-subsonic", true))
|
if (config->getBool("api-subsonic", true))
|
||||||
{
|
server.addResource(API::Subsonic::createSubsonicResource(database), "/rest");
|
||||||
subsonicResource = API::Subsonic::createSubsonicResource(database);
|
|
||||||
server.addResource(subsonicResource.get(), "/rest");
|
|
||||||
}
|
|
||||||
|
|
||||||
// bind UI entry point
|
// bind UI entry point
|
||||||
server.addEntryPoint(Wt::EntryPointType::Application,
|
server.addEntryPoint(Wt::EntryPointType::Application,
|
||||||
|
|||||||
+10
-10
@@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
#include <Wt/Http/Cookie.h>
|
||||||
#include <Wt/WEnvironment.h>
|
#include <Wt/WEnvironment.h>
|
||||||
|
#include <Wt/WCheckBox.h>
|
||||||
#include <Wt/WFormModel.h>
|
#include <Wt/WFormModel.h>
|
||||||
#include <Wt/WLineEdit.h>
|
#include <Wt/WLineEdit.h>
|
||||||
#include <Wt/WCheckBox.h>
|
|
||||||
#include <Wt/WPushButton.h>
|
#include <Wt/WPushButton.h>
|
||||||
#include <Wt/WRandom.h>
|
|
||||||
|
|
||||||
#include "services/auth/IAuthTokenService.hpp"
|
#include "services/auth/IAuthTokenService.hpp"
|
||||||
#include "services/auth/IPasswordService.hpp"
|
#include "services/auth/IPasswordService.hpp"
|
||||||
@@ -50,16 +50,12 @@ void
|
|||||||
createAuthToken(Database::UserId userId, const Wt::WDateTime& expiry)
|
createAuthToken(Database::UserId userId, const Wt::WDateTime& expiry)
|
||||||
{
|
{
|
||||||
const std::string secret {Service<::Auth::IAuthTokenService>::get()->createAuthToken(userId, 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,
|
LmsApp->setCookie(cookie);
|
||||||
secret,
|
|
||||||
expiry.toTime_t() - Wt::WDateTime::currentDateTime().toTime_t(),
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
LmsApp->environment().urlScheme() == "https");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::optional<Database::UserId>
|
std::optional<Database::UserId>
|
||||||
processAuthToken(const Wt::WEnvironment& env)
|
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::Denied:
|
||||||
case ::Auth::IAuthTokenService::AuthTokenProcessResult::State::Throttled:
|
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;
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
case ::Auth::IAuthTokenService::AuthTokenProcessResult::State::Granted:
|
case ::Auth::IAuthTokenService::AuthTokenProcessResult::State::Granted:
|
||||||
createAuthToken(res.authTokenInfo->userId, res.authTokenInfo->expiry);
|
createAuthToken(res.authTokenInfo->userId, res.authTokenInfo->expiry);
|
||||||
|
|||||||
Reference in New Issue
Block a user