From 706021a5e76c64cc18ded0a9d59d40e8421dc8c3 Mon Sep 17 00:00:00 2001 From: Samuel W Date: Fri, 10 Jan 2025 16:46:54 +0100 Subject: Update some looks and stuff --- .gitignore | 2 + assets/style.css | 7 ++++ index.templ | 16 ++++---- index_templ.go | 112 +++++++++++++++++++++++++++++++++++++++++++------------ main.go | 1 + 5 files changed, 107 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 98e6ef6..81e8b4d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.db +*.db-shm +*.db-wal diff --git a/assets/style.css b/assets/style.css index 2994f18..bb4d653 100644 --- a/assets/style.css +++ b/assets/style.css @@ -8,6 +8,13 @@ body { justify-content:center; } +h1 { + font-family: "Jacquard 12"; + font-size: 50px; + margin-top: 20px; + margin-bottom: 20px; +} + .upload { display: flex; justify-content:center; diff --git a/index.templ b/index.templ index 23c389a..6df889f 100644 --- a/index.templ +++ b/index.templ @@ -14,11 +14,16 @@ templ index(ps []Post, tz *time.Location) { + + +
@posts(ps, tz) @@ -40,11 +45,7 @@ templ loginPage(csrfToken string) { - ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"> ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -86,12 +122,21 @@ func uploadPage(csrfToken string) templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Description:
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var9 := `Description:` + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -118,9 +181,9 @@ func posts(posts []Post, tz *time.Location) templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var11 := templ.GetChildren(ctx) + if templ_7745c5c3_Var11 == nil { + templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) for _, post := range posts { @@ -144,12 +207,12 @@ func posts(posts []Post, tz *time.Location) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(post.Description) + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(post.Description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 97, Col: 45} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 98, Col: 45} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -157,12 +220,12 @@ func posts(posts []Post, tz *time.Location) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(post.CreatedAt.In(tz).Format("2006-01-02 - 15:04")) + var templ_7745c5c3_Var13 string + templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(post.CreatedAt.In(tz).Format("2006-01-02 - 15:04")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 98, Col: 72} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `index.templ`, Line: 99, Col: 72} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -176,7 +239,8 @@ func posts(posts []Post, tz *time.Location) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(fmt.Sprintf("/posts?after=%v", url.QueryEscape(posts[len(posts)-1].CreatedAt.Format(time.RFC3339))))) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(fmt.Sprintf("/posts?after=%v", + url.QueryEscape(posts[len(posts)-1].CreatedAt.Format(time.RFC3339))))) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/main.go b/main.go index 03b5474..ae6a684 100644 --- a/main.go +++ b/main.go @@ -61,6 +61,7 @@ func main() { e.Use(session.Middleware(sessions.NewCookieStore([]byte(sessionSecret)))) db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{}) + db.Exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout = 5000;") db.AutoMigrate(Post{}) -- cgit v1.2.3