diff --git a/modules/caddyhttp/fileserver/browse.html b/modules/caddyhttp/fileserver/browse.html index 5d9dc7dbe..5d60b45e6 100644 --- a/modules/caddyhttp/fileserver/browse.html +++ b/modules/caddyhttp/fileserver/browse.html @@ -1,6 +1,6 @@ {{ $nonce := uuidv4 -}} {{ $nonceAttribute := print "nonce=" (quote $nonce) -}} -{{ $csp := printf "default-src 'none'; img-src 'self'; object-src 'none'; base-uri 'none'; script-src 'nonce-%s'; style-src 'nonce-%s'; frame-ancestors 'self'; form-action 'self';" $nonce $nonce -}} +{{ $csp := printf "default-src 'none'; img-src 'self'; media-src 'self'; object-src 'none'; base-uri 'none'; script-src 'nonce-%s'; style-src 'nonce-%s'; frame-ancestors 'self'; form-action 'self';" $nonce $nonce -}} {{/* To disable the Content-Security-Policy, set this to false */}}{{ $enableCsp := true -}} {{ if $enableCsp -}} {{- .RespHeader.Set "Content-Security-Policy" $csp -}} @@ -777,6 +777,134 @@ footer { } } +/* Media Viewer Modal Styles */ +.media-modal { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.95); + z-index: 10000; + justify-content: center; + align-items: center; +} + +.media-modal.active { + display: flex; +} + +.modal-content { + position: relative; + max-width: 95%; + max-height: 95%; + display: flex; + flex-direction: column; + align-items: center; +} + +.modal-media-container { + max-width: 100%; + max-height: calc(95vh - 60px); + display: flex; + justify-content: center; + align-items: center; +} + +.modal-media-container img, +.modal-media-container video { + max-width: 100%; + max-height: calc(95vh - 60px); + object-fit: contain; +} + +.modal-close { + position: absolute; + top: 20px; + right: 30px; + color: #fff; + font-size: 40px; + font-weight: bold; + background: none; + border: none; + cursor: pointer; + z-index: 10001; + padding: 0; + width: 50px; + height: 50px; + line-height: 50px; + transition: opacity 0.2s; +} + +.modal-close:hover, +.modal-close:focus { + opacity: 0.7; +} + +.modal-nav { + position: absolute; + top: 50%; + transform: translateY(-50%); + color: #fff; + font-size: 60px; + font-weight: bold; + background: none; + border: none; + cursor: pointer; + padding: 20px; + z-index: 10001; + transition: opacity 0.2s; + user-select: none; +} + +.modal-nav:hover, +.modal-nav:focus { + opacity: 0.7; +} + +.modal-prev { + left: 20px; +} + +.modal-next { + right: 20px; +} + +.modal-info { + color: #fff; + text-align: center; + margin-top: 20px; + display: flex; + gap: 20px; + justify-content: center; + flex-wrap: wrap; +} + +.modal-filename { + font-weight: bold; +} + +.modal-counter { + opacity: 0.8; +} + +@media (max-width: 768px) { + .modal-nav { + font-size: 40px; + padding: 10px; + } + + .modal-close { + font-size: 30px; + width: 40px; + height: 40px; + line-height: 40px; + top: 10px; + right: 10px; + } +} + {{- if eq .Layout "grid"}} @@ -1175,6 +1303,22 @@ footer { + +
+ + + + +
+