mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
fix for site banner
This commit is contained in:
parent
6116e90e62
commit
4bfaa32431
4 changed files with 36 additions and 1 deletions
|
@ -62,7 +62,7 @@ post '/admin/banip' do
|
||||||
flash[:error] = 'IP is blank, cannot continue'
|
flash[:error] = 'IP is blank, cannot continue'
|
||||||
redirect '/admin'
|
redirect '/admin'
|
||||||
end
|
end
|
||||||
sites = Site.filter(ip: Site.hash_ip(site.ip), is_banned: false).all
|
sites = Site.filter(ip: site.ip, is_banned: false).all
|
||||||
sites.each {|s| s.ban!}
|
sites.each {|s| s.ban!}
|
||||||
flash[:error] = "#{sites.length} sites have been banned."
|
flash[:error] = "#{sites.length} sites have been banned."
|
||||||
redirect '/admin'
|
redirect '/admin'
|
||||||
|
|
4
app/search.rb
Normal file
4
app/search.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
get '/search' do
|
||||||
|
erb :'search'
|
||||||
|
end
|
|
@ -7,6 +7,9 @@
|
||||||
<a href="/browse">Websites</a>
|
<a href="/browse">Websites</a>
|
||||||
</li>
|
</li>
|
||||||
<% unless is_education? %>
|
<% unless is_education? %>
|
||||||
|
<li>
|
||||||
|
<a href="/search">Search</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/activity">Activity</a>
|
<a href="/activity">Activity</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
28
views/search.erb
Normal file
28
views/search.erb
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<div class="header-Outro">
|
||||||
|
<div class="row content single-Col txt-Center">
|
||||||
|
<h1>Search Neocities Sites</h1>
|
||||||
|
<h3 class="subtitle"></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content txt-Center single-Col misc-page">
|
||||||
|
<form id="searchForm" method="GET" action="https://duckduckgo.com" class="content" onsubmit="return addSiteToSearch()">
|
||||||
|
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
|
||||||
|
<fieldset>
|
||||||
|
<input id="searchQuery" name="q" type="text" placeholder="keywords" class="input-Area" autocapitalize="off" autocorrect="off" value="<%= flash[:username] %>" style="width: 290px">
|
||||||
|
</fieldset>
|
||||||
|
<input class="btn-Action" type="submit" value="Search">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p>Search powered by <a href="https://duckduckgo.com">DuckDuckGo</a>, a search engine that cares about your privacy as much as we do.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function addSiteToSearch() {
|
||||||
|
var searchQuery = $('#searchQuery')
|
||||||
|
var finalSearchQuery = searchQuery.val() + ' site:neocities.org'
|
||||||
|
|
||||||
|
window.location = 'https://duckduckgo.com/?q='+encodeURI(finalSearchQuery)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Add table
Reference in a new issue