Fix DrawDB: switch Caddy to Nginx, add crypto.randomUUID polyfill

- Replace Caddy with Nginx (matches upstream Dockerfile)
- Add crypto.randomUUID polyfill in index.html for non-HTTPS access
  (browsers only expose crypto.randomUUID in secure contexts)
- Apply polyfill also in update script
This commit is contained in:
CanbiZ (MickLesk)
2026-03-30 11:34:25 +02:00
parent 8cfbde0228
commit 12271687c2
2 changed files with 20 additions and 9 deletions

View File

@@ -36,6 +36,7 @@ function update_script() {
cd /opt/drawdb
$STD npm ci
NODE_OPTIONS="--max-old-space-size=4096" $STD npm run build
sed -i '/<head>/a <script>if(!crypto.randomUUID){crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(c){return(c^(crypto.getRandomValues(new Uint8Array(1))[0]&(15>>c/4))).toString(16)})}};</script>' /opt/drawdb/dist/index.html
msg_ok "Rebuilt Frontend"
msg_ok "Updated successfully!"
fi