stupid features

This commit is contained in:
metamuffin 2024-11-03 23:33:09 +01:00
parent 69f01a2e89
commit 09c2958a0e
No known key found for this signature in database
GPG key ID: 718F9749DCDBD654
2 changed files with 26 additions and 1 deletions

View file

@ -54,6 +54,21 @@ local query = parse_query(os.getenv("QUERY_STRING"))
local stylesheet = io.open("style.css"):read("a") local stylesheet = io.open("style.css"):read("a")
local script = io.open("script.js"):read("a") local script = io.open("script.js"):read("a")
local function get_user_theme(username)
local c = ""
if username == "_jeb" then
c = "html { animation: 2s jeb infinite; }"
c = c .. "@keyframes jeb {\n"
for i=0,100 do
c = c .. string.format("%.02f%% { --hue: %.02f; } \n", i, i / 100 * 360)
end
c = c .. "\n}"
elseif username == "Dinnerbone" then
c = "html { transform: scale(-1); } "
end
return c
end
local function respond(status, title, body) local function respond(status, title, body)
print(string.format("Status: %d", status)) print(string.format("Status: %d", status))
print("Content-Type: text/html") print("Content-Type: text/html")
@ -64,6 +79,7 @@ local function respond(status, title, body)
<title>%s</title> <title>%s</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<style>%s</style> <style>%s</style>
<style>%s</style>
<script>%s</script> <script>%s</script>
%s %s
</head> </head>
@ -79,7 +95,13 @@ local function respond(status, title, body)
<a href="/?products">Products</a> <a href="/?products">Products</a>
<a href="https://codeberg.org/metamuffin/strichliste">Source</a> <a href="https://codeberg.org/metamuffin/strichliste">Source</a>
</nav> </nav>
]], escape(title), stylesheet, script, config.head_extra or "")) ]],
escape(title),
stylesheet,
get_user_theme(path and path:sub(2)),
script,
config.head_extra or ""
))
body() body()
print("</body></html>") print("</body></html>")
end end

View file

@ -84,6 +84,7 @@ form.creation {
background-color: var(--b2); background-color: var(--b2);
padding: 1em; padding: 1em;
margin-top: 2em; margin-top: 2em;
border-radius: 4px;
} }
form.creation>h3 { form.creation>h3 {
@ -127,6 +128,7 @@ li {
padding: 1em; padding: 1em;
margin: .5em; margin: .5em;
margin-left: 0; margin-left: 0;
border-radius: 4px;
} }
.name { .name {
@ -234,6 +236,7 @@ h3 {
/* grid-auto-rows: minmax(5em, 2); */ /* grid-auto-rows: minmax(5em, 2); */
/* grid-template-columns: repeat(2, calc(50% - 2em)); */ /* grid-template-columns: repeat(2, calc(50% - 2em)); */
grid-template-columns: auto 10em; grid-template-columns: auto 10em;
border-radius: 4px;
} }
form.box> :first-child, form.box> :first-child,