First iteration on adding version in the UI, ref #428

This commit is contained in:
emeric
2025-08-06 22:37:27 +02:00
parent 92a8194844
commit 934cb96164
6 changed files with 68 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.12)
project(lms)
project(lms VERSION 3.69.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules/)
+1 -1
View File
@@ -40,6 +40,7 @@
<i class="fa fa-cogs" aria-hidden="true"></i>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li class="dropdown-header">LMS ${version}</li>
<li>${media-libraries class="dropdown-item"}</li>
<li>${scan-settings class="dropdown-item"}</li>
<li>${scanner class="dropdown-item"}</li>
@@ -57,7 +58,6 @@
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li class="dropdown-header">${username}</li>
<li class="dropdown-divider"></li>
<li>${settings class="dropdown-item"}</li>
<li>${logout class="dropdown-item"}</li>
</ul>
+9
View File
@@ -2,6 +2,14 @@ pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive)
pkg_check_modules(XXHASH REQUIRED IMPORTED_TARGET libxxhash)
set(LMS_VERSION ${PROJECT_VERSION})
configure_file(
impl/Version.cpp.in
impl/Version.cpp
@ONLY
)
add_library(lmscore STATIC
impl/http/Client.cpp
impl/http/SendQueue.cpp
@@ -25,6 +33,7 @@ add_library(lmscore STATIC
impl/UUID.cpp
impl/WtLogger.cpp
impl/XxHash3.cpp
${CMAKE_CURRENT_BINARY_DIR}/impl/Version.cpp
)
target_include_directories(lmscore INTERFACE
+28
View File
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2025 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/Version.hpp"
namespace lms::core
{
std::string_view getVersion()
{
return "v" "@LMS_VERSION@";
}
} // namespace lms::core
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2025 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <string_view>
namespace lms::core
{
std::string_view getVersion();
} // namespace lms::core
+2
View File
@@ -29,6 +29,7 @@
#include "core/ILogger.hpp"
#include "core/ITraceLogger.hpp"
#include "core/Service.hpp"
#include "core/Version.hpp"
#include "database/IDb.hpp"
#include "database/IQueryPlanRecorder.hpp"
#include "database/Session.hpp"
@@ -460,6 +461,7 @@ namespace lms::ui
if (LmsApp->getUserType() == db::UserType::ADMIN)
{
navbar->setCondition("if-is-admin", true);
navbar->bindString("version", std::string{ core::getVersion() }, Wt::TextFormat::Plain);
navbar->bindNew<Wt::WAnchor>("media-libraries", Wt::WLink{ Wt::LinkType::InternalPath, "/admin/libraries" }, Wt::WString::tr("Lms.Admin.menu-media-libraries"));
navbar->bindNew<Wt::WAnchor>("scan-settings", Wt::WLink{ Wt::LinkType::InternalPath, "/admin/scan-settings" }, Wt::WString::tr("Lms.Admin.menu-scan-settings"));
navbar->bindNew<Wt::WAnchor>("scanner", Wt::WLink{ Wt::LinkType::InternalPath, "/admin/scanner" }, Wt::WString::tr("Lms.Admin.menu-scanner"));