This commit is contained in:
Daniele Grandini
2017-02-24 13:49:28 +01:00
parent 643a42aea6
commit 37a11546fa
2 changed files with 2 additions and 32 deletions
-10
View File
@@ -145,9 +145,6 @@ MSG
"If not specified, uses the '<git-repo>/mathjax.config.js' file.") do |file|
wiki_options[:mathjax_config] = file || 'mathjax.config.js'
end
opts.on("--plantuml-url [URL]", "Sets the PlantUML server endpoint.") do |url|
wiki_options[:plantuml_url] = url
end
opts.on("--template-dir [PATH]", "Specify custom mustache template directory.") do |path|
wiki_options[:template_dir] = path
end
@@ -248,13 +245,6 @@ else
require cfg
end
if wiki_options[:plantuml_url]
Gollum::Filter::PlantUML.configure do |config|
puts "Using #{wiki_options[:plantuml_url]} as PlantUML endpoint"
config.url = wiki_options[:plantuml_url]
end
end
base_path = wiki_options[:base_path]
if base_path.nil?
+2 -22
View File
@@ -97,8 +97,7 @@ module Precious
before do
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
@allow_editing = settings.wiki_options[:allow_editing]
forbid unless @allow_editing || request.request_method == "GET"
forbid unless @allow_editing || request.request_method == "GET"
Precious::App.set(:mustache, {:templates => settings.wiki_options[:template_dir]}) if settings.wiki_options[:template_dir]
@base_url = url('/', false).chomp('/')
@page_dir = settings.wiki_options[:page_file_dir].to_s
@@ -157,7 +156,6 @@ module Precious
get '/edit/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
@name = wikip.name
@path = wikip.path
@@ -184,8 +182,6 @@ module Precious
end
post '/uploadFile' do
forbid unless @allow_editing
wiki = wiki_new
unless wiki.allow_uploads
@@ -248,8 +244,6 @@ module Precious
end
post '/rename/*' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
halt 500 if wikip.nil?
wiki = wikip.wiki
@@ -286,8 +280,6 @@ module Precious
end
post '/edit/*' do
forbid unless @allow_editing
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
page_name = CGI.unescape(params[:page])
wiki = wiki_new
@@ -322,12 +314,6 @@ module Precious
get '/create/*' do
forbid unless @allow_editing
if settings.wiki_options[:template_page] then
temppage = wiki_page("/_Template")
@template_page = (temppage.page != nil) ? temppage.page.raw_data : "Template page option is set, but no /_Template page is present or committed."
end
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
@name = wikip.name.to_url
@path = wikip.path
@@ -353,8 +339,6 @@ module Precious
end
post '/create' do
forbid unless @allow_editing
name = params[:page].to_url
path = sanitize_empty_params(params[:path]) || ''
format = params[:format].intern
@@ -374,8 +358,6 @@ module Precious
end
post '/revert/*/:sha1/:sha2' do
forbid unless @allow_editing
wikip = wiki_page(params[:splat].first)
@path = wikip.path
@name = wikip.name
@@ -399,8 +381,6 @@ module Precious
end
post '/preview' do
forbid unless @allow_editing
wiki = wiki_new
@name = params[:page] || "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@@ -604,4 +584,4 @@ module Precious
) : ''
end
end
end
end