mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fixes for not found page and ip banner
This commit is contained in:
parent
ead6e41897
commit
b06704f669
2 changed files with 25 additions and 27 deletions
9
app.rb
9
app.rb
|
@ -390,15 +390,14 @@ get '/admin' do
|
|||
end
|
||||
|
||||
def ban_site(username)
|
||||
site = Site[username: params[:username]]
|
||||
|
||||
site = Site[username: username]
|
||||
return false if site.nil?
|
||||
return false if site.is_banned
|
||||
return false if site.is_banned == true
|
||||
|
||||
DB.transaction {
|
||||
FileUtils.mv site_base_path(site.username), File.join(settings.public_folder, 'banned_sites', site.username)
|
||||
site.is_banned = true
|
||||
site.save validate: false
|
||||
site.save(validate: false)
|
||||
}
|
||||
|
||||
if !['127.0.0.1', nil, ''].include? site.ip
|
||||
|
@ -423,7 +422,7 @@ post '/admin/banip' do
|
|||
end
|
||||
|
||||
sites = Site.filter(ip: site.ip).all
|
||||
sites.each {|site| ban_site site.username}
|
||||
sites.each {|s| ban_site(s.username)}
|
||||
flash[:error] = "#{sites.length} sites have been banned."
|
||||
redirect '/admin'
|
||||
end
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
|
||||
p It you believe this to be in error, please <a href="/contact" title="get in touch with us">contact us</a> and report the problem. Thank you!
|
||||
- if request.referer
|
||||
|
||||
a class="btn-Action" href="#{request.referer}" Go Back
|
||||
a class="btn-Action" href="#{request.referer}" Go Back
|
||||
|
|
Loading…
Add table
Reference in a new issue