Disable welcome page if the new features are enabled (#86)

* Disable welcome page if frontend injection is enabled
* Make button indicate redirecting
This commit is contained in:
Christiaan Goossens
2025-07-13 20:07:47 +02:00
committed by GitHub
parent 27de2bcf71
commit 0888ea0400
3 changed files with 14 additions and 4 deletions

View File

@@ -92,10 +92,13 @@ async def async_setup(hass: HomeAssistant, config):
)
# Register the views
is_frontend_injection_enabled = (
features_config.get("disable_frontend_changes", False) is False
)
name = config[DOMAIN].get(DISPLAY_NAME, DEFAULT_TITLE)
name = re.sub(r"[^A-Za-z0-9 _\-\(\)]", "", name)
hass.http.register_view(OIDCWelcomeView(name))
hass.http.register_view(OIDCWelcomeView(name, is_frontend_injection_enabled))
hass.http.register_view(OIDCRedirectView(oidc_client))
hass.http.register_view(OIDCCallbackView(oidc_client, provider))
hass.http.register_view(OIDCFinishView())
@@ -104,7 +107,7 @@ async def async_setup(hass: HomeAssistant, config):
# Inject OIDC code into the frontend for /auth/authorize if the user has the
# frontend injection feature enabled
if features_config.get("disable_frontend_changes", False) is False:
if is_frontend_injection_enabled:
await OIDCInjectedAuthPage.inject(hass, name)
else:
_LOGGER.info("OIDC frontend changes are disabled, skipping injection")