feat: version and back button

This commit is contained in:
httpjamesm 2022-12-28 11:33:26 -05:00
parent 3398ba637b
commit 504144c94b
6 changed files with 43 additions and 8 deletions

3
config/version.go Normal file
View File

@ -0,0 +1,3 @@
package config
var Version = "1.1"

View File

@ -90,6 +90,15 @@ img {
font-size: .8rem; font-size: .8rem;
} }
.logo-link {
text-decoration: none;
}
.logo {
width: 2rem;
height: 2rem;
}
@media only screen and (max-width: 800px) { @media only screen and (max-width: 800px) {
body { body {
padding-left: 1rem; padding-left: 1rem;

View File

@ -1,6 +1,7 @@
package routes package routes
import ( import (
"anonymousoverflow/config"
"fmt" "fmt"
"strings" "strings"
@ -8,7 +9,9 @@ import (
) )
func GetHome(c *gin.Context) { 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 { type urlConversionRequest struct {

View File

@ -141,10 +141,10 @@ func ViewQuestion(c *gin.Context) {
answers = append(answers, template.HTML(answerBodyHTML)) answers = append(answers, template.HTML(answerBodyHTML))
}) })
imagePolicy := "https:" imagePolicy := "'self' https:"
if c.MustGet("disable_images").(bool) { if c.MustGet("disable_images").(bool) {
imagePolicy = "'none'" imagePolicy = "'self'"
} }
c.HTML(200, "question.html", gin.H{ c.HTML(200, "question.html", gin.H{

View File

@ -12,12 +12,19 @@
<link rel="icon" href="/static/codecircles.png" /> <link rel="icon" href="/static/codecircles.png" />
<meta name="theme-color" content="#8CFFC1" /> <meta name="theme-color" content="#8CFFC1" />
<meta name="og:image" content="/static/codecircles.png" /> <meta name="og:image" content="/static/codecircles.png" />
<meta name="description" content="View StackOverflow threads in privacy and without the clutter." /> <meta
name="description"
content="View StackOverflow threads in privacy and without the clutter."
/>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="title"> <div class="title">
<img class="logo" src="/static/codecircles.png" alt="4 circles with alternating colors between green and white" /> <img
class="logo"
src="/static/codecircles.png"
alt="4 circles with alternating colors between green and white"
/>
<h1>AnonymousOverflow</h1> <h1>AnonymousOverflow</h1>
</div> </div>
<h2>Get programming help without compromising your privacy.</h2> <h2>Get programming help without compromising your privacy.</h2>
@ -63,6 +70,7 @@
rel="noopener noreferrer" rel="noopener noreferrer"
>Source</a >Source</a
> >
• Version {{ .version }}
</p> </p>
</div> </div>
</body> </body>

View File

@ -16,12 +16,24 @@
</head> </head>
<body> <body>
<div class="parent"> <div class="parent">
<a href="/" class="logo-link">
<img
class="logo"
src="/static/codecircles.png"
alt="4 circles with alternating colors between green and white"
/>
</a>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h1>{{ .title }}</h1> <h1>{{ .title }}</h1>
<p class="timestamp"> <p class="timestamp">
Asked {{ .timestamp }} by Asked {{ .timestamp }} by
<a href="https://stackoverflow.com{{ .authorURL }}" target="_blank" rel="noopener noreferrer">{{ .author }}</a>. <a
href="https://stackoverflow.com{{ .authorURL }}"
target="_blank"
rel="noopener noreferrer"
>{{ .author }}</a
>.
</p> </p>
</div> </div>
<div class="card-body">{{ .body }}</div> <div class="card-body">{{ .body }}</div>