mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Add helper for webalizer stats
This commit is contained in:
parent
31afc3f364
commit
9395b268be
1 changed files with 18 additions and 1 deletions
19
app.rb
19
app.rb
|
@ -6,8 +6,9 @@ use Rack::Session::Cookie, key: 'neocities',
|
|||
secret: $config['session_secret']
|
||||
|
||||
get %r{.+} do
|
||||
pass if request.host == '127.0.0.1'
|
||||
subname = request.host.match /[\w-]+/
|
||||
pass if subname.nil?
|
||||
pass if subname.nil?
|
||||
subname = subname.to_s
|
||||
pass if subname == 'www' || subname == 'neocities' || subname == 'testneocities'
|
||||
|
||||
|
@ -90,6 +91,22 @@ 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
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue