Make the following fields visible in API responses: * ip_bans.ip_addr * ip_geolocations.ip_addr * ip_geolocations.network * users.last_ip_addr (mod only) * user_sessions.ip_addr * api_keys.last_ip_address * api_keys.permitted_ip_addresses Before IP addresses were globally hidden in API responses because IPs were present in a lot of tables and we didn't want to accidentally leak them. Now that we've gotten rid of IPs from most tables, it's safe to unhide them.
55 lines
2.6 KiB
Plaintext
55 lines
2.6 KiB
Plaintext
<div id="c-ip-bans">
|
|
<div id="a-index">
|
|
<h1>IP Bans</h1>
|
|
|
|
<%= search_form_for(ip_bans_path) do |f| %>
|
|
<%= f.input :ip_addr, label: "IP Addr", hint: "Use /24 for subnet", input_html: { value: params[:search][:ip_addr] } %>
|
|
<%= f.input :reason, input_html: { value: params[:search][:reason] } %>
|
|
<%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], "data-autocomplete": "user" } %>
|
|
<%= f.input :category, collection: IpBan.categories, include_blank: true, selected: params[:search][:category] %>
|
|
<%= f.input :is_deleted, label: "Status", collection: [["Active", "false"], ["Deleted", "true"]], include_blank: true, selected: params[:search][:is_deleted] %>
|
|
<%= f.input :order, collection: [%w[Newest created_at], %w[Oldest created_at_asc], %w[Last\ Seen last_hit_at]], include_blank: true, selected: params[:search][:order] %>
|
|
<%= f.submit "Search" %>
|
|
<% end %>
|
|
|
|
<%= table_for @ip_bans, class: "striped autofit", width: "100%" do |t| %>
|
|
<% t.column "IP Address" do |ip_ban| %>
|
|
<%= link_to ip_ban.ip_addr, ip_address_path(ip_ban.ip_addr.to_s) %>
|
|
<% end %>
|
|
<% t.column "Reason", td: { class: "col-expand" } do |ban| %>
|
|
<div class="prose">
|
|
<%= format_text ban.reason %>
|
|
</div>
|
|
<% end %>
|
|
<% t.column "Status" do |ip_ban| %>
|
|
<% if ip_ban.is_deleted? %>
|
|
Deleted
|
|
<% end %>
|
|
<% end %>
|
|
<% t.column "Type" do |ip_ban| %>
|
|
<%= ip_ban.category.delete_suffix("_ban").capitalize %>
|
|
<% end %>
|
|
<% t.column "Last Seen" do |ip_ban| %>
|
|
<%= time_ago_in_words_tagged ip_ban.last_hit_at %>
|
|
<% end %>
|
|
<% t.column :hit_count, name: "Hits" %>
|
|
<% t.column "Creator" do |ip_ban| %>
|
|
<%= link_to_user ip_ban.creator %>
|
|
<%= link_to "»", ip_bans_path(search: { creator_name: ip_ban.creator.name }) %>
|
|
<div><%= time_ago_in_words_tagged(ip_ban.created_at) %></div>
|
|
<% end %>
|
|
<% t.column column: "control" do |ip_ban| %>
|
|
<% if ip_ban.is_deleted? %>
|
|
<%= link_to "Undelete", ip_ban_path(ip_ban), remote: true, method: :put, "data-params": "ip_ban[is_deleted]=false", "data-confirm": "Are you sure you want to undelete this IP ban?" %>
|
|
<% else %>
|
|
<%= link_to "Delete", ip_ban_path(ip_ban), remote: true, method: :put, "data-params": "ip_ban[is_deleted]=true", "data-confirm": "Are you sure you want to remove this IP ban?" %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<%= numbered_paginator(@ip_bans) %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= render "secondary_links" %>
|