I realized having to host this potentially indefinitely might not be the best idea, so I am going to shut down this gitea instance eventually.
You’ll have time, at least until the end of 2022, probably longer, but please just get all your stuff somewhere safe in case we ever disappear.
If any of your build scripts rely on my (kageru’s) projects hosted here, check my Github or IEW on Github for encoding projects. If you can’t find what you’re looking there, tell me to migrate it.

Made template prettier

Also more formatting for the output. This is now actually usable.
master
kageru 4 years ago
parent f5534b62ff
commit 99d20cf1f6
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

@ -41,7 +41,7 @@ func resultToBlogposts(res *sql.Rows) []BlogPost {
var content, author, title string
var timeInt int64
res.Scan(&content, &author, &title, &timeInt)
post := BlogPost{Content:content, Author:author, Title:title, Time:time.Unix(timeInt, 0)}
post := BlogPost{Content:content, Author:author, Title:title, FTime:time.Unix(timeInt, 0).Format("02.01.2006 - 15:04:05")}
entries = append(entries, post)
}
return entries

@ -20,5 +20,6 @@ type BlogPost struct {
Author string `"author"`
Secret string `"secret"`
Time time.Time `"time"`
FTime string `"ftime"`
}

@ -15,8 +15,8 @@ type OutputFormatter struct {
Content string
}
type Wrapper struct {
Post OutputFormatter
type Blog struct {
Posts []BlogPost
}
func startServer() {
@ -40,8 +40,7 @@ func get(w http.ResponseWriter, r *http.Request) {
}
*/
results := readBlogpostsFromDB()
err = t.ExecuteTemplate(w, "overview.html", OutputFormatter{Author: results[0].Author, Content: results[0].Content})
log.Println(err)
t.ExecuteTemplate(w, "overview.html", Blog{results})
}
func post(w http.ResponseWriter, r *http.Request) {

@ -1,7 +1,43 @@
<html>
<body style="background-color: #333; color: #ccc;">
<div id="content" style="width: 70%; margin: auto; padding-top: 10%;">
{{.Author}} said: {{.Content}}
<style>
body {
background-color: #333;
color: #ccc;
font-family: monospace, "Helvetica Neue", "Helvetica", "Noto Sans", sans-serif;
}
#content {
width: 70%;
margin: auto;
padding-top: 2em;
}
td.first {
width: 20%;
}
td.second {
padding-top: 0;
margin-top: 0;
top: 0;
width: 80%;
}
</style>
<body>
<div id="content">
<h2 style="text-align: center">Random Thought Dump</h2>
<table>
{{range $i, $p := $.Posts -}}
<tr>
<td>
[{{$p.FTime}}] &lt;{{$p.Author}}&gt;
</td>
<td>
{{$p.Content}}
</td>
</tr>
{{- end}}
<table>
</div>
</body>
</html>

Loading…
Cancel
Save