Compare commits

...

5 Commits

Author SHA1 Message Date
Midou36O 174610b9d8
add the shoutrr cfg
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-10-18 19:15:14 +01:00
Odyssey da9c317ead as I thought
Signed-off-by: Odyssey <odyssey346@disroot.org>
2022-10-18 15:38:35 +02:00
Odyssey e32ba6131f Switch to tabs for everything. (Note: don't know if this will break the .yml files)
Signed-off-by: Odyssey <odyssey346@disroot.org>
2022-10-18 15:37:38 +02:00
Odyssey 12b07a6441 Add .editorconfig
Signed-off-by: Odyssey <odyssey346@disroot.org>
2022-10-18 15:34:34 +02:00
Odyssey 4b5642ac88 easy merge conflic fix lmfao
Signed-off-by: Odyssey <odyssey346@disroot.org>
2022-10-18 15:30:03 +02:00
6 changed files with 166 additions and 197 deletions

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
end_of_line = lf
indent_style = tab
indent_size = 4
[*.yml]
indent_style = space
indent_size = 4

View File

@ -2,10 +2,8 @@ package api
import (
"fmt"
"io"
"log"
"net/http"
"net/url"
"text/template"
"github.com/ProjectSegfault/segfautils/config"
@ -75,18 +73,10 @@ func theActualFormCode(w http.ResponseWriter, r *http.Request) {
}
} 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)
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))
if shoutrrr != nil {
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:
http.Error(w, "Method isn't allowed!\nYou may only POST here, not "+r.Method, http.StatusMethodNotAllowed)

View File

@ -1,6 +1,7 @@
[segfautils]
port = 6893
auth_token = "YOURAUTHTOKEN"
shoutrrr_url = "YOURSHOUTRRURL"
[hcaptcha]
site_key = "YOURSITEKEY"
@ -8,4 +9,4 @@ secret_key = "YOURSECRETKEY"
[options]
announce = true
form = false
form = false

View File

@ -1,185 +1,162 @@
<!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>Segfautils announcement command centre</title>
<style>
body {
background-color: #252525;
color: #fff;
font-family: 'JetBrains Mono', 'JetBrainsMono Nerd Font', monospace
}
.container {
width: 100%;
max-width: 400px;
margin: 0 auto;
position: relative;
}
#contact input[type="token"],
#contact input[type="link"],
#contact textarea,
#contact select,
#contact button[type="submit"] {
font: 500 15px/16px "Roboto", sans-serif;
}
<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>Segfautils announcement command centre</title>
<style>
body {
background-color: #252525;
color: #fff;
font-family: 'JetBrains Mono', 'JetBrainsMono Nerd Font', monospace
}
.container h1 {
text-align: center;
margin: 0;
padding: 0;
font-size: 2rem;
}
.container {
width: 100%;
max-width: 400px;
margin: 0 auto;
position: relative;
}
#contact input[type="token"],
#contact input[type="link"],
#contact textarea,
#contact select,
#contact button[type="submit"] {
font: 500 15px/16px "Roboto", sans-serif;
}
.container h1 {
text-align: center;
margin: 0;
padding: 0;
font-size: 2rem;
}
#contact textarea {
text-align: center;
border-radius: 5px;
margin-top: 10px;
width: 100%;
border: none;
color: #FFF;
background: #3b3b3b;
margin: 0 0 5px;
padding: 10px;
height: 100px;
max-width: 100%;
resize: none;
}
#contact textarea {
text-align: center;
border-radius: 5px;
margin-top: 10px;
width: 100%;
border: none;
color: #FFF;
background: #3b3b3b;
margin: 0 0 5px;
padding: 10px;
height: 100px;
max-width: 100%;
resize: none;
}
#contact input, select {
text-align: center;
border-radius: 5px;
color: #FFF;
width: 100%;
border: none;
background: #3b3b3b;
margin: 0 0 5px;
padding: 10px;
max-width: 100%;
}
#contact select {
width: 105%;
max-width: 105%;
}
#contact input,
select {
text-align: center;
border-radius: 5px;
color: #FFF;
width: 100%;
border: none;
background: #3b3b3b;
margin: 0 0 5px;
padding: 10px;
max-width: 100%;
}
#contact select {
width: 105%;
max-width: 105%;
}
#contact button[type="submit"] {
cursor: pointer;
width: 105%;
border: none;
background: #00d4aa;
color: #252525;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
border-radius: 5px;
}
#contact button[type="submit"] {
cursor: pointer;
width: 105%;
border: none;
background: #00d4aa;
color: #252525;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
border-radius: 5px;
}
#contact button[type="submit"]:hover {
background: #00a484;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="submit"]:hover {
background: #00a484;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
#contact button[type="submit"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
#contact button[type="delete"] {
cursor: pointer;
width: 105%;
border: none;
background: #d10006;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
border-radius: 5px;
}
#contact button[type="delete"] {
cursor: pointer;
width: 105%;
border: none;
background: #d10006;
color: #FFF;
margin: 0 0 5px;
padding: 10px;
font-size: 15px;
border-radius: 5px;
}
#contact button[type="delete"]:hover {
background: #990005;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="delete"]:hover {
background: #990005;
-webkit-transition: background 0.3s ease-in-out;
-moz-transition: background 0.3s ease-in-out;
transition: background-color 0.3s ease-in-out;
}
#contact button[type="delete"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
#contact button[type="delete"]:active {
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
a {
color: #00d4aa;
}
a {
color: #00d4aa;
}
a:hover {
color: #4beacb;
}
</style>
a:hover {
color: #4beacb;
}
</style>
</head>
<body>
<div class="container">
<h1>Post Announcement</h1>
<form
id="contact"
action="/api/announcements/post"
method="POST"
target="_blank"
>
<div class="meta">
<input
type="password"
name="token"
placeholder="Your authentication token"
required
/>
<br />
<select id="severity" name="severity" required>
<option value="" selected disabled>Select severity of announcement</option>
<option value="info">Information announcement</option>
<option value="low">Low severity</option>
<option value="medium">Medium severity</option>
<option value="high">High severity</option>
</select>
</div>
<textarea
name="title"
rows="4"
cols="25"
required
placeholder="The announcement text"></textarea>
<br />
<input
type="text"
name="link"
placeholder="Your link for more details"
/>
<br />
<button type="submit" />Submit</button>
</form>
<h1 style="margin-top: 20px;">Delete Announcement</h1>
<form
id="contact"
action="/api/announcements/delete"
method="POST"
target="_blank"
>
<div class="meta">
<input
type="password"
name="token"
placeholder="Your authentication token"
required
/>
<br />
</div>
<button type="delete"/>Delete</button>
</form>
</div>
<div class="container">
<h1>Post Announcement</h1>
<form id="contact" action="/api/announcements/post" method="POST" target="_blank">
<div class="meta">
<input type="password" name="token" placeholder="Your authentication token" required />
<br />
<select id="severity" name="severity" required>
<option value="" selected disabled>Select severity of announcement</option>
<option value="info">Information announcement</option>
<option value="low">Low severity</option>
<option value="medium">Medium severity</option>
<option value="high">High severity</option>
</select>
</div>
<textarea name="title" rows="4" cols="25" required placeholder="The announcement text"></textarea>
<br />
<input type="text" name="link" placeholder="Your link for more details" />
<br />
<button type="submit" />Submit</button>
</form>
<h1 style="margin-top: 20px;">Delete Announcement</h1>
<form id="contact" action="/api/announcements/delete" method="POST" target="_blank">
<div class="meta">
<input type="password" name="token" placeholder="Your authentication token" required />
<br />
</div>
<button type="delete" />Delete</button>
</form>
</div>
</body>
</html>
</html>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -22,18 +23,11 @@
</style>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
</head>
<body>
<form
action="/api/form"
method="POST"
>
<form action="/api/form" method="POST">
<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>
<option value="" selected disabled>Select a type of comment</option>
<option value="Feedback">Feedback</option>
@ -42,16 +36,10 @@
<option value="Bug">Bug</option>
</select>
</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>
<input type="submit" value="Submit" />
</form>
</body>
</html>

View File

@ -1,4 +1,5 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -20,8 +21,10 @@
}
</style>
</head>
<body>
<h1>Welcome to Segfautils</h1>
<h3>Running at port {{.Port}} | <a href="https://github.com/ProjectSegfault/segfautils/" target="_blank">GitHub</a></h3>
<h3><a href="/form">Click here for an example form implementation</a></h3>
<h1>Welcome to Segfautils</h1>
<h3>Running at port {{.Port}} | <a href="https://github.com/ProjectSegfault/segfautils/" target="_blank">GitHub</a>
</h3>
<h3><a href="/form">Click here for an example form implementation</a></h3>
</body>