tos and privacy (these are probably shit)

also implemented random paste placeholder text, got bored and dont feel like implementing real features
This commit is contained in:
2026-11-12 23:30:35 -05:00
parent 2c342f63b3
commit 3f78e3b85b
6 changed files with 129 additions and 4 deletions
+1
View File
@@ -26,6 +26,7 @@ import (
type HomePageData struct { type HomePageData struct {
Expiries []Expiry Expiries []Expiry
Qt string Qt string
PastePlaceholder string
} }
func health(w http.ResponseWriter, r *http.Request) { func health(w http.ResponseWriter, r *http.Request) {
+35 -1
View File
@@ -38,6 +38,8 @@ func main() {
"templates/home.html", "templates/home.html",
"templates/header.html", "templates/header.html",
"templates/upload.html", "templates/upload.html",
"templates/tos.html",
"templates/privacy.html",
) )
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
@@ -60,6 +62,21 @@ func main() {
} }
} }
pastePlaceholders, err := os.ReadFile("paste-placeholders.txt")
if err != nil && !errors.Is(err, os.ErrNotExist) {
log.Fatal(err)
}
var placeholders []string
if err == nil {
content := strings.ReplaceAll(string(pastePlaceholders), "\r\n", "\n")
placeholders = strings.Split(strings.TrimSpace(content), "\n")
} else {
placeholders = []string{
"cmon, paste something already!",
}
}
mux := http.NewServeMux() mux := http.NewServeMux()
fs := http.FileServer(http.Dir("static")) fs := http.FileServer(http.Dir("static"))
mux.Handle("GET /css/", fs) mux.Handle("GET /css/", fs)
@@ -75,16 +92,33 @@ func main() {
} }
if len(qts) > 0 { if len(qts) > 0 {
log.Println(len(qts))
data.Qt = qts[rand.IntN(len(qts))] data.Qt = qts[rand.IntN(len(qts))]
} }
if len(placeholders) > 0 {
data.PastePlaceholder = placeholders[rand.IntN(len(placeholders))]
}
w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := pages.ExecuteTemplate(w, "home.html", data); err != nil { if err := pages.ExecuteTemplate(w, "home.html", data); err != nil {
log.Println("render home page:", err) log.Println("render home page:", err)
} }
}) })
mux.HandleFunc("GET /tos", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := pages.ExecuteTemplate(w, "tos.html", nil); err != nil {
log.Println("render terms page:", err)
}
})
mux.HandleFunc("GET /privacy", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := pages.ExecuteTemplate(w, "privacy.html", nil); err != nil {
log.Println("render terms page:", err)
}
})
mux.HandleFunc("GET /{id}", contentHandler(db, config)) mux.HandleFunc("GET /{id}", contentHandler(db, config))
mux.HandleFunc("POST /upload", uploadHandler(db, config, pages)) mux.HandleFunc("POST /upload", uploadHandler(db, config, pages))
mux.HandleFunc("DELETE /{id}", deleteHandler(db, config)) mux.HandleFunc("DELETE /{id}", deleteHandler(db, config))
+4
View File
@@ -25,6 +25,10 @@ body {
background-size: auto 256px; background-size: auto 256px;
} }
b {
font-weight: bold;
}
h1, h1,
h2 { h2 {
margin: 0; margin: 0;
+1 -1
View File
@@ -44,7 +44,7 @@
<option value="{{.Label}}">{{.Label}}</option> <option value="{{.Label}}">{{.Label}}</option>
{{end}} {{end}}
</select> </select>
<textarea id="content" name="content" rows="10" required placeholder="cmon, paste something already!"></textarea> <textarea id="content" name="content" rows="10" required placeholder="{{.PastePlaceholder}}"></textarea>
<button type="submit" class="btn">upload paste</button> <button type="submit" class="btn">upload paste</button>
</form> </form>
</div> </div>
+40
View File
@@ -0,0 +1,40 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>privacy | minibin</title>
<link rel="stylesheet" href="/css/main.css" />
</head>
<body>
{{template "site-header"}}
<main>
<h2>privacy policy</h2>
<h3>what we store</h3>
<p>when you upload a file or paste, we store:</p>
<ul>
<li>the file or paste content</li>
<li>the original filename, type, and size</li>
<li>an upload id and a SHA256 hash of the content</li>
<li>timestamps and the selected expiry</li>
<li>a deletion token</li>
</ul>
<p>
this information is used to serve uploads, check expiry, and allow
deletion of uploads.
</p>
<h3>who can access uploads</h3>
<p>
anyone with the id of an upload can access and share it. minibin's
operator can also access stored uploads. avoid uploading anything
private.
</p>
<h3>changes to this policy</h3>
<p>
this policy may change as minibin changes. updates will be posted on
this page.
</p>
</main>
</body>
</html>
+46
View File
@@ -0,0 +1,46 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>tos | minibin</title>
<link rel="stylesheet" href="/css/main.css" />
</head>
<body>
{{template "site-header"}}
<main>
<h2>terms of service</h2>
<p>by using minibin, you agree to these terms.</p>
<h3>acceptable use</h3>
<p>
you are responsible for what you upload and share. only upload content
that you own or are allowed to share.
</p>
<h3>prohibited content</h3>
<p>do not upload or share:</p>
<ul>
<li>child sexual abuse or exploitation material</li>
<li>malware, viruses, or file intended to harm other people</li>
<li>extreme gore</li>
<li>copyright infringing material</li>
</ul>
<h3>storage and expiry</h3>
<p>
uploads have an expiry based on the option selected when uploading.
indefinite means there is no scheduled expiry.
</p>
<p>
uploads may be removed earlier for breaking these terms, maintenance or
storage limits. ensure you keep a copy of anything important.
</p>
<h3>deleting uploads</h3>
<p>
keep the delete token provided after uploading. anyone with that token
is able to delete the upload, so keep it private.
</p>
<h3>changes to these terms</h3>
<p>these terms may change, updates with be posted on this page.</p>
</main>
</body>
</html>