feat: add SHORTEN_MAIL for support email
This commit is contained in:
parent
b9a275b0d5
commit
745e465034
3 changed files with 13 additions and 2 deletions
|
@ -7,4 +7,5 @@
|
|||
Environmental variables:
|
||||
- `SHORTEN_HOST` - hostname
|
||||
- `SHORTEN_BIND` - bind address (default: `127.0.0.1:4488`)
|
||||
- `SHORTEN_MAIL` - optional email for support/abuse reports
|
||||
- `POSTGRES_URI` - lib/pq connection string (see [here](https://pkg.go.dev/github.com/lib/pq#section-documentation))
|
11
index.html
11
index.html
|
@ -10,6 +10,7 @@
|
|||
height: calc(100vh - 32px);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
form {
|
||||
display: flex;
|
||||
|
@ -31,10 +32,15 @@
|
|||
font-size: 30px;
|
||||
}
|
||||
a {
|
||||
font-family: sans-serif;
|
||||
color: #dddddd;
|
||||
text-decoration: none;
|
||||
}
|
||||
footer {
|
||||
width: 100vw;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -45,5 +51,8 @@
|
|||
<input type="text" {{ with .error }}placeholder="{{ . }}"{{ end }} name="url" autocomplete="off" autocapitalize="off">
|
||||
</form>
|
||||
{{ end }}
|
||||
{{ if .mail }}
|
||||
<footer>support, takedown, abuse reports: {{ .mail }}</footer>
|
||||
{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
1
main.go
1
main.go
|
@ -195,6 +195,7 @@ func (h *Handler) GetCode(url string, ip string) (string, error) {
|
|||
func Render(wr http.ResponseWriter, data map[string]string) {
|
||||
wr.Header().Set("Content-Type", "text/html")
|
||||
data["host"] = os.Getenv("SHORTEN_HOST")
|
||||
data["mail"] = os.Getenv("SHORTEN_MAIL")
|
||||
err := tmpl.Execute(wr, data)
|
||||
if err != nil {
|
||||
log.Println("error writing template:", err)
|
||||
|
|
Loading…
Reference in a new issue