Compare commits
No commits in common. "174610b9d8862ae3daa19a48163f60b73aa31a2e" and "c8ef8262c326559f690688910fdbda983b30b72d" have entirely different histories.
174610b9d8
...
c8ef8262c3
@ -1,10 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[*.yml]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
10
api/form.go
10
api/form.go
@ -2,8 +2,10 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/ProjectSegfault/segfautils/config"
|
"github.com/ProjectSegfault/segfautils/config"
|
||||||
@ -73,10 +75,18 @@ func theActualFormCode(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(w, "Thanks for your message, and thanks for doing the captcha!\nPlease ignore how different this page looks to the page you were on earlier. I'll figure it out eventually!\n%#+v", hcaptchaResp)
|
fmt.Fprintf(w, "Thanks for your message, and thanks for doing the captcha!\nPlease ignore how different this page looks to the page you were on earlier. I'll figure it out eventually!\n%#+v", hcaptchaResp)
|
||||||
|
postData := url.Values{
|
||||||
|
"content": {"IP " + utils.GetUserIP(r) + "\nFrom " + r.FormValue("email") + " with feedback type " + r.FormValue("commentType") + ":\n" + "**" + r.FormValue("message") + "**\n https://abuseipdb.com/check/" + utils.GetUserIP(r)},
|
||||||
|
}
|
||||||
shoutrrr := shoutrrr.Send(config.ShoutrrrURL(), "IP "+utils.GetUserIP(r)+"\nFrom "+r.FormValue("email")+" with feedback type "+r.FormValue("commentType")+":\n"+"**"+r.FormValue("message")+"**\n https://abuseipdb.com/check/"+utils.GetUserIP(r))
|
shoutrrr := shoutrrr.Send(config.ShoutrrrURL(), "IP "+utils.GetUserIP(r)+"\nFrom "+r.FormValue("email")+" with feedback type "+r.FormValue("commentType")+":\n"+"**"+r.FormValue("message")+"**\n https://abuseipdb.com/check/"+utils.GetUserIP(r))
|
||||||
if shoutrrr != nil {
|
if shoutrrr != nil {
|
||||||
log.Fatal("Something went terribly wrong!", shoutrrr)
|
log.Fatal("Something went terribly wrong!", shoutrrr)
|
||||||
}
|
}
|
||||||
|
req, err := http.PostForm(webhookURL, postData)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Something went terribly wrong!", err)
|
||||||
|
}
|
||||||
|
fmt.Fprint(io.Discard, req) // Out with your request! I don't want it.
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
http.Error(w, "Method isn't allowed!\nYou may only POST here, not "+r.Method, http.StatusMethodNotAllowed)
|
http.Error(w, "Method isn't allowed!\nYou may only POST here, not "+r.Method, http.StatusMethodNotAllowed)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
[segfautils]
|
[segfautils]
|
||||||
port = 6893
|
port = 6893
|
||||||
auth_token = "YOURAUTHTOKEN"
|
auth_token = "YOURAUTHTOKEN"
|
||||||
shoutrrr_url = "YOURSHOUTRRURL"
|
|
||||||
|
|
||||||
[hcaptcha]
|
[hcaptcha]
|
||||||
site_key = "YOURSITEKEY"
|
site_key = "YOURSITEKEY"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
@ -12,7 +11,6 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
font-family: 'JetBrains Mono', 'JetBrainsMono Nerd Font', monospace
|
font-family: 'JetBrains Mono', 'JetBrainsMono Nerd Font', monospace
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
@ -51,8 +49,7 @@
|
|||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact input,
|
#contact input, select {
|
||||||
select {
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
@ -63,7 +60,6 @@
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact select {
|
#contact select {
|
||||||
width: 105%;
|
width: 105%;
|
||||||
max-width: 105%;
|
max-width: 105%;
|
||||||
@ -81,18 +77,18 @@
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact button[type="submit"]:hover {
|
#contact button[type="submit"]:hover {
|
||||||
background: #00a484;
|
background: #00a484;
|
||||||
-webkit-transition: background 0.3s ease-in-out;
|
-webkit-transition: background 0.3s ease-in-out;
|
||||||
-moz-transition: background 0.3s ease-in-out;
|
-moz-transition: background 0.3s ease-in-out;
|
||||||
transition: background-color 0.3s ease-in-out;
|
transition: background-color 0.3s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact button[type="submit"]:active {
|
#contact button[type="submit"]:active {
|
||||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
|
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact button[type="delete"] {
|
#contact button[type="delete"] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -104,18 +100,18 @@
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact button[type="delete"]:hover {
|
#contact button[type="delete"]:hover {
|
||||||
background: #990005;
|
background: #990005;
|
||||||
-webkit-transition: background 0.3s ease-in-out;
|
-webkit-transition: background 0.3s ease-in-out;
|
||||||
-moz-transition: background 0.3s ease-in-out;
|
-moz-transition: background 0.3s ease-in-out;
|
||||||
transition: background-color 0.3s ease-in-out;
|
transition: background-color 0.3s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#contact button[type="delete"]:active {
|
#contact button[type="delete"]:active {
|
||||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
|
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #00d4aa;
|
color: #00d4aa;
|
||||||
@ -126,13 +122,22 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Post Announcement</h1>
|
<h1>Post Announcement</h1>
|
||||||
<form id="contact" action="/api/announcements/post" method="POST" target="_blank">
|
<form
|
||||||
|
id="contact"
|
||||||
|
action="/api/announcements/post"
|
||||||
|
method="POST"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<input type="password" name="token" placeholder="Your authentication token" required />
|
<input
|
||||||
|
type="password"
|
||||||
|
name="token"
|
||||||
|
placeholder="Your authentication token"
|
||||||
|
required
|
||||||
|
/>
|
||||||
<br />
|
<br />
|
||||||
<select id="severity" name="severity" required>
|
<select id="severity" name="severity" required>
|
||||||
<option value="" selected disabled>Select severity of announcement</option>
|
<option value="" selected disabled>Select severity of announcement</option>
|
||||||
@ -142,21 +147,39 @@
|
|||||||
<option value="high">High severity</option>
|
<option value="high">High severity</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<textarea name="title" rows="4" cols="25" required placeholder="The announcement text"></textarea>
|
<textarea
|
||||||
|
name="title"
|
||||||
|
rows="4"
|
||||||
|
cols="25"
|
||||||
|
required
|
||||||
|
placeholder="The announcement text"></textarea>
|
||||||
<br />
|
<br />
|
||||||
<input type="text" name="link" placeholder="Your link for more details" />
|
<input
|
||||||
|
type="text"
|
||||||
|
name="link"
|
||||||
|
placeholder="Your link for more details"
|
||||||
|
/>
|
||||||
<br />
|
<br />
|
||||||
<button type="submit" />Submit</button>
|
<button type="submit" />Submit</button>
|
||||||
</form>
|
</form>
|
||||||
<h1 style="margin-top: 20px;">Delete Announcement</h1>
|
<h1 style="margin-top: 20px;">Delete Announcement</h1>
|
||||||
<form id="contact" action="/api/announcements/delete" method="POST" target="_blank">
|
<form
|
||||||
|
id="contact"
|
||||||
|
action="/api/announcements/delete"
|
||||||
|
method="POST"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<input type="password" name="token" placeholder="Your authentication token" required />
|
<input
|
||||||
|
type="password"
|
||||||
|
name="token"
|
||||||
|
placeholder="Your authentication token"
|
||||||
|
required
|
||||||
|
/>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
<button type="delete" />Delete</button>
|
<button type="delete"/>Delete</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -1,6 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
@ -23,11 +22,18 @@
|
|||||||
</style>
|
</style>
|
||||||
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<form action="/api/form" method="POST">
|
<form
|
||||||
|
action="/api/form"
|
||||||
|
method="POST"
|
||||||
|
>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<input type="text" name="email" placeholder="Your email" required />
|
<input
|
||||||
|
type="text"
|
||||||
|
name="email"
|
||||||
|
placeholder="Your email"
|
||||||
|
required
|
||||||
|
/>
|
||||||
<select id="commentType" name="commentType" required>
|
<select id="commentType" name="commentType" required>
|
||||||
<option value="" selected disabled>Select a type of comment</option>
|
<option value="" selected disabled>Select a type of comment</option>
|
||||||
<option value="Feedback">Feedback</option>
|
<option value="Feedback">Feedback</option>
|
||||||
@ -36,10 +42,16 @@
|
|||||||
<option value="Bug">Bug</option>
|
<option value="Bug">Bug</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="comment" name="message" rows="4" cols="25" required placeholder="Your message"></textarea>
|
<textarea
|
||||||
|
id="comment"
|
||||||
|
name="message"
|
||||||
|
rows="4"
|
||||||
|
cols="25"
|
||||||
|
required
|
||||||
|
placeholder="Your message"
|
||||||
|
></textarea>
|
||||||
<div class="h-captcha" data-sitekey="{{.HCaptchaSiteKey}}"></div>
|
<div class="h-captcha" data-sitekey="{{.HCaptchaSiteKey}}"></div>
|
||||||
<input type="submit" value="Submit" />
|
<input type="submit" value="Submit" />
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -1,5 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
@ -21,10 +20,8 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to Segfautils</h1>
|
<h1>Welcome to Segfautils</h1>
|
||||||
<h3>Running at port {{.Port}} | <a href="https://github.com/ProjectSegfault/segfautils/" target="_blank">GitHub</a>
|
<h3>Running at port {{.Port}} | <a href="https://github.com/ProjectSegfault/segfautils/" target="_blank">GitHub</a></h3>
|
||||||
</h3>
|
<h3><a href="/form">Click here for an example form implementation</a></h3>
|
||||||
<h3><a href="/form">Click here for an example form implementation</a></h3>
|
|
||||||
</body>
|
</body>
|
Reference in New Issue
Block a user