chore: Add automatic page refresh after 2 seconds in loading page

This commit is contained in:
Théophile Diot 2024-06-17 12:57:32 +02:00
parent 788ca5945c
commit c15954f573
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 16 additions and 3 deletions

View file

@ -256,6 +256,15 @@
</div>
<!-- text -->
{-raw-}
<script nonce="{{ nonce_script }}">
// Automatically refresh the page after 2 seconds
setTimeout(() => {
location.reload();
}, 2000);
</script>
{-raw-}
<footer class="fixed bottom-1.5 lg:bottom-2">
<div class="flex justify-center pb-2">
<img

View file

@ -67,18 +67,22 @@ server {
end
local nonce_style = rand(16)
local nonce_script = rand(16)
-- Override CSP header
ngx.header["Content-Security-Policy"] = "default-src 'none'; form-action 'self'; img-src 'self' data:; style-src 'self' 'nonce-"
ngx.header["Content-Security-Policy"] = "default-src 'none'; script-src http: https: 'unsafe-inline' 'strict-dynamic' 'nonce-"
.. nonce_script
.. "'; style-src 'nonce-"
.. nonce_style
.. "'; font-src 'self' data:; base-uri 'self'; require-trusted-types-for 'script';"
.. "'; base-uri 'none'; img-src 'self' data:; font-src 'self' data:; require-trusted-types-for 'script';"
-- Remove server header
ngx.header["Server"] = nil
-- Render template
render("index.html", {
nonce_style = nonce_style
nonce_style = nonce_style,
nonce_script = nonce_script
})
}
}