Removed some unused Wt stuff to make the docker image lighter

This commit is contained in:
emeric
2022-05-25 20:10:28 +02:00
parent 4c55913fac
commit d13cb3e0ad
9 changed files with 77 additions and 154 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM alpine:edge FROM --platform=$BUILDPLATFORM alpine:3.16
ARG BUILD_PACKAGES="\ ARG BUILD_PACKAGES="\
clang \ clang \
+8 -3
View File
@@ -1,4 +1,4 @@
FROM alpine:3.14 AS build FROM alpine:3.16 AS build
WORKDIR /tmp/workdir WORKDIR /tmp/workdir
@@ -77,7 +77,7 @@ RUN \
make distclean make distclean
# WT # WT
ARG WT_VERSION=4.7.0 ARG WT_VERSION=4.7.2
RUN \ RUN \
DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \ DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://github.com/emweb/wt/archive/${WT_VERSION}.tar.gz && \ curl -sLO https://github.com/emweb/wt/archive/${WT_VERSION}.tar.gz && \
@@ -126,8 +126,13 @@ RUN \
rm -rf /tmp/fakeroot/share/doc && \ rm -rf /tmp/fakeroot/share/doc && \
rm -rf /tmp/fakeroot/share/man rm -rf /tmp/fakeroot/share/man
# Remove useless stuff
RUN \
rm -rf /tmp/fakeroot/share/Wt/resources/jPlayer \
rm -rf /tmp/fakeroot/share/Wt/resources/themes
## Release Stage ## Release Stage
FROM alpine:3.14 AS release FROM alpine:3.16 AS release
LABEL maintainer="Emeric Poupon <itmfr@yahoo.fr>" LABEL maintainer="Emeric Poupon <itmfr@yahoo.fr>"
ARG RUNTIME_PACKAGES=" \ ARG RUNTIME_PACKAGES=" \
+1 -1
View File
@@ -34,7 +34,7 @@
<input id ="lms-mp-volume-slider" class="form-range" type="range" min="0" max="1" step="0.01" value="0.8"/> <input id ="lms-mp-volume-slider" class="form-range" type="range" min="0" max="1" step="0.01" value="0.8"/>
</div> </div>
<div class="d-none d-sm-block text-muted text-nowrap"> <div class="d-none d-sm-block text-muted text-nowrap">
<span id="lms-transcoding-active" title="${tr:Lms.Player.transcoding-active}" style="visibility:hidden"><i class="fa fa-fw fa-info-circle" aria-hidden="true"></i></span> <span id="lms-transcoding-active" title="${tr:Lms.Player.transcoding-active}" class="p-2" style="visibility:hidden"><i class="fa fa-fw fa-info-circle" aria-hidden="true"></i></span>
<span id="lms-mp-curtime">--</span> / <span id="lms-mp-duration">--</span> <span id="lms-mp-curtime">--</span> / <span id="lms-mp-duration">--</span>
</div> </div>
</div> </div>
File diff suppressed because one or more lines are too long
-1
View File
@@ -2,7 +2,6 @@
add_executable(lms add_executable(lms
main.cpp main.cpp
ui/Auth.cpp ui/Auth.cpp
ui/Bootstrap5Theme.cpp
ui/LmsApplication.cpp ui/LmsApplication.cpp
ui/LmsApplicationManager.cpp ui/LmsApplicationManager.cpp
ui/LmsTheme.cpp ui/LmsTheme.cpp
-77
View File
@@ -1,77 +0,0 @@
/*
* Copyright (C) 2020 Emweb bv, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include "Bootstrap5Theme.h"
#include <Wt/WApplication.h>
#include <Wt/WLinkedCssStyleSheet.h>
#include <Wt/WText.h>
namespace UserInterface
{
void
Bootstrap5Theme::init(Wt::WApplication* app) const
{
app->require(resourcesUrl() + "js/bootstrap.bundle.min.js");
Wt::WString v = app->metaHeader(Wt::MetaHeaderType::Meta, "viewport");
if (v.empty())
app->addMetaHeader("viewport", "width=device-width, initial-scale=1");
}
std::string
Bootstrap5Theme::name() const
{
return "bootstrap5";
}
std::string
Bootstrap5Theme::resourcesUrl() const
{
return Wt::WApplication::relativeResourcesUrl() + "themes/bootstrap/5/";
}
std::vector<Wt::WLinkedCssStyleSheet>
Bootstrap5Theme::styleSheets() const
{
std::vector<Wt::WLinkedCssStyleSheet> result;
const std::string themeDir {resourcesUrl()};
result.emplace_back(Wt::WLink {themeDir + "css/bootstrap.min.css"});
result.emplace_back(Wt::WLink {themeDir + "wt.css"});
return result;
}
std::string
Bootstrap5Theme::utilityCssClass(int utilityCssClassRole) const
{
switch (utilityCssClassRole) {
case Wt::ToolTipInner:
return "tooltip-inner";
case Wt::ToolTipOuter:
return "tooltip fade top in";
default:
return "";
}
}
void Bootstrap5Theme::applyValidationStyle(Wt::WWidget* widget, const Wt::WValidator::Result& validation, Wt::WFlags<Wt::ValidationStyleFlag> styles) const
{
{
const bool validStyle {(validation.state() == Wt::ValidationState::Valid) && styles.test(Wt::ValidationStyleFlag::ValidStyle)};
widget->toggleStyleClass("is-valid", validStyle);
}
{
const bool invalidStyle {(validation.state() != Wt::ValidationState::Valid) && styles.test(Wt::ValidationStyleFlag::InvalidStyle)};
widget->toggleStyleClass("is-invalid", invalidStyle);
}
}
} // namespace UserInterface
-45
View File
@@ -1,45 +0,0 @@
/*
* Copyright (C) 2022 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 <Wt/WTheme.h>
namespace UserInterface
{
class Bootstrap5Theme : public Wt::WTheme
{
private:
void init(Wt::WApplication *app) const override;
std::string name() const override;
std::string resourcesUrl() const override;
std::vector<Wt::WLinkedCssStyleSheet> styleSheets() const override;
void apply(Wt::WWidget*, Wt::WWidget*, int) const override {};
void apply(Wt::WWidget*, Wt::DomElement&, int) const override {};
std::string disabledClass() const override { return "disabled"; }
std::string activeClass() const override { return "active"; };
std::string utilityCssClass(int utilityCssClassRole) const override;
bool canStyleAnchorAsButton() const override { return true; };
void applyValidationStyle(Wt::WWidget* widget,
const Wt::WValidator::Result& validation,
Wt::WFlags<Wt::ValidationStyleFlag> flags) const override;
bool canBorderBoxElement(const Wt::DomElement&) const override { return true; }
};
}
+43 -19
View File
@@ -1,38 +1,62 @@
/* /*
* Copyright (C) 2020 Emeric Poupon * Copyright (C) 2020 Emweb bv, Herent, Belgium.
* *
* This file is part of LMS. * See the LICENSE file for terms of use.
*
* 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 "LmsTheme.hpp" #include "LmsTheme.hpp"
#include "utils/Logger.hpp" #include <Wt/WApplication.h>
#include "LmsApplication.hpp" #include <Wt/WLinkedCssStyleSheet.h>
namespace UserInterface namespace UserInterface
{ {
void
LmsTheme::init(Wt::WApplication* app) const
{
app->require("js/bootstrap.bundle.min.js");
Wt::WString v = app->metaHeader(Wt::MetaHeaderType::Meta, "viewport");
if (v.empty())
app->addMetaHeader("viewport", "width=device-width, initial-scale=1, user-scalable=no");
}
std::string
LmsTheme::name() const
{
return "bootstrap5";
}
std::string
LmsTheme::resourcesUrl() const
{
return "";
}
std::vector<Wt::WLinkedCssStyleSheet> std::vector<Wt::WLinkedCssStyleSheet>
LmsTheme::styleSheets() const LmsTheme::styleSheets() const
{ {
static const std::vector<Wt::WLinkedCssStyleSheet> files static const std::vector<Wt::WLinkedCssStyleSheet> files
{ {
{"css/bootstrap.solar.min.css"}, {"css/bootstrap.solar.min.css"}, // TODO parametrize this
{"css/lms.css"}, {"css/lms.css"},
}; };
return files; return files;
} }
}
void LmsTheme::applyValidationStyle(Wt::WWidget* widget, const Wt::WValidator::Result& validation, Wt::WFlags<Wt::ValidationStyleFlag> styles) const
{
{
const bool validStyle {(validation.state() == Wt::ValidationState::Valid) && styles.test(Wt::ValidationStyleFlag::ValidStyle)};
widget->toggleStyleClass("is-valid", validStyle);
}
{
const bool invalidStyle {(validation.state() != Wt::ValidationState::Valid) && styles.test(Wt::ValidationStyleFlag::InvalidStyle)};
widget->toggleStyleClass("is-invalid", invalidStyle);
}
}
} // namespace UserInterface
+17 -7
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020 Emeric Poupon * Copyright (C) 2022 Emeric Poupon
* *
* This file is part of LMS. * This file is part of LMS.
* *
@@ -19,17 +19,27 @@
#pragma once #pragma once
#include <vector> #include <Wt/WTheme.h>
#include <Wt/WLinkedCssStyleSheet.h>
#include "Bootstrap5Theme.h"
namespace UserInterface namespace UserInterface
{ {
class LmsTheme : public Bootstrap5Theme class LmsTheme : public Wt::WTheme
{ {
private: private:
void init(Wt::WApplication *app) const override;
std::string name() const override;
std::string resourcesUrl() const override;
std::vector<Wt::WLinkedCssStyleSheet> styleSheets() const override; std::vector<Wt::WLinkedCssStyleSheet> styleSheets() const override;
static std::vector<Wt::WLink> getStyleSheets(); void apply(Wt::WWidget*, Wt::WWidget*, int) const override {};
void apply(Wt::WWidget*, Wt::DomElement&, int) const override {};
std::string disabledClass() const override { return "disabled"; }
std::string activeClass() const override { return "active"; };
std::string utilityCssClass(int) const override { return ""; };
bool canStyleAnchorAsButton() const override { return true; };
void applyValidationStyle(Wt::WWidget* widget,
const Wt::WValidator::Result& validation,
Wt::WFlags<Wt::ValidationStyleFlag> flags) const override;
bool canBorderBoxElement(const Wt::DomElement&) const override { return true; }
}; };
} }