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 --- USAGE | 4 ++++ main.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/USAGE b/USAGE index af6766b..cffaf48 100644 --- a/USAGE +++ b/USAGE @@ -79,3 +79,7 @@ Running --upload-url URL uses URL as the prefix for address of uploaded files example: --upload-url http://u.example.com/ + + --grill + enables grills + example: --grill 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