This commit is contained in:
Akis 2022-07-29 15:41:45 +03:00
parent 9b956bd505
commit 4f526f4dbd
Signed by: akis
GPG Key ID: 267BF5C6677944ED
2 changed files with 5 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import (
type StaticThingy struct {
Port string
HCaptchaSiteKey string
}
var port string
@ -22,6 +23,7 @@ func main() {
otherthings.CheckEnv()
log.Println("[HTTP] Starting server")
port := os.Getenv("SEGFAUTILITIES_PORT")
hcaptcha_site_key := os.Getenv("SEGFAUTILITIES_PORT")
tmpl := template.Must(template.ParseFiles("static/index.html"))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
data := StaticThingy{
@ -34,6 +36,7 @@ func main() {
http.HandleFunc("/form/", func(w http.ResponseWriter, r *http.Request) {
data := StaticThingy{
Port: port,
HCaptchaSiteKey: hcaptcha_site_key,
}
tmpl_form.Execute(w, data)
})

View File

@ -24,7 +24,7 @@
</head>
<body>
<form
action="https://localhost:{{.Port}}/api/form"
action="/api/form"
method="POST"
>
<div class="meta">
@ -50,7 +50,7 @@
required
placeholder="Your message"
></textarea>
<div class="h-captcha" data-sitekey=""></div>
<div class="h-captcha" data-sitekey="{{.HCaptchaSiteKey}}"></div>
<input type="submit" value="Submit" />
</form>
</body>