add: safety_content_warning, master_pass env var

This commit is contained in:
trisua 2025-08-02 01:30:11 -04:00
parent a6a289c594
commit 15b417c6d6
9 changed files with 150 additions and 29 deletions

View file

@ -61,6 +61,14 @@
(button
("class" "button camo fade no_fill")
("title" "Toggle high-contrast")
("id" "toggle_high_contrast_button")
("onclick" "toggle_metadata_css(event)")
(text "{{ icon \"contrast\" }}"))
(text "{% if \"EntryHighContrast\" in flags -%}")
(script
(text "setTimeout(() => {
toggle_metadata_css({ target: document.getElementById(\"toggle_high_contrast_button\") });
}, 150);"))
(text "{%- endif %}")
(text "{% endblock %}")

View file

@ -0,0 +1,54 @@
(text "{% extends \"root.lisp\" %} {% block head %}")
(text "{% if not metadata.page_title -%}")
(title
(text "{{ entry.slug }}"))
(text "{%- endif %} {{ metadata_head|safe }}")
(text "{% if not metadata.share_title -%}")
(meta ("property" "og:title") ("content" "{{ entry.slug }}"))
(meta ("property" "twitter:title") ("content" "{{ entry.slug }}"))
(text "{%- endif %}")
(text "{% if metadata.page_icon|length == 0 -%}")
(link ("rel" "icon") ("href" "/public/favicon.svg"))
(text "{%- endif %}")
(text "{% endblock %} {% block body %}")
(div
("class" "card container flex flex-col gap-1")
("id" "content_rect")
(p ("class" "fade") (text "Content warning:"))
(div (text "{{ metadata.safety_content_warning|markdown|safe }}"))
(hr)
(div
("class" "flex flex-col gap-4")
(label
("class" "flex flex-row gap-2 items-center")
("for" "open_in_high_contrast")
(input
("type" "checkbox")
("id" "open_in_high_contrast")
("name" "open_in_high_contrast"))
(span (text "Open in high contrast")))
(div
("class" "flex gap-2")
(button
("class" "button surface green")
("onclick" "accept()")
(text "Continue"))
(button
("class" "button surface red")
("onclick" "window.history.back()")
(text "Cancel")))))
(script
(text "const QFLAGS = [\"AcceptWarning\"];
function accept() {
if (document.getElementById(\"open_in_high_contrast\").checked) {
QFLAGS.push(\"EntryHighContrast\");
}
document.cookie = `Atto-QFlags=\"${JSON.stringify(QFLAGS)}\"; path=/`;
window.location.reload();
}"))
(text "{% endblock %}")