mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-06 11:01:27 +01:00
Wrap default_connect_src as well
This commit is contained in:
parent
2e56889740
commit
3296bc0a91
1 changed files with 4 additions and 9 deletions
|
@ -75,15 +75,10 @@ defmodule PhilomenaWeb.ContentSecurityPolicyPlug do
|
|||
defp default_script_src(_host), do: "'self'"
|
||||
end
|
||||
|
||||
defp default_connect_src(host) do
|
||||
# Same workaround as in `default_script_src/1`
|
||||
is_vite_hmr = vite_hmr?(do: true, else: false)
|
||||
|
||||
if is_vite_hmr do
|
||||
"'self' #{host}:5173 ws://#{host}:5173"
|
||||
else
|
||||
"'self'"
|
||||
end
|
||||
vite_hmr? do
|
||||
defp default_connect_src(host), do: "'self' #{host}:5173 ws://#{host}:5173"
|
||||
else
|
||||
defp default_connect_src(_host), do: "'self'"
|
||||
end
|
||||
|
||||
defp default_style_src, do: vite_hmr?(do: "'self' 'unsafe-inline'", else: "'self'")
|
||||
|
|
Loading…
Add table
Reference in a new issue