From 04e6d80af43ad059ac1b7b5501dc7afbdafaa596 Mon Sep 17 00:00:00 2001 From: lelo Date: Thu, 12 Jun 2025 14:12:07 +0000 Subject: [PATCH] toplist category to config --- app.py | 8 ++++---- static/app.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index fe8d0ef..25725d1 100755 --- a/app.py +++ b/app.py @@ -249,6 +249,7 @@ def serve_sw(): @app.route('/api/path/') @auth.require_secret def api_browse(subpath): + toplist_categories = app_config.get('toplist_categories', None) if subpath == '': # root directory foldernames = [] @@ -260,7 +261,8 @@ def api_browse(subpath): 'directories': foldernames, 'files': [], 'folder_today': a.return_folder_today(), - 'folder_yesterday': a.return_folder_yesterday() + 'folder_yesterday': a.return_folder_yesterday(), + 'toplist_enabled': bool(toplist_categories) }) if subpath == 'heute' or subpath == 'gestern': @@ -284,14 +286,12 @@ def api_browse(subpath): foldernames = [] files = [] split_path = subpath.split('/') - - valid_categories = ['Predigt', 'Erzählung', 'Gedicht', 'Gemeinsamer Gesang', 'Chor', 'Kinderchor', 'Jugendchor', 'Orchester', 'Instrumental', 'Gruppenlied'] if len(split_path) == 1 and split_path[0] == 'toplist': foldernames = [ { 'name': categorie, 'path': 'toplist/' + categorie - } for categorie in valid_categories + } for categorie in toplist_categories ] elif len(split_path) > 1 and split_path[0] == 'toplist': files = hf.generate_top_list(split_path[1]) diff --git a/static/app.js b/static/app.js index ca73ca0..dce8ae4 100644 --- a/static/app.js +++ b/static/app.js @@ -113,7 +113,7 @@ function renderContent(data) { } else if (data.breadcrumbs.length === 1 && Array.isArray(data.folder_yesterday) && data.folder_yesterday.length > 0) { contentHTML += `
  • 📅 Gestern
  • `; } - if (data.breadcrumbs.length === 1 ) { + if (data.breadcrumbs.length === 1 && data.toplist_enabled) { contentHTML += `
  • 🔥 oft angehört
  • `; } console.log(data.folder_today, data.folder_yesterday);