Add file upload functionality

Adds an :allow_uploads wiki option, an --allow-uploads flag to
bin/gollum, an "Upload" button with a file upload dialog, and a
handler to commit uploaded files into the repository.

:allow_uploads defaults to false, to prevent unauthenticated users
from uploading arbitrary files into the repository (albeit only in
the uploads directory).

This code is based on the patch from @l3iggs at
https://github.com/gollum/gollum/issues/694, but the handling on the
backend is completely rewritten to use the Committer infrastructure.
This commit is contained in:
Abhijit Menon-Sen
2013-07-15 16:38:47 +05:30
parent 4627a39165
commit 183840b793
6 changed files with 108 additions and 2 deletions
+8 -1
View File
@@ -19,7 +19,10 @@ require 'gollum'
exec = {}
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
wiki_options = { :live_preview => false }
wiki_options = {
:live_preview => false,
:allow_uploads => false,
}
opts = OptionParser.new do |opts|
opts.banner = help
@@ -77,6 +80,10 @@ opts = OptionParser.new do |opts|
wiki_options[:live_preview] = true
end
opts.on("--allow-uploads", "Allows file uploads.") do
wiki_options[:allow_uploads] = true
end
opts.on("--mathjax", "Enables mathjax.") do
wiki_options[:mathjax] = true
end