From 504144c94bec9eb7625570a0f7fc395a3fc3beea Mon Sep 17 00:00:00 2001 From: httpjamesm Date: Wed, 28 Dec 2022 11:33:26 -0500 Subject: [PATCH] feat: version and back button --- config/version.go | 3 +++ public/question.css | 9 +++++++++ src/routes/home.go | 5 ++++- src/routes/question.go | 4 ++-- templates/home.html | 12 ++++++++++-- templates/question.html | 18 +++++++++++++++--- 6 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 config/version.go diff --git a/config/version.go b/config/version.go new file mode 100644 index 0000000..440cd28 --- /dev/null +++ b/config/version.go @@ -0,0 +1,3 @@ +package config + +var Version = "1.1" diff --git a/public/question.css b/public/question.css index 07b7f15..a29defc 100644 --- a/public/question.css +++ b/public/question.css @@ -90,6 +90,15 @@ img { font-size: .8rem; } +.logo-link { + text-decoration: none; +} + +.logo { + width: 2rem; + height: 2rem; +} + @media only screen and (max-width: 800px) { body { padding-left: 1rem; diff --git a/src/routes/home.go b/src/routes/home.go index 4c97c1e..7d05625 100644 --- a/src/routes/home.go +++ b/src/routes/home.go @@ -1,6 +1,7 @@ package routes import ( + "anonymousoverflow/config" "fmt" "strings" @@ -8,7 +9,9 @@ import ( ) func GetHome(c *gin.Context) { - c.HTML(200, "home.html", gin.H{}) + c.HTML(200, "home.html", gin.H{ + "version": config.Version, + }) } type urlConversionRequest struct { diff --git a/src/routes/question.go b/src/routes/question.go index ce101cd..8c764a7 100644 --- a/src/routes/question.go +++ b/src/routes/question.go @@ -141,10 +141,10 @@ func ViewQuestion(c *gin.Context) { answers = append(answers, template.HTML(answerBodyHTML)) }) - imagePolicy := "https:" + imagePolicy := "'self' https:" if c.MustGet("disable_images").(bool) { - imagePolicy = "'none'" + imagePolicy = "'self'" } c.HTML(200, "question.html", gin.H{ diff --git a/templates/home.html b/templates/home.html index a51d76b..1298aa4 100644 --- a/templates/home.html +++ b/templates/home.html @@ -12,12 +12,19 @@ - +
- +

AnonymousOverflow

Get programming help without compromising your privacy.

@@ -63,6 +70,7 @@ rel="noopener noreferrer" >Source + • Version {{ .version }}

diff --git a/templates/question.html b/templates/question.html index f4b0b5e..788e037 100644 --- a/templates/question.html +++ b/templates/question.html @@ -16,12 +16,24 @@
+ + +

{{ .title }}

Asked {{ .timestamp }} by - {{ .author }}. + {{ .author }}.

{{ .body }}
@@ -29,8 +41,8 @@

Answers

{{ range $answer := .answers }} -
{{ $answer }}
-
+
{{ $answer }}
+
{{ end }}