all repos — fsrv @ d050de4e1388e5b85a95702a9a26d8787c715729

filehost server for x.icyphox.sh

Implement secret key check
Anirudh Oppiliappan x@icyphox.sh
Sun, 06 Jun 2021 22:55:24 +0530
commit

d050de4e1388e5b85a95702a9a26d8787c715729

parent

8945f5c8af583e39abfd7c5f1922ee005b01aa71

1 files changed, 7 insertions(+), 0 deletions(-)

jump to
M main.gomain.go

@@ -30,6 +30,13 @@ return string(b)

} func (s *settings) uploadFile(w http.ResponseWriter, r *http.Request) { + key := r.FormValue("key") + fmt.Println(key) + if key != s.key { + fmt.Fprintf(w, "incorrect key") + log.Printf("incorrect key: %+v", key) + return + } r.ParseMultipartForm(10 << 20) file, handler, err := r.FormFile("file") if err != nil {