diff --git a/router/upload.go b/router/upload.go index 2e7f89a5..9557ab8e 100644 --- a/router/upload.go +++ b/router/upload.go @@ -28,6 +28,7 @@ type UploadForm struct { Name string Magnet string Category string + Remake bool Description string captcha.Captcha @@ -40,19 +41,12 @@ type UploadForm struct { // TODO: these should be in another package (?) -// form value for torrent name +// form names const UploadFormName = "name" - -// form value for torrent file const UploadFormTorrent = "torrent" - -// form value for magnet uri (?) const UploadFormMagnet = "magnet" - -// form value for category const UploadFormCategory = "c" - -// form value for description +const UploadFormRemake = "remake" const UploadFormDescription = "desc" // error indicating that you can't send both a magnet link and torrent @@ -84,6 +78,7 @@ func (f *UploadForm) ExtractInfo(r *http.Request) error { f.Category = r.FormValue(UploadFormCategory) f.Description = r.FormValue(UploadFormDescription) f.Magnet = r.FormValue(UploadFormMagnet) + f.Remake = r.FormValue(UploadFormRemake) == "on" f.Captcha = captcha.Extract(r) if !captcha.Authenticate(f.Captcha) { diff --git a/router/uploadHandler.go b/router/uploadHandler.go index 8cb87e7c..5d964dd7 100644 --- a/router/uploadHandler.go +++ b/router/uploadHandler.go @@ -34,7 +34,9 @@ func UploadHandler(w http.ResponseWriter, r *http.Request) { fmt.Printf("error %+v\n", err) } status := 1 // normal - if user.Status == 1 { + if uploadForm.Remake { // overrides trusted + status = 2 + } else if user.Status == 1 { status = 3 // mark as trusted if user is trusted } //add to db and redirect depending on result diff --git a/templates/upload.html b/templates/upload.html index 17ddf7e2..1054c38f 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -40,7 +40,10 @@ - + +