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:
|
Environmental variables:
|
||||||
- `SHORTEN_HOST` - hostname
|
- `SHORTEN_HOST` - hostname
|
||||||
- `SHORTEN_BIND` - bind address (default: `127.0.0.1:4488`)
|
- `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))
|
- `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);
|
height: calc(100vh - 32px);
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
form {
|
form {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -31,10 +32,15 @@
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
font-family: sans-serif;
|
|
||||||
color: #dddddd;
|
color: #dddddd;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
footer {
|
||||||
|
width: 100vw;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -45,5 +51,8 @@
|
||||||
<input type="text" {{ with .error }}placeholder="{{ . }}"{{ end }} name="url" autocomplete="off" autocapitalize="off">
|
<input type="text" {{ with .error }}placeholder="{{ . }}"{{ end }} name="url" autocomplete="off" autocapitalize="off">
|
||||||
</form>
|
</form>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if .mail }}
|
||||||
|
<footer>support, takedown, abuse reports: {{ .mail }}</footer>
|
||||||
|
{{ end }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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) {
|
func Render(wr http.ResponseWriter, data map[string]string) {
|
||||||
wr.Header().Set("Content-Type", "text/html")
|
wr.Header().Set("Content-Type", "text/html")
|
||||||
data["host"] = os.Getenv("SHORTEN_HOST")
|
data["host"] = os.Getenv("SHORTEN_HOST")
|
||||||
|
data["mail"] = os.Getenv("SHORTEN_MAIL")
|
||||||
err := tmpl.Execute(wr, data)
|
err := tmpl.Execute(wr, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("error writing template:", err)
|
log.Println("error writing template:", err)
|
||||||
|
|
Loading…
Reference in a new issue