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

View File

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