Coverage for opt/mealie/lib/python3.12/site-packages/mealie/routes/admin/admin_about.py: 75%
20 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-11-25 15:48 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-11-25 15:48 +0000
1from fastapi import APIRouter 1a
2from recipe_scrapers import __version__ as recipe_scraper_version 1a
4from mealie.core.release_checker import get_latest_version 1a
5from mealie.core.settings.static import APP_VERSION 1a
6from mealie.routes._base import BaseAdminController, controller 1a
7from mealie.schema.admin.about import AdminAboutInfo, AppStatistics, CheckAppConfig 1a
9router = APIRouter(prefix="/about") 1a
12@controller(router) 1a
13class AdminAboutController(BaseAdminController): 1a
14 @router.get("", response_model=AdminAboutInfo) 1a
15 def get_app_info(self): 1a
16 """Get general application information"""
18 settings = self.settings
20 return AdminAboutInfo(
21 production=settings.PRODUCTION,
22 version=APP_VERSION,
23 versionLatest=get_latest_version(),
24 demo_status=settings.IS_DEMO,
25 api_port=settings.API_PORT,
26 api_docs=settings.API_DOCS,
27 db_type=settings.DB_ENGINE,
28 db_url=settings.DB_URL_PUBLIC,
29 default_group=settings.DEFAULT_GROUP,
30 default_household=settings.DEFAULT_HOUSEHOLD,
31 allow_signup=settings.ALLOW_SIGNUP,
32 allow_password_login=settings.ALLOW_PASSWORD_LOGIN,
33 build_id=settings.GIT_COMMIT_HASH,
34 recipe_scraper_version=recipe_scraper_version.__version__,
35 enable_oidc=settings.OIDC_AUTH_ENABLED,
36 oidc_redirect=settings.OIDC_AUTO_REDIRECT,
37 oidc_provider_name=settings.OIDC_PROVIDER_NAME,
38 enable_openai=settings.OPENAI_ENABLED,
39 enable_openai_image_services=settings.OPENAI_ENABLED and settings.OPENAI_ENABLE_IMAGE_SERVICES,
40 )
42 @router.get("/statistics", response_model=AppStatistics) 1a
43 def get_app_statistics(self): 1a
44 return AppStatistics(
45 total_recipes=self.repos.recipes.count_all(),
46 uncategorized_recipes=self.repos.recipes.count_uncategorized(), # type: ignore
47 untagged_recipes=self.repos.recipes.count_untagged(), # type: ignore
48 total_users=self.repos.users.count_all(),
49 total_households=self.repos.households.count_all(),
50 total_groups=self.repos.groups.count_all(),
51 )
53 @router.get("/check", response_model=CheckAppConfig) 1a
54 def check_app_config(self): 1a
55 settings = self.settings
57 return CheckAppConfig(
58 email_ready=settings.SMTP_ENABLE,
59 ldap_ready=settings.LDAP_ENABLED,
60 base_url_set=settings.BASE_URL != "http://localhost:8080",
61 is_up_to_date=APP_VERSION == "develop" or APP_VERSION == "nightly" or get_latest_version() == APP_VERSION,
62 oidc_ready=settings.OIDC_READY,
63 enable_openai=settings.OPENAI_ENABLED,
64 )