mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
fixes for missing site dir on dashboard
This commit is contained in:
parent
96b8453ae8
commit
b7fe2ab8ee
2 changed files with 20 additions and 13 deletions
|
@ -3,3 +3,23 @@ get '/dashboard' do
|
||||||
dashboard_init
|
dashboard_init
|
||||||
erb :'dashboard'
|
erb :'dashboard'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dashboard_init
|
||||||
|
if params[:dir] && params[:dir][0] != '/'
|
||||||
|
params[:dir] = '/'+params[:dir]
|
||||||
|
end
|
||||||
|
|
||||||
|
if !File.directory?(current_site.files_path(params[:dir]))
|
||||||
|
if !File.directory?(current_site.files_path)
|
||||||
|
flash[:error] = 'Could not find your web site, please contact support.'
|
||||||
|
session[:id] = nil
|
||||||
|
redirect '/'
|
||||||
|
else
|
||||||
|
flash[:error] = 'Could not find the requested directory.'
|
||||||
|
redirect '/dashboard'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@dir = params[:dir]
|
||||||
|
@file_list = current_site.file_list @dir
|
||||||
|
end
|
|
@ -14,19 +14,6 @@ def dashboard_if_signed_in
|
||||||
redirect '/dashboard' if signed_in?
|
redirect '/dashboard' if signed_in?
|
||||||
end
|
end
|
||||||
|
|
||||||
def dashboard_init
|
|
||||||
if params[:dir] && params[:dir][0] != '/'
|
|
||||||
params[:dir] = '/'+params[:dir]
|
|
||||||
end
|
|
||||||
|
|
||||||
if !File.directory?(current_site.files_path(params[:dir]))
|
|
||||||
redirect '/dashboard'
|
|
||||||
end
|
|
||||||
|
|
||||||
@dir = params[:dir]
|
|
||||||
@file_list = current_site.file_list @dir
|
|
||||||
end
|
|
||||||
|
|
||||||
def require_login_ajax
|
def require_login_ajax
|
||||||
halt 'You are not logged in!' unless signed_in?
|
halt 'You are not logged in!' unless signed_in?
|
||||||
halt 'You are banned.' if current_site.is_banned? || parent_site.is_banned?
|
halt 'You are banned.' if current_site.is_banned? || parent_site.is_banned?
|
||||||
|
|
Loading…
Add table
Reference in a new issue