rebasing
This commit is contained in:
-10
@@ -145,9 +145,6 @@ MSG
|
|||||||
"If not specified, uses the '<git-repo>/mathjax.config.js' file.") do |file|
|
"If not specified, uses the '<git-repo>/mathjax.config.js' file.") do |file|
|
||||||
wiki_options[:mathjax_config] = file || 'mathjax.config.js'
|
wiki_options[:mathjax_config] = file || 'mathjax.config.js'
|
||||||
end
|
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|
|
opts.on("--template-dir [PATH]", "Specify custom mustache template directory.") do |path|
|
||||||
wiki_options[:template_dir] = path
|
wiki_options[:template_dir] = path
|
||||||
end
|
end
|
||||||
@@ -248,13 +245,6 @@ else
|
|||||||
require cfg
|
require cfg
|
||||||
end
|
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]
|
base_path = wiki_options[:base_path]
|
||||||
|
|
||||||
if base_path.nil?
|
if base_path.nil?
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ module Precious
|
|||||||
before do
|
before do
|
||||||
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
|
settings.wiki_options[:allow_editing] = settings.wiki_options.fetch(:allow_editing, true)
|
||||||
@allow_editing = settings.wiki_options[:allow_editing]
|
@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]
|
Precious::App.set(:mustache, {:templates => settings.wiki_options[:template_dir]}) if settings.wiki_options[:template_dir]
|
||||||
@base_url = url('/', false).chomp('/')
|
@base_url = url('/', false).chomp('/')
|
||||||
@@ -157,7 +156,6 @@ module Precious
|
|||||||
|
|
||||||
get '/edit/*' do
|
get '/edit/*' do
|
||||||
forbid unless @allow_editing
|
forbid unless @allow_editing
|
||||||
|
|
||||||
wikip = wiki_page(params[:splat].first)
|
wikip = wiki_page(params[:splat].first)
|
||||||
@name = wikip.name
|
@name = wikip.name
|
||||||
@path = wikip.path
|
@path = wikip.path
|
||||||
@@ -184,8 +182,6 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/uploadFile' do
|
post '/uploadFile' do
|
||||||
forbid unless @allow_editing
|
|
||||||
|
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
|
|
||||||
unless wiki.allow_uploads
|
unless wiki.allow_uploads
|
||||||
@@ -248,8 +244,6 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/rename/*' do
|
post '/rename/*' do
|
||||||
forbid unless @allow_editing
|
|
||||||
|
|
||||||
wikip = wiki_page(params[:splat].first)
|
wikip = wiki_page(params[:splat].first)
|
||||||
halt 500 if wikip.nil?
|
halt 500 if wikip.nil?
|
||||||
wiki = wikip.wiki
|
wiki = wikip.wiki
|
||||||
@@ -286,8 +280,6 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/edit/*' do
|
post '/edit/*' do
|
||||||
forbid unless @allow_editing
|
|
||||||
|
|
||||||
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
||||||
page_name = CGI.unescape(params[:page])
|
page_name = CGI.unescape(params[:page])
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
@@ -322,12 +314,6 @@ module Precious
|
|||||||
|
|
||||||
get '/create/*' do
|
get '/create/*' do
|
||||||
forbid unless @allow_editing
|
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('+', '-'))
|
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
|
||||||
@name = wikip.name.to_url
|
@name = wikip.name.to_url
|
||||||
@path = wikip.path
|
@path = wikip.path
|
||||||
@@ -353,8 +339,6 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/create' do
|
post '/create' do
|
||||||
forbid unless @allow_editing
|
|
||||||
|
|
||||||
name = params[:page].to_url
|
name = params[:page].to_url
|
||||||
path = sanitize_empty_params(params[:path]) || ''
|
path = sanitize_empty_params(params[:path]) || ''
|
||||||
format = params[:format].intern
|
format = params[:format].intern
|
||||||
@@ -374,8 +358,6 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/revert/*/:sha1/:sha2' do
|
post '/revert/*/:sha1/:sha2' do
|
||||||
forbid unless @allow_editing
|
|
||||||
|
|
||||||
wikip = wiki_page(params[:splat].first)
|
wikip = wiki_page(params[:splat].first)
|
||||||
@path = wikip.path
|
@path = wikip.path
|
||||||
@name = wikip.name
|
@name = wikip.name
|
||||||
@@ -399,8 +381,6 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
post '/preview' do
|
post '/preview' do
|
||||||
forbid unless @allow_editing
|
|
||||||
|
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
@name = params[:page] || "Preview"
|
@name = params[:page] || "Preview"
|
||||||
@page = wiki.preview_page(@name, params[:content], params[:format])
|
@page = wiki.preview_page(@name, params[:content], params[:format])
|
||||||
|
|||||||
Reference in New Issue
Block a user