aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2016-06-16 19:23:18 +0200
committerclsr <clsr@clsr.net>2016-06-16 19:23:18 +0200
commit81d6bc357a7b0d49ba0c5034f77404dc577cf8aa (patch)
tree3dfec8fcfc43643f13fba3fa9d2f6eb36cf67da6 /main.go
parent47415c26e5f3eea368b40de6f6372a21ec54be11 (diff)
downloadgomf-81d6bc357a7b0d49ba0c5034f77404dc577cf8aa.tar.gz
gomf-81d6bc357a7b0d49ba0c5034f77404dc577cf8aa.zip
Add --id-charset and --id-length optionsv0.1.3
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.go b/main.go
index fc51fe2..ad8711c 100644
--- a/main.go
+++ b/main.go
@@ -46,6 +46,9 @@ func main() {
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")
+ idLength := flag.Int("id-length", 6, "length of uploaded file IDs")
+ idCharset := flag.String("id-charset", "", "charset for uploaded file IDs (default lowercase letters a-z)")
+
flag.Parse()
rand.Seed(time.Now().UnixNano())
@@ -53,6 +56,10 @@ func main() {
storage = NewStorage("upload", *maxSize)
storage.ForbiddenExt = strings.Split(*forbidExt, ",")
storage.ForbiddenMime = strings.Split(*forbidMime, ",")
+ storage.IdLength = *idLength
+ if *idCharset != "" {
+ storage.IdCharset = *idCharset
+ }
http.HandleFunc("/upload.php", handleUpload)
http.Handle("/u/", http.StripPrefix("/u/", http.HandlerFunc(handleFile)))