Skip to content

Commit

Permalink
chore: Add automatic page refresh after 2 seconds in loading page
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Jun 17, 2024
1 parent 788ca59 commit c15954f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/bw/loading/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/common/confs/default-server-http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
}
Expand Down

0 comments on commit c15954f

Please sign in to comment.