css is fuuuuun and bad

main
Bel LaPointe 2024-02-20 14:35:19 -07:00
parent f5bd9f27ce
commit f750f055b7
2 changed files with 9 additions and 8 deletions

View File

@ -3,10 +3,15 @@
<header> <header>
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/light.css">--> <!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/light.css">-->
<link rel="stylesheet" href="/light.css"> <link rel="stylesheet" href="/light.css">
<style>
:not(#answers[hidden]) + #question {
display: none;
}
</style>
</header> </header>
<body> <body>
<h1>Hello World</h1> <h1>Hello World</h1>
<div id="answers" style="display: none;"> <div id="answers">
<ul id="answers-list"></ul> <ul id="answers-list"></ul>
<form id="answers-form" action="#" onsubmit="submitAnswersForm(this); return false;"> <form id="answers-form" action="#" onsubmit="submitAnswersForm(this); return false;">
</form> </form>
@ -56,8 +61,8 @@
let answers = JSON.parse(body); let answers = JSON.parse(body);
let result = ""; let result = "";
for (let i of answers) for (let i of answers)
result += `<br>${i}`; result += `<li>${i.Text}</li>`;
document.getElementById("answers").innerHTML = result; document.getElementById("answers-list").innerHTML = result;
}); });
} }

View File

@ -17,7 +17,6 @@ import (
"strings" "strings"
"syscall" "syscall"
"gitea.inhome.blapointe.com/local/gziphttp"
"golang.org/x/time/rate" "golang.org/x/time/rate"
) )
@ -163,9 +162,6 @@ var public = func() http.FileSystem {
func (h Handler) handle(session Session, w http.ResponseWriter, r *http.Request) error { func (h Handler) handle(session Session, w http.ResponseWriter, r *http.Request) error {
if !strings.HasPrefix(r.URL.Path, "/api/") { if !strings.HasPrefix(r.URL.Path, "/api/") {
if gziphttp.Can(r) {
w = gziphttp.New(w)
}
w.Header().Set("Cache-Control", "private, max-age=60") w.Header().Set("Cache-Control", "private, max-age=60")
http.FileServer(public).ServeHTTP(w, r) http.FileServer(public).ServeHTTP(w, r)
return nil return nil
@ -268,7 +264,7 @@ func (db fsDB) GetQuestions() ([]Question, error) {
} }
results := []Question{} results := []Question{}
for _, entry := range entries { for _, entry := range entries {
if strings.HasPrefix(path.Base(entry.Name()), ".") { if strings.HasPrefix(path.Base(entry.Name()), ".") || entry.IsDir() {
continue continue
} }
qid := path.Base(entry.Name()) qid := path.Base(entry.Name())