mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
a start on improving reporting
This commit is contained in:
parent
bb44965c8e
commit
a7ee94b0c7
5 changed files with 61 additions and 14 deletions
|
@ -212,7 +212,7 @@ GEM
|
|||
sinatra (>= 1.0.0)
|
||||
sinatra-xsendfile (0.4.2)
|
||||
sinatra (>= 0.9.1)
|
||||
slop (3.5.0)
|
||||
slop (3.6.0)
|
||||
storable (0.8.9)
|
||||
stripe (1.15.0)
|
||||
json (~> 1.8.1)
|
||||
|
|
|
@ -5,6 +5,12 @@ get '/admin' do
|
|||
erb :'admin'
|
||||
end
|
||||
|
||||
get '/admin/reports' do
|
||||
require_admin
|
||||
@reports = Report.order(:created_at.desc).all
|
||||
erb :'admin/reports'
|
||||
end
|
||||
|
||||
get '/admin/email' do
|
||||
require_admin
|
||||
erb :'admin/email'
|
||||
|
|
|
@ -53,26 +53,16 @@ def parent_site
|
|||
end
|
||||
|
||||
def require_unbanned_ip
|
||||
if session[:banned] || Site.banned_ip?(request.ip)
|
||||
if session[:banned] || (is_banned_ip = Site.banned_ip?(request.ip))
|
||||
signout
|
||||
session[:banned] = request.ip if !session[:banned]
|
||||
send_banned_report
|
||||
flash[:error] = 'Site creation has been banned due to a Terms of Service violation. '+
|
||||
|
||||
flash[:error] = 'Site creation has been banned due to a Terms of Service violation from your location. '+
|
||||
'If you believe this to be in error, <a href="/contact">contact the site admin</a>.'
|
||||
return {result: 'error'}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def send_banned_report
|
||||
EmailWorker.perform_async({
|
||||
from: 'web@neocities.org',
|
||||
reply_to: 'contact@neocities.org',
|
||||
to: 'errors@neocities.org',
|
||||
subject: "[Neocities] Ban report",
|
||||
body: "IP: #{request.ip}\n\nSession: #{session.inspect}\n\nParams:#{params}"
|
||||
})
|
||||
end
|
||||
|
||||
def title
|
||||
out = "Neocities"
|
||||
return out if request.path == '/'
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
<div class="content misc-page single-Col txt-Center" style="padding-top: 20px;">
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-100">
|
||||
<a href="/admin/reports">Site Reports</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if flash.keys.length > 0 %>
|
||||
<div class="alert alert-error alert-block">
|
||||
<% flash.keys.each do |key| %>
|
||||
|
|
45
views/admin/reports.erb
Normal file
45
views/admin/reports.erb
Normal file
|
@ -0,0 +1,45 @@
|
|||
<div class="header-Outro">
|
||||
<div class="row content single-Col">
|
||||
<h1>Site Reports</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content" style="background: white">
|
||||
<form method="POST" action="/admin/report">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Site</th>
|
||||
<th>Type</th>
|
||||
<th>Comments</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<% @reports.each do |report| %>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<%= report.site.uri %>"><%= report.site.title %></a>
|
||||
<br>
|
||||
<img src="<%= report.site.screenshot_url('/index.html', '540x405') %>">
|
||||
<br>
|
||||
Reported <%= report.created_at.ago %>
|
||||
<% if report.reporting_site %>
|
||||
by <a href="<%= report.reporting_site.uri %>"><%= report.reporting_site.username %></a>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= report.type %></td>
|
||||
<td><%= report.comments[0...100] %></td>
|
||||
<td>
|
||||
<select name="sites[<%= report.site_id %>]">
|
||||
<option value="">No Action</option>
|
||||
<option value="ban">Ban Site</option>
|
||||
<option value="nsfw">Mark NSFW</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<input type="submit" value="Perform Actions" class="btn">
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
Loading…
Add table
Reference in a new issue