From 3f78e3b85b3bc3aac677d10dbd5e6efdade42e9b Mon Sep 17 00:00:00 2001 From: whoswhip Date: Thu, 12 Nov 2026 23:30:35 -0500 Subject: [PATCH] tos and privacy (these are probably shit) also implemented random paste placeholder text, got bored and dont feel like implementing real features --- handlers.go | 5 +++-- main.go | 36 ++++++++++++++++++++++++++++++++- static/css/main.css | 4 ++++ templates/home.html | 2 +- templates/privacy.html | 40 ++++++++++++++++++++++++++++++++++++ templates/tos.html | 46 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 templates/privacy.html create mode 100644 templates/tos.html diff --git a/handlers.go b/handlers.go index 7f433bb..f4556ab 100644 --- a/handlers.go +++ b/handlers.go @@ -24,8 +24,9 @@ import ( ) type HomePageData struct { - Expiries []Expiry - Qt string + Expiries []Expiry + Qt string + PastePlaceholder string } func health(w http.ResponseWriter, r *http.Request) { diff --git a/main.go b/main.go index a94eb49..f63a9f1 100644 --- a/main.go +++ b/main.go @@ -38,6 +38,8 @@ func main() { "templates/home.html", "templates/header.html", "templates/upload.html", + "templates/tos.html", + "templates/privacy.html", ) if err != nil { 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() fs := http.FileServer(http.Dir("static")) mux.Handle("GET /css/", fs) @@ -75,16 +92,33 @@ func main() { } if len(qts) > 0 { - log.Println(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") if err := pages.ExecuteTemplate(w, "home.html", data); err != nil { 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("POST /upload", uploadHandler(db, config, pages)) mux.HandleFunc("DELETE /{id}", deleteHandler(db, config)) diff --git a/static/css/main.css b/static/css/main.css index df2c466..486fe19 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -25,6 +25,10 @@ body { background-size: auto 256px; } +b { + font-weight: bold; +} + h1, h2 { margin: 0; diff --git a/templates/home.html b/templates/home.html index 9527c82..93d5e67 100644 --- a/templates/home.html +++ b/templates/home.html @@ -44,7 +44,7 @@ {{end}} - + diff --git a/templates/privacy.html b/templates/privacy.html new file mode 100644 index 0000000..6e66e1c --- /dev/null +++ b/templates/privacy.html @@ -0,0 +1,40 @@ + + + + + + privacy | minibin + + + + {{template "site-header"}} +
+

privacy policy

+

what we store

+

when you upload a file or paste, we store:

+ +

+ this information is used to serve uploads, check expiry, and allow + deletion of uploads. +

+ +

who can access uploads

+

+ anyone with the id of an upload can access and share it. minibin's + operator can also access stored uploads. avoid uploading anything + private. +

+

changes to this policy

+

+ this policy may change as minibin changes. updates will be posted on + this page. +

+
+ + diff --git a/templates/tos.html b/templates/tos.html new file mode 100644 index 0000000..bf9ca57 --- /dev/null +++ b/templates/tos.html @@ -0,0 +1,46 @@ + + + + + + tos | minibin + + + + {{template "site-header"}} +
+

terms of service

+

by using minibin, you agree to these terms.

+

acceptable use

+

+ you are responsible for what you upload and share. only upload content + that you own or are allowed to share. +

+

prohibited content

+

do not upload or share:

+ +

storage and expiry

+

+ uploads have an expiry based on the option selected when uploading. + indefinite means there is no scheduled expiry. +

+

+ uploads may be removed earlier for breaking these terms, maintenance or + storage limits. ensure you keep a copy of anything important. +

+ +

deleting uploads

+

+ keep the delete token provided after uploading. anyone with that token + is able to delete the upload, so keep it private. +

+

changes to these terms

+

these terms may change, updates with be posted on this page.

+
+ +