From ba7152ec21e23a467dfd2a0ceb929f33d8c8d890 Mon Sep 17 00:00:00 2001 From: a0eoc <42794343+a0eoc@users.noreply.github.com> Date: Sun, 12 Nov 2023 19:49:32 +0500 Subject: [PATCH 1/3] fix(dash,style): update faq link ref 970581cd4bd34da61efca6a4786c65140b5950c5 --- web/views/core/dashboard.tmpl | 2 +- web/views/style/view.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/views/core/dashboard.tmpl b/web/views/core/dashboard.tmpl index f34a4806..d7192639 100644 --- a/web/views/core/dashboard.tmpl +++ b/web/views/core/dashboard.tmpl @@ -93,7 +93,7 @@ {{ if or .DailyHistory .TotalHiistory .UserHistory .StyleHistory }}

History

-

Learn more about style statistics in the FAQ.

+

Learn more about style statistics in the FAQ.

{{ if not (or .DailyHistory .TotalHistory) }} No style history. Come back in a couple of days. {{ end }} diff --git a/web/views/style/view.tmpl b/web/views/style/view.tmpl index 1087b33b..8f86c865 100644 --- a/web/views/style/view.tmpl +++ b/web/views/style/view.tmpl @@ -154,7 +154,7 @@

Statistics

-

Learn how we calculate statistics in the FAQ.

+

Learn how we calculate statistics in the FAQ.

{{ with .Stats }}

Total views{{ .TotalViews }}

Total installs{{ .TotalInstalls }}

@@ -194,7 +194,7 @@ {{/*

History

-

Daily snapshots of style statistics.

+

Daily snapshots of style statistics.

{{ if not (or .DailyHistory .TotalHistory) }} No style history. Come back in a couple of days. {{ end }} From d500180e79ad8a1a104f21cd929f31f14123d477 Mon Sep 17 00:00:00 2001 From: a0eoc <42794343+a0eoc@users.noreply.github.com> Date: Sun, 12 Nov 2023 19:56:09 +0500 Subject: [PATCH 2/3] fix(add,import): don't reset PreviewURL ...on validation failure which is quite annoying and cought me a few times in production. This doesn't fix resetting of preview file though. --- handlers/style/add.go | 5 ++++- handlers/style/import.go | 15 +++++++++------ web/views/style/add.tmpl | 2 +- web/views/style/import.tmpl | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/handlers/style/add.go b/handlers/style/add.go index 576f039f..e57786c8 100644 --- a/handlers/style/add.go +++ b/handlers/style/add.go @@ -53,6 +53,10 @@ func CreatePost(c *fiber.Ctx) error { } c.Locals("Style", s) + // Get previewURL + preview := c.FormValue("previewURL") + c.Locals("PreviewURL", preview) + m, err := s.Validate(validator.V, true) if err != nil { c.Locals("err", m) @@ -82,7 +86,6 @@ func CreatePost(c *fiber.Ctx) error { // Check preview image. file, _ := c.FormFile("preview") - preview := c.FormValue("previewURL") styleID := strconv.FormatUint(uint64(s.ID), 10) if file != nil || preview != "" { if err = images.Generate(file, styleID, "0", "", preview); err != nil { diff --git a/handlers/style/import.go b/handlers/style/import.go index 558a67c8..3363a8e3 100644 --- a/handlers/style/import.go +++ b/handlers/style/import.go @@ -102,14 +102,18 @@ func ImportPost(c *fiber.Ctx) error { s.MirrorCode = c.FormValue("mirrorCode") == "on" s.MirrorMeta = c.FormValue("mirrorMeta") == "on" + // Get previewURL + preview := c.FormValue("previewURL", s.Preview) + m, err := s.Validate(validator.V, true) if err != nil { return c.Render("style/import", fiber.Map{ - "Title": "Import userstyle", - "User": u, - "Style": s, - "err": m, - "Error": "Incorrect userstyle data was entered. Please review the fields bellow.", + "Title": "Import userstyle", + "User": u, + "Style": s, + "PreviewURL": preview, + "err": m, + "Error": "Incorrect userstyle data was entered. Please review the fields bellow.", }) } @@ -140,7 +144,6 @@ func ImportPost(c *fiber.Ctx) error { // Check preview image. file, _ := c.FormFile("preview") - preview := c.FormValue("previewURL", s.Preview) styleID := strconv.FormatUint(uint64(s.ID), 10) if file != nil || preview != "" { if err := images.Generate(file, styleID, "0", "", preview); err != nil { diff --git a/web/views/style/add.tmpl b/web/views/style/add.tmpl index 19a4e165..1b04dca8 100644 --- a/web/views/style/add.tmpl +++ b/web/views/style/add.tmpl @@ -73,7 +73,7 @@ diff --git a/web/views/style/import.tmpl b/web/views/style/import.tmpl index 9f25b50f..379462d4 100644 --- a/web/views/style/import.tmpl +++ b/web/views/style/import.tmpl @@ -69,7 +69,7 @@ From 3ea30973dadd648033e8dcd409fbe10733de81d2 Mon Sep 17 00:00:00 2001 From: a0eoc <42794343+a0eoc@users.noreply.github.com> Date: Sun, 19 Nov 2023 21:16:54 +0500 Subject: [PATCH 3/3] chore(search): use q for Gmail Turns out, many use mail.google.com. At the moment it doesn't seem possible to make a request like gmail AND mail.google.com so I did the easiest thing. --- web/views/core/search.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/views/core/search.tmpl b/web/views/core/search.tmpl index 5aecebde..57233826 100644 --- a/web/views/core/search.tmpl +++ b/web/views/core/search.tmpl @@ -113,7 +113,7 @@