mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Remove lib
folder from autoload path
- Load extensions explicitly
This commit is contained in:
parent
9ea5b54f5c
commit
30ac973f96
12 changed files with 25 additions and 25 deletions
|
@ -1,5 +1,4 @@
|
|||
class EppController < ApplicationController
|
||||
include Iptable
|
||||
layout false
|
||||
protect_from_forgery with: :null_session
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
@ -407,4 +406,20 @@ class EppController < ApplicationController
|
|||
timeout = 5.minutes
|
||||
epp_session.updated_at < (Time.zone.now - timeout)
|
||||
end
|
||||
|
||||
def counter_update(registrar_code, ip)
|
||||
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
|
||||
|
||||
begin
|
||||
File.open(counter_proc, 'a') do |f|
|
||||
f.puts "+#{ip}"
|
||||
end
|
||||
rescue Errno::ENOENT => e
|
||||
logger.error "IPTABLES COUNTER UPDATE: cannot open #{counter_proc}: #{e}"
|
||||
rescue Errno::EACCES => e
|
||||
logger.error "IPTABLES COUNTER UPDATE: no permission #{counter_proc}: #{e}"
|
||||
rescue IOError => e
|
||||
logger.error "IPTABLES COUNTER UPDATE: cannot write #{ip} to #{counter_proc}: #{e}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
40
app/models/sorted_country.rb
Normal file
40
app/models/sorted_country.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
class SortedCountry
|
||||
class << self
|
||||
include ActionView::Helpers
|
||||
|
||||
def all_options(selected = nil)
|
||||
quick_options = options_for_select(quick_list, { selected: selected })
|
||||
|
||||
# no double select
|
||||
selected = quick_list.map(&:second).include?(selected) ? '' : selected
|
||||
|
||||
all_options = options_for_select([['---', '---']] + all_sorted_truncated,
|
||||
{ selected: selected, disabled: ['---'] })
|
||||
quick_options + all_options
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def quick_list
|
||||
@quick_list ||=
|
||||
[
|
||||
['Estonia', 'EE'],
|
||||
['Finland', 'FI'],
|
||||
['Latvia', 'LV'],
|
||||
['Lithuania', 'LT'],
|
||||
['Russian Federation', 'RU'],
|
||||
['Sweden', 'SE'],
|
||||
['United States', 'US']
|
||||
]
|
||||
end
|
||||
|
||||
def all_sorted
|
||||
@all_sorted ||= Country.all.sort_by(&:name)
|
||||
end
|
||||
|
||||
def all_sorted_truncated
|
||||
@all_sorted_truncated ||=
|
||||
all_sorted.map { |country| [country.name.truncate(26), country.alpha2] }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue