diff --git a/backend/app/api/routes/auth.py b/backend/app/api/routes/auth.py index a1f3a15ac..7036a3d20 100644 --- a/backend/app/api/routes/auth.py +++ b/backend/app/api/routes/auth.py @@ -87,21 +87,6 @@ async def setup_auth(request: SetupRequest, db: AsyncSession = Depends(get_db)): logger = logging.getLogger(__name__) try: - # Check if auth is already configured (prevent re-setup) - result = await db.execute(select(Settings).where(Settings.key == "auth_enabled")) - _existing_setting = result.scalar_one_or_none() - - # Check if users exist - user_count_result = await db.execute(select(User)) - _user_count = len(user_count_result.scalars().all()) - - # if _existing_setting and _user_count > 0: - # # Auth already configured and users exist - prevent re-setup - # raise HTTPException( - # status_code=status.HTTP_400_BAD_REQUEST, - # detail="Authentication is already configured. Use user management to modify users.", - # ) - # If auth_enabled is true but no users exist, allow re-setup (recovery scenario) admin_created = False diff --git a/backend/app/services/firmware_check.py b/backend/app/services/firmware_check.py index c1b3ed73f..c2bcb00e0 100644 --- a/backend/app/services/firmware_check.py +++ b/backend/app/services/firmware_check.py @@ -135,9 +135,11 @@ class FirmwareCheckService: release_time=latest.get("release_time"), ) else: + # api_key is a printer model identifier (e.g. "x1", "p1"), not a secret logger.warning("Failed to fetch firmware for %s: %s", api_key, response.status_code) except (httpx.HTTPError, OSError, KeyError, ValueError) as e: + # api_key is a printer model identifier (e.g. "x1", "p1"), not a secret logger.error("Error fetching firmware for %s: %s", api_key, e) return None diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx index bae3e1f26..6d7f7468b 100644 --- a/frontend/src/pages/SettingsPage.tsx +++ b/frontend/src/pages/SettingsPage.tsx @@ -1022,7 +1022,7 @@ export function SettingsPage() { {t('settings.tabs.users')} {authEnabled && ( - + )} kWh - {localSettings && localSettings.energy_cost_per_kwh > 0 && ( + {(localSettings?.energy_cost_per_kwh ?? 0) > 0 && ( - ~{(plugEnergySummary.totalToday * localSettings.energy_cost_per_kwh).toFixed(2)} {localSettings.currency} + ~{(plugEnergySummary.totalToday * (localSettings?.energy_cost_per_kwh ?? 0)).toFixed(2)} {localSettings?.currency} )} @@ -2423,9 +2423,9 @@ export function SettingsPage() { {plugEnergySummary.totalYesterday.toFixed(2)} kWh - {localSettings && localSettings.energy_cost_per_kwh > 0 && ( + {(localSettings?.energy_cost_per_kwh ?? 0) > 0 && ( - ~{(plugEnergySummary.totalYesterday * localSettings.energy_cost_per_kwh).toFixed(2)} {localSettings.currency} + ~{(plugEnergySummary.totalYesterday * (localSettings?.energy_cost_per_kwh ?? 0)).toFixed(2)} {localSettings?.currency} )} @@ -2440,9 +2440,9 @@ export function SettingsPage() { {plugEnergySummary.totalLifetime.toFixed(1)} kWh - {localSettings && localSettings.energy_cost_per_kwh > 0 && ( + {(localSettings?.energy_cost_per_kwh ?? 0) > 0 && ( - ~{(plugEnergySummary.totalLifetime * localSettings.energy_cost_per_kwh).toFixed(2)} {localSettings.currency} + ~{(plugEnergySummary.totalLifetime * (localSettings?.energy_cost_per_kwh ?? 0)).toFixed(2)} {localSettings?.currency} )}