remove unused code

This commit is contained in:
Kyle Drake 2013-06-22 19:50:47 -07:00
parent adab70e619
commit e463968ec5

37
app.rb
View file

@ -8,27 +8,6 @@ use Rack::Session::Cookie, key: 'neocities',
use Rack::Recaptcha, public_key: $config['recaptcha_public_key'], private_key: $config['recaptcha_private_key']
helpers Rack::Recaptcha::Helpers
get %r{.+} do
pass if request.host == '127.0.0.1'
subname = request.host.match /[\w-]+/
pass if subname.nil?
subname = subname.to_s
pass if subname == 'www' || subname == 'neocities' || subname == 'testneocities'
base_path = site_base_path subname
path = File.join(base_path, (request.path =~ /\/$/ ? (request.path + 'index.html') : request.path))
cache_control :public, max_age: 10
if File.exist?(path)
send_file path
else
send_file File.join(base_path, 'not_found.html')
end
send_file path
end
get '/?' do
dashboard_if_signed_in
slim :index
@ -108,15 +87,6 @@ get '/signout' do
redirect '/'
end
# Helper routes to get webalizer stats working, not used by anything important
get '/sites/:name/?' do
sites_name_redirect
end
get '/sites/:name/:file' do
sites_name_redirect
end
get '/site_files/new' do
require_login
slim :'site_files/new'
@ -239,13 +209,6 @@ before do
redirect '/' if request.post? && !csrf_safe?
end
def sites_name_redirect
path = request.path.gsub "/sites/#{params[:name]}", ''
# path += "/#{params[:file]}" unless params[:file].nil?
redirect "http://#{params[:name]}.neocities.org#{path}"
end
def dashboard_if_signed_in
redirect '/dashboard' if signed_in?
end