Support password share links
This commit is contained in:
+2
-18
@@ -21,30 +21,14 @@
|
||||
<% }
|
||||
}) %>
|
||||
</div>
|
||||
<script src="/web.js"></script>
|
||||
<script src="/lightgallery.min.js"></script>
|
||||
<script src="/lg-fullscreen.min.js"></script>
|
||||
<script src="/lg-thumbnail.min.js"></script>
|
||||
<script src="/lg-video.min.js"></script>
|
||||
<script src="/lg-zoom.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
lightGallery(document.getElementById('lightgallery'), {
|
||||
plugins: [lgZoom, lgThumbnail, lgVideo, lgFullscreen],
|
||||
/*
|
||||
This license key was graciously provided by LightGallery under their
|
||||
GPLv3 open-source project license:
|
||||
*/
|
||||
licenseKey: '8FFA6495-676C4D30-8BFC54B6-4D0A6CEC',
|
||||
/*
|
||||
Please do not take it and use it for other projects, as it was provided
|
||||
specifically for Immich Public Proxy.
|
||||
|
||||
For your own projects you can use the default license key of
|
||||
0000-0000-000-0000 as per their docs:
|
||||
|
||||
https://www.lightgalleryjs.com/docs/settings/#licenseKey
|
||||
*/
|
||||
speed: 500
|
||||
})
|
||||
initLightGallery() // from web.js
|
||||
<% if (openItem) { %>
|
||||
const openItem = <%- openItem %>
|
||||
const thumbs = document.querySelectorAll('#lightgallery a')
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
<title>Password required</title>
|
||||
<link type="text/css" rel="stylesheet" href="/lightgallery-bundle.min.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/pico.min.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<main class="container">
|
||||
<div class="grid">
|
||||
<div></div>
|
||||
<div>
|
||||
<form id="unlock" method="post">
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
aria-label="Password"
|
||||
required
|
||||
/>
|
||||
<input
|
||||
type="hidden"
|
||||
name="key"
|
||||
value="<%- key %>"
|
||||
/>
|
||||
<button type="submit">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||
class="lucide lucide-lock-open">
|
||||
<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/>
|
||||
<path d="M7 11V7a5 5 0 0 1 9.9-1"/>
|
||||
</svg>
|
||||
Unlock
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/web.js"></script>
|
||||
<script>
|
||||
function submitForm (formElement) {
|
||||
const formData = new FormData(formElement)
|
||||
|
||||
fetch('/unlock', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(Object.fromEntries(formData.entries()))
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.documentElement.innerHTML = html
|
||||
initLightGallery() // from web.js
|
||||
})
|
||||
.catch(error => console.error('Error:', error))
|
||||
}
|
||||
|
||||
document.getElementById('unlock')
|
||||
.addEventListener('submit', function (e) {
|
||||
e.preventDefault()
|
||||
submitForm(this)
|
||||
})
|
||||
</script>
|
||||
<script src="/lightgallery.min.js"></script>
|
||||
<script src="/lg-fullscreen.min.js"></script>
|
||||
<script src="/lg-thumbnail.min.js"></script>
|
||||
<script src="/lg-video.min.js"></script>
|
||||
<script src="/lg-zoom.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user