chore: format html better

This commit is contained in:
xuu 2025-04-02 13:20:04 -06:00
parent 74fa69274d
commit c4191ec6cd
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
3 changed files with 17 additions and 9 deletions

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.24.1
require (
github.com/mattn/go-sqlite3 v1.14.24
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.6.0
go.yarn.social/lextwt v0.1.5-0.20250328015012-42a9ffb46fea
go.yarn.social/lextwt v0.1.5-0.20250402191850-311481301a38
)
require (

2
go.sum
View File

@ -114,6 +114,8 @@ go.yarn.social/lextwt v0.1.5-0.20250327005027-02d9b44de4dd h1:Np3zWtQ0GB9WhRFCPb
go.yarn.social/lextwt v0.1.5-0.20250327005027-02d9b44de4dd/go.mod h1:P36NPegLbhbFa1A0JOLsDyIQcdM0zdmx8kPKACXry4A=
go.yarn.social/lextwt v0.1.5-0.20250328015012-42a9ffb46fea h1:sbWswg5s8VaXB1hBQDs4KOBRBN2jPKtfFlcCQ3EThZk=
go.yarn.social/lextwt v0.1.5-0.20250328015012-42a9ffb46fea/go.mod h1:P36NPegLbhbFa1A0JOLsDyIQcdM0zdmx8kPKACXry4A=
go.yarn.social/lextwt v0.1.5-0.20250402191850-311481301a38 h1:WOPc9ZXRLGqQmQazfh3x7QqtYAIvUAnWq+oE3+aHZQA=
go.yarn.social/lextwt v0.1.5-0.20250402191850-311481301a38/go.mod h1:P36NPegLbhbFa1A0JOLsDyIQcdM0zdmx8kPKACXry4A=
go.yarn.social/types v0.0.0-20250108134258-ed75fa653ede h1:XV9tuDQ605xxH4qIQPRHM1bOa7k0rJZ2RqA5kz2Nun4=
go.yarn.social/types v0.0.0-20250108134258-ed75fa653ede/go.mod h1:+xnDkQ0T0S8emxWIsvxlCAoyF8gBaj0q81hr/VrKc0c=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=

View File

@ -70,10 +70,10 @@ func (a *HTML) conv(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
hash := r.PathValue("hash")
if (len(hash) < 6 || len(hash) > 8) && !notAny(hash, "abcdefghijklmnopqrstuvwxyz234567") {
w.WriteHeader(http.StatusBadRequest)
return
}
// if (len(hash) < 6 || len(hash) > 8) && !notAny(hash, "abcdefghijklmnopqrstuvwxyz234567") {
// w.WriteHeader(http.StatusBadRequest)
// return
// }
limit := 100
if v, ok := strconv.Atoi(r.URL.Query().Get("limit")); ok == nil {
@ -117,17 +117,23 @@ func (r *HTWriter) WriteTo(w io.Writer) (int64, error) {
<head>
<title>The Watcher</title>
<style>
body { width: 70%; margin: auto; background: black; color: white; }
@import url('https://fonts.cdnfonts.com/css/open-dyslexic');
body { font-family: 'Open-Dyslexic', sans-serif; width: 70%; margin: auto; background: black; color: white; }
a { color: cornflowerblue; text-decoration: none; }
main { }
pre { white-space: pre-wrap; }
pre.preamble { color: green; }
article { border: 1px solid green; border-radius: 4px; padding: 4px; margin: 2px; }
article { background-color: #333; border: 1px solid green; border-radius: 4px; padding: 4px; margin: 2px; }
article pre { color: orange; }
.h-card { columns: 2; }
.h-card .author { display: flex; }
.h-card .icon { width: 36px; margin: 4px; }
.h-card .u-photo { width: 32px; }
.h-card .date { text-align: right;}
section { overflow: scroll; }
.p-org a { color: darkgrey; }
section { padding: 1em; border: 1px solid darkgreen; background-color: #111; }
section img { max-width: 100%; }
</style>
</head>
<body onload="setTimestamps()">
@ -191,7 +197,7 @@ func (r *HTWriter) WriteTo(w io.Writer) (int64, error) {
</div>
</header>
<section>
<pre>%M</pre>
%h
</section>
</div>
</article>