diff --git a/assets/js/app.js b/assets/js/app.js index 8b2dea8..8ca68b1 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -2241,6 +2241,12 @@ liveSocket.connect(); // >> liveSocket.disableLatencySim() window.liveSocket = liveSocket; +if ("serviceWorker" in navigator && process.env.NODE_ENV === "production") { + window.addEventListener("load", () => { + navigator.serviceWorker.register("/service-worker.js"); + }); +} + // The lines below enable quality of life phoenix_live_reload // development features: // diff --git a/lib/open_drive_web.ex b/lib/open_drive_web.ex index 6fbbbe8..ddb87d6 100644 --- a/lib/open_drive_web.ex +++ b/lib/open_drive_web.ex @@ -17,7 +17,9 @@ defmodule OpenDriveWeb do those modules here. """ - def static_paths, do: ~w(assets fonts images favicon.ico favicon.svg robots.txt) + def static_paths, + do: + ~w(assets fonts images favicon.ico favicon.svg manifest.webmanifest service-worker.js robots.txt) def router do quote do diff --git a/lib/open_drive_web/components/core_components.ex b/lib/open_drive_web/components/core_components.ex index 44ad6d6..1491ce1 100644 --- a/lib/open_drive_web/components/core_components.ex +++ b/lib/open_drive_web/components/core_components.ex @@ -217,7 +217,7 @@ defmodule OpenDriveWeb.CoreComponents do defp button_loading_content(assigns) do ~H""" -