mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-04-20 10:13:59 +02:00
Simplify my noob attempt at working around a warning inside a macro. Thanks Liam
Co-authored-by: liamwhite <liamwhite@users.noreply.github.com>
This commit is contained in:
parent
e58adaf64a
commit
2e56889740
1 changed files with 4 additions and 10 deletions
|
@ -69,16 +69,10 @@ defmodule PhilomenaWeb.ContentSecurityPolicyPlug do
|
|||
# Use the "current host" in vite HMR mode for whatever the "current host" is.
|
||||
# Usually it's `localhost`, but it may be some other private IP address, that
|
||||
# you use to test the frontend on a mobile device connected via a local Wi-Fi.
|
||||
defp default_script_src(host) do
|
||||
# Workaround for a compile warning where `host` variable is unused if we
|
||||
# inline the if branches into the `vite_hmr?` macro.
|
||||
is_vite_hmr = vite_hmr?(do: true, else: false)
|
||||
|
||||
if is_vite_hmr do
|
||||
"'self' #{host}:5173"
|
||||
else
|
||||
"'self'"
|
||||
end
|
||||
vite_hmr? do
|
||||
defp default_script_src(host), do: "'self' #{host}:5173"
|
||||
else
|
||||
defp default_script_src(_host), do: "'self'"
|
||||
end
|
||||
|
||||
defp default_connect_src(host) do
|
||||
|
|
Loading…
Add table
Reference in a new issue