polish up html endpoint stuff

This commit is contained in:
Jill 2023-01-03 20:47:12 +03:00
parent 9b2a1315ea
commit 6e04027170
6 changed files with 57 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<h1 style="vertical-align:center">
<center>
<img src="./docs/crystal-gauntlet-icon.png" width="auto" height="32"> crystal-gauntlet
<img src="./public/favicon.png" width="auto" height="32"> crystal-gauntlet
</center>
</h1>

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

45
public/style.css Normal file
View File

@ -0,0 +1,45 @@
:root {
font-size: 16px;
line-height: 1;
font-weight: 400;
color-scheme: light dark;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
background-color: #fff;
color: #111;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
--accent-color: rgb(243, 159, 215);
--accent-color-bri: rgb(241, 181, 221);
accent-color: var(--accent-color);
}
::selection {
background-color: var(--accent-color);
color: #000;
}
body {
margin: 2rem;
}
a {
color: var(--accent-color);
transition: 0.2s color;
}
a:hover {
color: var(--accent-color-bri);
}
@media (prefers-color-scheme: dark) {
:root {
background-color: #111;
color: #fff;
}
}

View File

@ -1,13 +1,17 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css" />
<title>Song Uploader</title>
</head>
<body>
<%- if error -%>
<div>Error while uploading: <%= error %></div><br />
<%- elsif song_id -%>
<div>Uploaded successfully! Song ID: <%= song_id %></div><br />
<div>Uploaded successfully! Song ID: <b><%= song_id %></b></div><br />
<%- end -%>
<form action="/tools/song_upload" method="post">

View File

@ -201,6 +201,7 @@ module CrystalGauntlet
else
server = HTTP::Server.new([
HTTP::LogHandler.new,
HTTP::StaticFileHandler.new("public/", fallthrough: true, directory_listing: false),
HTTP::StaticFileHandler.new("data/", fallthrough: true, directory_listing: false),
CrystalGauntlet::GDHandler.new,
CrystalGauntlet::TemplateHandler.new

View File

@ -28,11 +28,11 @@ CrystalGauntlet.template_endpoints["/tools/song_upload"] = ->(context : HTTP::Se
DATABASE.exec("insert into songs (id, url) values (?, ?)", song_id, params["url"])
rescue error
# todo: HELP HOW DO I DO THIS BUT BETTER
ECR.render("./template/song_upload.ecr")
ECR.render("./public/template/song_upload.ecr")
else
ECR.render("./template/song_upload.ecr")
ECR.render("./public/template/song_upload.ecr")
end
end
ECR.render("./template/song_upload.ecr")
ECR.render("./public/template/song_upload.ecr")
}