mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
remove unused code
This commit is contained in:
parent
adab70e619
commit
e463968ec5
1 changed files with 0 additions and 37 deletions
37
app.rb
37
app.rb
|
@ -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']
|
use Rack::Recaptcha, public_key: $config['recaptcha_public_key'], private_key: $config['recaptcha_private_key']
|
||||||
helpers Rack::Recaptcha::Helpers
|
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
|
get '/?' do
|
||||||
dashboard_if_signed_in
|
dashboard_if_signed_in
|
||||||
slim :index
|
slim :index
|
||||||
|
@ -108,15 +87,6 @@ get '/signout' do
|
||||||
redirect '/'
|
redirect '/'
|
||||||
end
|
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
|
get '/site_files/new' do
|
||||||
require_login
|
require_login
|
||||||
slim :'site_files/new'
|
slim :'site_files/new'
|
||||||
|
@ -239,13 +209,6 @@ before do
|
||||||
redirect '/' if request.post? && !csrf_safe?
|
redirect '/' if request.post? && !csrf_safe?
|
||||||
end
|
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
|
def dashboard_if_signed_in
|
||||||
redirect '/dashboard' if signed_in?
|
redirect '/dashboard' if signed_in?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue