From 4aef18eb36307f28c4f1c3b2c432468ab0ede4fb Mon Sep 17 00:00:00 2001 From: clsr Date: Thu, 16 Jun 2016 03:20:46 +0200 Subject: Add grill toggle flag --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index fb8810f..fc51fe2 100644 --- a/main.go +++ b/main.go @@ -45,6 +45,7 @@ func main() { maxSize := flag.Int64("max-size", 50*1024*1024, "max filesize in bytes") forbidMime := flag.String("forbid-mime", "application/x-dosexec,application/x-msdos-program", "comma-separated list of forbidden MIME types") forbidExt := flag.String("forbid-ext", "exe,dll,msi,scr,com,pif", "comma-separated list of forbidden file extensions") + grill := flag.Bool("grill", false, "enable grills") flag.Parse() rand.Seed(time.Now().UnixNano()) @@ -54,8 +55,10 @@ func main() { storage.ForbiddenMime = strings.Split(*forbidMime, ",") http.HandleFunc("/upload.php", handleUpload) - http.HandleFunc("/grill.php", handleGrill) http.Handle("/u/", http.StripPrefix("/u/", http.HandlerFunc(handleFile))) + if *grill { + http.HandleFunc("/grill.php", handleGrill) + } initWebsite() -- cgit