Switch to nginx, compress video, unmute on interaction

This commit is contained in:
Sahik committed 2026-10-24 23:23:43 +08:00
commit b153d786cf
5 files changed
+123

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
*
!Dockerfile
!nginx.conf
!index.htm
!rickroll.mp4
+7
View File
@@ -0,0 +1,7 @@
FROM nginxinc/nginx-unprivileged:stable-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY index.htm /usr/share/nginx/html/index.html
COPY rickroll.mp4 /usr/share/nginx/html/rickroll.mp4
EXPOSE 1000
+86
View File
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About</title>
<style>
body {
text-align: center;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
h1 {
color: #333;
}
video {
width: auto;
height: auto;
max-width: 100%;
margin-top: 20px;
}
.overlay {
position: relative;
display: inline-block;
}
.overlay button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.5);
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Remember, Rick never give you up</h1>
<div class="overlay">
<video id="video" controls playsinline preload="auto">
<source src="/rickroll.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<button id="unmute" hidden>&#128266; Tap for sound</button>
</div>
<script>
const video = document.getElementById('video');
const unmuteButton = document.getElementById('unmute');
const gestureEvents = ['pointerdown', 'pointerup', 'touchend', 'keydown'];
function playMuted() {
video.muted = true;
video.play().catch(() => {});
unmuteButton.hidden = false;
}
// Browsers only allow sound after a user gesture, so retry on the first one
function unmute() {
video.muted = false;
video.play().then(() => {
unmuteButton.hidden = true;
gestureEvents.forEach(e => document.removeEventListener(e, unmute));
}).catch(playMuted);
}
gestureEvents.forEach(e => document.addEventListener(e, unmute));
// Try with sound first (allowed for returning visitors), fall back to muted autoplay
video.play().catch(playMuted);
</script>
<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/vce701823e78c4301a35b7e07294d87301792088814092" integrity="sha512-UKNk8GbxkABxKcXYuLkO16EleLGUkcvJWtpSNmExE0Too3ZaFAxTscNWEc1OdAv5/BikHawapSCaiD2XCmp+Bw==" data-cf-beacon='{"version":"2024.11.0","token":"7d5d26a6b83b42ff897b5a3378a2b837","r":1,"spa":2}' crossorigin="anonymous"></script>
</body>
</html>
+25
View File
@@ -0,0 +1,25 @@
server {
listen 1000;
server_name _;
server_tokens off;
root /usr/share/nginx/html;
add_header X-Content-Type-Options nosniff always;
add_header X-Frame-Options DENY always;
add_header Referrer-Policy no-referrer always;
# Only static reads; scanners POSTing exploits get 405
if ($request_method !~ ^(GET|HEAD)$) {
return 405;
}
location = /rickroll.mp4 {
expires 7d;
}
# Every other path (/wp-admin, /.env, ...) gets rickrolled
location / {
try_files /index.html =404;
}
}
BIN
View File
Binary file not shown.