Files
danbooru/app/views/ip_addresses/_info.html.erb
evazion b2ee1f0766 ip bans: add hit counter, deleted flag, new ban type.
* Make IP bans soft deletable.
* Add a hit counter to track how many times an IP ban has blocked someone.
* Add a last hit timestamp to track when the IP ban last blocked someone.
* Add a new type of IP ban, the signup ban. Signup bans restrict new
  signups from editing anything until they've verified their email
  address.
2020-04-06 14:13:22 -05:00

76 lines
2.1 KiB
Plaintext

<div class="ip-address-details">
<table class="aligned-vertical">
<tr>
<th>Location</th>
<td>
<% if ip_info.dig(:location, :city) %>
<%= ip_info.dig(:location, :city) %>,
<% end %>
<% if ip_info.dig(:location, :region, :name).present? %>
<%= ip_info.dig(:location, :region, :name) %>,
<% end %>
<%= ip_info.dig(:location, :country, :name) %>
</td>
</tr>
<tr>
<th>Network</th>
<td>
<%= link_to ip_info.dig(:connection, :route), ip_addresses_path(search: { ip_addr: ip_info.dig(:connection, :route) }) %>
(<%= link_to "info", "https://ipinfo.io/AS#{ip_info.dig(:connection, :asn)}/#{ip_info.dig(:connection, :route)}" %>)
</td>
</tr>
<tr>
<th>Proxy</th>
<td><%= ip_address.lookup.is_proxy? ? "yes" : "no" %></td>
</tr>
<tr>
<th>IP Banned</th>
<td>
<% if IpBan.ip_matches(ip_address.ip_addr.to_s).exists? %>
yes (<%= link_to "info", ip_bans_path(search: { ip_addr: ip_address.to_s }) %>)
<% else %>
no
<% end %>
</td>
</tr>
<tr>
<th>Type</th>
<td><%= ip_info.dig(:connection, :type) %></td>
</tr>
<tr>
<th>ASN</th>
<td>
<%= link_to "AS#{ip_info.dig(:connection, :asn)}", "https://ipinfo.io/AS#{ip_info.dig(:connection, :asn)}" %>
</td>
</tr>
<tr>
<th>Organization</th>
<td>
<%= ip_info.dig(:connection, :organization) %>
</td>
</tr>
<% if ip_info.dig(:carrier, :name).present? %>
<tr>
<th>Mobile Carrier</th>
<td><%= ip_info.dig(:carrier, :name) %></td>
</tr>
<% end %>
<tr>
<th>Website</th>
<td><%= external_link_to("http://#{ip_info.dig(:connection, :domain)}") %></td>
</tr>
<tr>
<th>Details</th>
<td>
<details>
<pre><%= JSON.pretty_generate(ip_info) %></pre>
</details>
</td>
</tr>
</table>
</div>
<div class="ip-address-map">
<%= embedded_google_map("#{ip_info.dig(:location, :latitude)},#{ip_info.dig(:location, :longitude)}", 300, 200) %>
</div>