33 lines
1.2 KiB
Common Lisp
33 lines
1.2 KiB
Common Lisp
|
(text "{% extends \"root.lisp\" %} {% block head %}")
|
||
|
(title
|
||
|
(text "{{ entry.slug }}"))
|
||
|
(link ("rel" "icon") ("href" "/public/favicon.svg"))
|
||
|
(text "{% endblock %} {% block body %}")
|
||
|
(main
|
||
|
("class" "card-nest")
|
||
|
(div
|
||
|
("class" "card flex items-center gap-2 no_fill")
|
||
|
(text "{{ icon \"lock\" }}")
|
||
|
(b (text "Password required")))
|
||
|
(form
|
||
|
("class" "card flex flex-col gap-2")
|
||
|
("onsubmit" "use_password(event)")
|
||
|
(div
|
||
|
("class" "flex flex-collapse gap-2")
|
||
|
(input
|
||
|
("class" "surface")
|
||
|
("required" "")
|
||
|
("placeholder" "Password")
|
||
|
("name" "password"))
|
||
|
(button
|
||
|
("class" "button surface")
|
||
|
(text "Go")))))
|
||
|
(script
|
||
|
(text "async function use_password(event) {
|
||
|
event.preventDefault();
|
||
|
const hash = Array.from(new Uint8Array(await window.crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(event.target.password.value))));
|
||
|
const hex_hash = hash.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\");
|
||
|
window.location.href = `?key=h:${hex_hash}`;
|
||
|
}"))
|
||
|
(text "{% endblock %}")
|