Coverage for seedboxsync/front/views/frontend/homepage.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-11 07:37 +0000

1# 

2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr> 

3# 

4# For the full copyright and license information, please view the LICENSE 

5# file that was distributed with this source code. 

6# 

7"""SeedboxSync Flask view for homepage.""" 

8 

9from flask import render_template 

10from seedboxsync.core import current_app 

11from seedboxsync.front.cache import cached 

12from seedboxsync.front.login_manager import login_required 

13from seedboxsync.front.views import bp_frontend as bp 

14 

15 

16@bp.route("/") 

17@cached(timeout=300) # pyright: ignore [reportUntypedFunctionDecorator] 

18@login_required # type: ignore[untyped-decorator] 

19def homepage() -> str: 

20 """ 

21 Render the home page view. 

22 

23 Renders the main dashboard template using the active application configuration (cached for 5 minutes). 

24 

25 Returns: 

26 str: Rendered HTML template for the home page. 

27 """ 

28 webui_dashboard_refresh = int(current_app.seedboxsync_config.get("webui_dashboard_refresh", "60")) * 1000 

29 webui_dashboard_nb_elements = int(current_app.seedboxsync_config.get("webui_dashboard_nb_elements", "5")) 

30 return render_template("homepage.html", webui_dashboard_refresh=webui_dashboard_refresh, webui_dashboard_nb_elements=webui_dashboard_nb_elements)