akis stuff

This commit is contained in:
Akis 2022-07-29 15:35:19 +03:00
parent 2791e68131
commit 9b956bd505
Signed by: akis
GPG Key ID: 267BF5C6677944ED
3 changed files with 71 additions and 0 deletions

View File

@ -29,6 +29,15 @@ func main() {
}
tmpl.Execute(w, data)
})
tmpl_form := template.Must(template.ParseFiles("static/form.html"))
http.HandleFunc("/form/", func(w http.ResponseWriter, r *http.Request) {
data := StaticThingy{
Port: port,
}
tmpl_form.Execute(w, data)
})
http.HandleFunc("/api/", func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "welcome to hell")
})

57
static/form.html Normal file
View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Segfautilites form implementation example</title>
<style>
body {
background-color: #252525;
color: #fff;
font-family: 'JetBrains Mono', 'JetBrainsMono Nerd Font', monospace
}
a {
color: #00d4aa;
}
a:hover {
color: #4beacb;
}
</style>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
</head>
<body>
<form
action="https://localhost:{{.Port}}/api/form"
method="POST"
>
<div class="meta">
<input
type="text"
name="email"
placeholder="Your email"
required
/>
<select id="commentType" name="commentType" required>
<option value="" selected disabled>Select a type of comment</option>
<option value="Feedback">Feedback</option>
<option value="Suggestion">Suggestion</option>
<option value="Question">Question</option>
<option value="Bug">Bug</option>
</select>
</div>
<textarea
id="comment"
name="message"
rows="4"
cols="25"
required
placeholder="Your message"
></textarea>
<div class="h-captcha" data-sitekey=""></div>
<input type="submit" value="Submit" />
</form>
</body>
</html>

View File

@ -1,5 +1,9 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Segfautilites</title>
<style>
body {
background-color: #252525;
@ -19,4 +23,5 @@
<body>
<h1>Welcome to Segfautilities</h1>
<h3>Running at port {{.Port}} | <a href="https://github.com/ProjectSegfault/segfautilities/" target="_blank">GitHub</a></h3>
<h3><a href="/form">Click here for an example form implementation</a></h3>
</body>