diff --git a/app/dashboard.rb b/app/dashboard.rb index d61a15a8..1c4ea63b 100644 --- a/app/dashboard.rb +++ b/app/dashboard.rb @@ -1,15 +1,5 @@ get '/dashboard' do require_login - - 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 + dashboard_init erb :'dashboard' end \ No newline at end of file diff --git a/app/site_files.rb b/app/site_files.rb index b3b98354..d7ddb439 100644 --- a/app/site_files.rb +++ b/app/site_files.rb @@ -43,6 +43,7 @@ def file_upload_response(error=nil) if params[:from_button] if error @error = error + dashboard_init halt 200, erb(:'dashboard') else query_string = params[:dir] ? "?"+Rack::Utils.build_query(dir: params[:dir]) : '' @@ -69,7 +70,7 @@ post '/site_files/upload' do file_upload_response "#{params[:dir]}/#{file[:filename]} is too large, upload cancelled." end if !current_site.okay_to_upload? file - file_upload_response "#{params[:dir]}/#{file[:filename]}: file type (or content in file) is not allowed on this site, upload cancelled. You can upgrade your account to remove the file type restrictions." + file_upload_response %{#{params[:dir]}#{file[:filename]}: file type (or content in file) is only supported by supporter accounts. Why We Do This} end end diff --git a/app_helpers.rb b/app_helpers.rb index 3ab58ae3..23c95898 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -14,6 +14,19 @@ def dashboard_if_signed_in redirect '/dashboard' if signed_in? 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 halt 'You are not logged in!' unless signed_in? halt 'You are banned.' if current_site.is_banned? || parent_site.is_banned? diff --git a/views/dashboard.erb b/views/dashboard.erb index 3cbe29fa..d12cf9aa 100644 --- a/views/dashboard.erb +++ b/views/dashboard.erb @@ -58,7 +58,7 @@ <% if @error %>
-

<%= @error %>

+

<%== @error %>

<% end %> diff --git a/views/site_files/allowed_types.erb b/views/site_files/allowed_types.erb index d5f7daa8..8d7c0bab 100644 --- a/views/site_files/allowed_types.erb +++ b/views/site_files/allowed_types.erb @@ -37,9 +37,9 @@

Is there a way to remove the whitelist?

- Yes! If you become a supporter at the Cat Bus or higher level, we will remove the whitelist for your file uploads, and you can upload anything you want (except illegal/copyrighted content, of course)! Becoming a supporter reduces the "file dump" risk, which makes it a lot safer for us to allow file uploads of any kind. + Yes! If you become a supporter, we will remove the whitelist for your file uploads, and you can upload anything you want (except illegal/copyrighted content, of course)! Becoming a supporter reduces the "file dump" risk, which makes it a lot safer for us to allow file uploads of any kind.

- Keep in mind that it's still better to host things like videos on Youtube. They've spent a lot of time and invested a lot of money into building a platform for sharing high-bandwidth video very efficiently all over the world, which is not something we have the capital to perfect. And they don't charge you for bandwith, even if your video becomes very popular (infact, you can make money by sharing their advertising revenue with them). + Keep in mind that it's still better to host things like videos on Youtube. They've spent a lot of time and invested a lot of money into building a platform for sharing high-bandwidth video very efficiently all over the world. And they don't charge you for bandwith, even if your video becomes very popular (infact, you can make money by sharing their advertising revenue with them).