diff --git a/root/app/calibre-web/cps/cwa_functions.py b/root/app/calibre-web/cps/cwa_functions.py
index 9062f6b..0769c89 100644
--- a/root/app/calibre-web/cps/cwa_functions.py
+++ b/root/app/calibre-web/cps/cwa_functions.py
@@ -19,6 +19,8 @@
from datetime import datetime
import re
+from .web import cwa_get_num_books_in_library
+
import sys
sys.path.insert(1, '/app/calibre-web-automated/scripts/')
from cwa_db import CWA_DB
@@ -27,7 +29,7 @@
library_refresh = Blueprint('library_refresh', __name__)
convert_library = Blueprint('convert_library', __name__)
epub_fixer = Blueprint('epub_fixer', __name__)
-cwa_history = Blueprint('cwa_history', __name__)
+cwa_stats = Blueprint('cwa_stats', __name__)
cwa_check_status = Blueprint('cwa_check_status', __name__)
cwa_settings = Blueprint('cwa_settings', __name__)
@@ -193,6 +195,14 @@ def set_cwa_settings():
## ##
##————————————————————————————————————————————————————————————————————————————##
+def get_cwa_stats() -> dict[str,int]:
+ """Returns CWA stat totals as a dict (keys are table names except for total_books)"""
+ cwa_db = CWA_DB()
+ totals = cwa_db.get_stat_totals()
+ totals["total_books"] = cwa_get_num_books_in_library() # from web.py
+
+ return totals
+
### TABLE HEADERS
headers = {
"enforcement":{
@@ -213,10 +223,10 @@ def set_cwa_settings():
"Timestamp", "Filename", "Original Format", "End Format", "Original Backed Up?"],
}
-@cwa_history.route("/cwa-history-show", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
-def cwa_history_show():
+def cwa_stats_show():
cwa_db = CWA_DB()
data_enforcement = cwa_db.enforce_show(paths=False, verbose=False, web_ui=True)
data_enforcement_with_paths = cwa_db.enforce_show(paths=True, verbose=False, web_ui=True)
@@ -225,7 +235,8 @@ def cwa_history_show():
data_epub_fixer = cwa_db.get_epub_fixer_history(fixes=False, verbose=False)
data_epub_fixer_with_fixes = cwa_db.get_epub_fixer_history(fixes=True, verbose=False)
- return render_title_template("cwa_history.html", title=_("Calibre-Web Automated Stats"), page="cwa-history",
+ return render_title_template("cwa_stats.html", title=_("Calibre-Web Automated Stats"), page="cwa-history",
+ cwa_stats=get_cwa_stats(),
data_enforcement=data_enforcement, headers_enforcement=headers["enforcement"]["no_paths"],
data_enforcement_with_paths=data_enforcement_with_paths,headers_enforcement_with_paths=headers["enforcement"]["with_paths"],
data_imports=data_imports, headers_import=headers["imports"],
@@ -233,58 +244,58 @@ def cwa_history_show():
data_epub_fixer=data_epub_fixer, headers_epub_fixer=headers["epub_fixer"]["no_fixes"],
data_epub_fixer_with_fixes=data_epub_fixer_with_fixes, headers_epub_fixer_with_fixes=headers["epub_fixer"]["with_fixes"])
-@cwa_history.route("/cwa-history-show/full-enforcement", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show/full-enforcement", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
def show_full_enforcement():
cwa_db = CWA_DB()
data = cwa_db.enforce_show(paths=False, verbose=True, web_ui=True)
- return render_title_template("cwa_history_full.html", title=_("Calibre-Web Automated - Full Enforcement History"), page="cwa-history-full",
+ return render_title_template("cwa_stats_full.html", title=_("Calibre-Web Automated - Full Enforcement History"), page="cwa-history-full",
table_headers=headers["enforcement"]["no_paths"], data=data)
-@cwa_history.route("/cwa-history-show/full-enforcement-with-paths", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show/full-enforcement-with-paths", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
def show_full_enforcement_path():
cwa_db = CWA_DB()
data = cwa_db.enforce_show(paths=True, verbose=True, web_ui=True)
- return render_title_template("cwa_history_full.html", title=_("Calibre-Web Automated - Full Enforcement History (w/ Paths)"), page="cwa-history-full",
+ return render_title_template("cwa_stats_full.html", title=_("Calibre-Web Automated - Full Enforcement History (w/ Paths)"), page="cwa-history-full",
table_headers=headers["enforcement"]["with_paths"], data=data)
-@cwa_history.route("/cwa-history-show/full-imports", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show/full-imports", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
def show_full_imports():
cwa_db = CWA_DB()
data = cwa_db.get_import_history(verbose=True)
- return render_title_template("cwa_history_full.html", title=_("Calibre-Web Automated - Full Import History"), page="cwa-history-full",
+ return render_title_template("cwa_stats_full.html", title=_("Calibre-Web Automated - Full Import History"), page="cwa-history-full",
table_headers=headers["imports"], data=data)
-@cwa_history.route("/cwa-history-show/full-conversions", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show/full-conversions", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
def show_full_conversions():
cwa_db = CWA_DB()
data = cwa_db.get_conversion_history(verbose=True)
- return render_title_template("cwa_history_full.html", title=_("Calibre-Web Automated - Full Conversion History"), page="cwa-history-full",
+ return render_title_template("cwa_stats_full.html", title=_("Calibre-Web Automated - Full Conversion History"), page="cwa-history-full",
table_headers=headers["conversions"], data=data)
-@cwa_history.route("/cwa-history-show/full-epub-fixer", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show/full-epub-fixer", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
def show_full_epub_fixer():
cwa_db = CWA_DB()
data = cwa_db.get_epub_fixer_history(fixes=False, verbose=True)
- return render_title_template("cwa_history_full.html", title=_("Calibre-Web Automated - Full EPUB Fixer History (w/out Paths & Fixes)"), page="cwa-history-full",
+ return render_title_template("cwa_stats_full.html", title=_("Calibre-Web Automated - Full EPUB Fixer History (w/out Paths & Fixes)"), page="cwa-history-full",
table_headers=headers["epub_fixer"]["no_fixes"], data=data)
-@cwa_history.route("/cwa-history-show/full-epub-fixer-with-paths-fixes", methods=["GET", "POST"])
+@cwa_stats.route("/cwa-history-show/full-epub-fixer-with-paths-fixes", methods=["GET", "POST"])
@login_required_if_no_ano
@admin_required
def show_full_epub_fixer_with_paths_fixes():
cwa_db = CWA_DB()
data = cwa_db.get_epub_fixer_history(fixes=True, verbose=True)
- return render_title_template("cwa_history_full.html", title=_("Calibre-Web Automated - Full EPUB Fixer History (w/ Paths & Fixes)"), page="cwa-history-full",
+ return render_title_template("cwa_stats_full.html", title=_("Calibre-Web Automated - Full EPUB Fixer History (w/ Paths & Fixes)"), page="cwa-history-full",
table_headers=headers["epub_fixer"]["with_fixes"], data=data)
##————————————————————————————————————————————————————————————————————————————##
diff --git a/root/app/calibre-web/cps/main.py b/root/app/calibre-web/cps/main.py
index 1efa0e2..16bd9bd 100644
--- a/root/app/calibre-web/cps/main.py
+++ b/root/app/calibre-web/cps/main.py
@@ -30,7 +30,7 @@ def request_username():
def main():
app = create_app()
- from .cwa_functions import switch_theme, library_refresh, convert_library, epub_fixer, cwa_history, cwa_check_status, cwa_settings
+ from .cwa_functions import switch_theme, library_refresh, convert_library, epub_fixer, cwa_stats, cwa_check_status, cwa_settings
from .web import web
from .opds import opds
from .admin import admi
@@ -67,7 +67,7 @@ def main():
app.register_blueprint(library_refresh)
app.register_blueprint(convert_library)
app.register_blueprint(epub_fixer)
- app.register_blueprint(cwa_history)
+ app.register_blueprint(cwa_stats)
app.register_blueprint(cwa_check_status)
app.register_blueprint(cwa_settings)
diff --git a/root/app/calibre-web/cps/static/css/caliBlur.css b/root/app/calibre-web/cps/static/css/caliBlur.css
index aa07c2a..7b3a149 100644
--- a/root/app/calibre-web/cps/static/css/caliBlur.css
+++ b/root/app/calibre-web/cps/static/css/caliBlur.css
@@ -819,7 +819,7 @@ body:not(.read-frame) {
-o-background-size: auto, cover !important;
line-height: 1.71428571;
background: url(images/caliblur/blur-noise.png), var(--color-background);
- color: hsla(0, 0%, 100%, .45);
+ color: whitesmoke;
font-family: Open Sans Semibold, Helvetica Neue, Helvetica, Arial, sans-serif;
font-weight: 400;
overflow: hidden;
@@ -8366,70 +8366,4 @@ select.cwa-settings-select {
text-align: center;
line-height: 25px;
transition: width 0.3s ease-in-out;
-}
-
-.cwa_stats_container {
- display: grid;
- grid-template-columns: 1fr 1fr 1fr 1fr; /* Default: 4 equal columns */
- gap: 10px; /* Space between sections */
- padding: 20px;
- height: 100vh; /* Full viewport height */
-}
-.cwa_stats_section {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- border: 1px solid #ddd;
- border-radius: 8px;
- padding: 20px;
- text-align: center;
-}
-.cwa_stats_header {
- font-size: 1.5em;
- font-weight: bold;
- margin-bottom: 10px;
-}
-.cwa_stats_value {
- font-size: 2.5em;
- font-weight: bold;
- color: #333;
-}
-/* Styling for background colors */
-.cwa_stats_section:nth-child(1) { background-color: #e0f7fa; }
-.cwa_stats_section:nth-child(2) { background-color: #c8e6c9; }
-.cwa_stats_section:nth-child(3) { background-color: #ffcdd2; }
-.cwa_stats_section:nth-child(4) { background-color: #fff9c4; }
-
-/* Media Query for Medium Screens */
-@media (max-width: 1024px) {
- .cwa_stats_container {
- grid-template-columns: repeat(2, 1fr); /* 2 equal columns on medium screens */
- }
-}
-
-/* Media Query for Mobile Screens or Thin Windows */
-@media (max-width: 480px) {
-.cwa_stats_container {
- grid-template-columns: 1fr; /* 1 column, 4 sections stacked vertically */
-}
-}
-
-/* Media Query for Wide Screens */
-@media (min-width: 1200px) {
- .cwa_stats_container {
- grid-template-columns: 1fr 4fr; /* 1 tall column and 4 wide columns */
- grid-template-rows: 1fr; /* Ensuring only one row for the 1 tall section */
- }
- .cwa_stats_section:nth-child(1) {
- grid-column: 1 / 2;
- grid-row: 1 / 2;
- height: 100vh; /* Make the first section take up the full height */
- }
- .cwa_stats_section:nth-child(2),
- .cwa_stats_section:nth-child(3),
- .cwa_stats_section:nth-child(4) {
- grid-column: 2 / 3;
- grid-row: 1 / 2; /* Place the 4 sections in the same row */
- }
}
\ No newline at end of file
diff --git a/root/app/calibre-web/cps/static/css/caliBlur_cwa.css b/root/app/calibre-web/cps/static/css/caliBlur_cwa.css
new file mode 100644
index 0000000..e69de29
diff --git a/root/app/calibre-web/cps/templates/admin.html b/root/app/calibre-web/cps/templates/admin.html
index a50d6bf..bf3d490 100644
--- a/root/app/calibre-web/cps/templates/admin.html
+++ b/root/app/calibre-web/cps/templates/admin.html
@@ -203,7 +203,7 @@
{{_('Scheduled Tasks ⌛')}}
-
+
-
{{title}}
-
-
-
Calibre-Web Automated - Server Stats
-
-
-
-
-
Calibre-Web Automated Conversion History
-
{{_('Click to See More')}}
-
-
- {% for header in headers_conversion %}
- {{ header }} |
- {% endfor %}
-
- {% for row in data_conversions|reverse %}
-
- {% for cell in row %}
- {{ cell }} |
- {% endfor %}
-
- {% endfor %}
-
-
-
-
-
Calibre-Web Automated Import History
-
{{_('Click to See More')}}
-
-
- {% for header in headers_import %}
- {{ header }} |
- {% endfor %}
-
- {% for row in data_imports|reverse %}
-
- {% for cell in row %}
- {{ cell }} |
- {% endfor %}
-
- {% endfor %}
-
-
-
-
-
Calibre-Web Automated EPUB Fixer History
-
{{_('Click to See More')}}
-
-
- {% for header in headers_epub_fixer %}
- {{ header }} |
- {% endfor %}
-
- {% for row in data_epub_fixer|reverse %}
-
- {% for cell in row %}
- {{ cell }} |
- {% endfor %}
-
- {% endfor %}
-
-
EPUB Fixer History with Paths & Fixes
-
{{_('Click to See More')}}
-
-
- {% for header in headers_epub_fixer_with_fixes %}
- {{ header }} |
- {% endfor %}
-
- {% for row in data_epub_fixer_with_fixes|reverse %}
-
- {% for cell in row %}
-
- {{ cell | replace("\n", " ") | safe }}
- |
- {% endfor %}
-
- {% endfor %}
-
-
-
-
-
Calibre-Web Automated Enforcement History
-
{{_('Click to See More')}}
-
-
- {% for header in headers_enforcement %}
- {{ header }} |
- {% endfor %}
-
- {% for row in data_enforcement|reverse %}
-
- {% for cell in row %}
- {{ cell }} |
- {% endfor %}
-
- {% endfor %}
-
-
Enforcement History with Paths
-
{{_('Click to See More')}}
-
-
- {% for header in headers_enforcement_with_paths %}
- {{ header }} |
- {% endfor %}
-
- {% for row in data_enforcement_with_paths|reverse %}
-
- {% for cell in row %}
- {{ cell }} |
- {% endfor %}
-
- {% endfor %}
-
-
-
-
-{% endblock %}
\ No newline at end of file
diff --git a/root/app/calibre-web/cps/templates/cwa_stats.html b/root/app/calibre-web/cps/templates/cwa_stats.html
new file mode 100644
index 0000000..65a9826
--- /dev/null
+++ b/root/app/calibre-web/cps/templates/cwa_stats.html
@@ -0,0 +1,229 @@
+{% extends "layout.html" %}
+{% block body %}
+
+{% block header %}
+
+{% endblock %}
+
+
+
{{title}}
+
+
+
Calibre-Web Automated - Server Stats
+
+
+
+
{{cwa_stats["total_books"]}}
+
+
+
+
{{cwa_stats["cwa_enforcement"]}}
+
+
+
+
{{cwa_stats["total_conversions"]}}
+
+
+
+
{{cwa_stats["epub_fixes"]}}
+
+
+
+
+
+
+
+
+
+
+
+ {% for header in headers_conversion %}
+ {{ header }} |
+ {% endfor %}
+
+ {% for row in data_conversions|reverse %}
+
+ {% for cell in row %}
+ {{ cell }} |
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+ {% for header in headers_import %}
+ {{ header }} |
+ {% endfor %}
+
+ {% for row in data_imports|reverse %}
+
+ {% for cell in row %}
+ {{ cell }} |
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+ {% for header in headers_epub_fixer %}
+ {{ header }} |
+ {% endfor %}
+
+ {% for row in data_epub_fixer|reverse %}
+
+ {% for cell in row %}
+ {{ cell }} |
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
+
+ {% for header in headers_epub_fixer_with_fixes %}
+ {{ header }} |
+ {% endfor %}
+
+ {% for row in data_epub_fixer_with_fixes|reverse %}
+
+ {% for cell in row %}
+
+ {{ cell | replace("\n", " ") | safe }}
+ |
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+ {% for header in headers_enforcement %}
+ {{ header }} |
+ {% endfor %}
+
+ {% for row in data_enforcement|reverse %}
+
+ {% for cell in row %}
+ {{ cell }} |
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
+
+ {% for header in headers_enforcement_with_paths %}
+ {{ header }} |
+ {% endfor %}
+
+ {% for row in data_enforcement_with_paths|reverse %}
+
+ {% for cell in row %}
+ {{ cell }} |
+ {% endfor %}
+
+ {% endfor %}
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/root/app/calibre-web/cps/templates/cwa_history_full.html b/root/app/calibre-web/cps/templates/cwa_stats_full.html
similarity index 100%
rename from root/app/calibre-web/cps/templates/cwa_history_full.html
rename to root/app/calibre-web/cps/templates/cwa_stats_full.html
diff --git a/root/app/calibre-web/cps/templates/layout.html b/root/app/calibre-web/cps/templates/layout.html
index dad5901..a9b41b6 100644
--- a/root/app/calibre-web/cps/templates/layout.html
+++ b/root/app/calibre-web/cps/templates/layout.html
@@ -22,6 +22,7 @@
{% if g.current_theme == 1 %}
+
{% endif %}