Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StaticPath warnings #725

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions custom_components/browser_mod/mod_view.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from homeassistant.components.frontend import add_extra_js_url, async_register_built_in_panel
from homeassistant.components.http import StaticPathConfig

from .const import FRONTEND_SCRIPT_URL, SETTINGS_PANEL_URL

Expand All @@ -10,16 +11,26 @@
async def async_setup_view(hass):

# Serve the Browser Mod controller and add it as extra_module_url
hass.http.register_static_path(
FRONTEND_SCRIPT_URL,
hass.config.path("custom_components/browser_mod/browser_mod.js"),
await hass.http.async_register_static_paths(
[
StaticPathConfig(
FRONTEND_SCRIPT_URL,
hass.config.path("custom_components/browser_mod/browser_mod.js"),
True,
)
]
)
add_extra_js_url(hass, FRONTEND_SCRIPT_URL)

# Serve the Browser Mod Settings panel and register it as a panel
hass.http.register_static_path(
SETTINGS_PANEL_URL,
hass.config.path("custom_components/browser_mod/browser_mod_panel.js"),
await hass.http.async_register_static_paths(
[
StaticPathConfig(
SETTINGS_PANEL_URL,
hass.config.path("custom_components/browser_mod/browser_mod_panel.js"),
True,
)
]
)
async_register_built_in_panel(
hass=hass,
Expand Down
Loading