diff --git a/lib/api.rb b/lib/api.rb index 3d7701a..628498c 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -1,19 +1,11 @@ class W3DHub class Api - # Detect CA bundle path for Excon - def self.ca_bundle_path - redhat_path = '/etc/pki/tls/certs/ca-bundle.crt' - debian_path = '/etc/ssl/certs/ca-certificates.crt' - [redhat_path, debian_path].find { |path| File.exist?(path) } - end - # Set Excon default CA file if found - ca_file = ca_bundle_path - if ca_file + if (ca_file = W3DHub.ca_bundle_path) Excon.defaults[:ssl_ca_file] = ca_file end - + LOG_TAG = "W3DHub::Api".freeze API_TIMEOUT = 30 # seconds @@ -295,7 +287,7 @@ class W3DHub end # If channel versions and access levels match then all's well - if channel.current_version == _channel.current_version && + if channel.current_version == _channel.current_version && channel.user_level == _channel.user_level # All's Well! @@ -310,7 +302,7 @@ class W3DHub # Replaced, continue. next end - + # If versions doen't match then pick whichever one is higher if Gem::Version.new(channel.current_version) > Gem::Version.new(_channel.current_version) # Replace alternate's channel with primary's channel diff --git a/lib/asterisk/irc_client.rb b/lib/asterisk/irc_client.rb index 0c7541a..1732ab3 100644 --- a/lib/asterisk/irc_client.rb +++ b/lib/asterisk/irc_client.rb @@ -10,15 +10,6 @@ class W3DHub TAG = "IRCClient" class SSL - # Detect system CA bundle path for SSL verification - def self.ca_bundle_path - [ - '/etc/ssl/certs/ca-certificates.crt', # Debian/Ubuntu - '/etc/pki/tls/certs/ca-bundle.crt', # RHEL/Fedora/CentOS - '/etc/ssl/ca-bundle.pem' # Some other distros - ].find { |path| File.exist?(path) } - end - def self.default_context verify_peer_and_hostname end @@ -33,8 +24,7 @@ class W3DHub no_verify.tap do |context| context.verify_mode = OpenSSL::SSL::VERIFY_PEER context.cert_store = OpenSSL::X509::Store.new - ca_file = ca_bundle_path - if ca_file + if (ca_file = W3DHub.ca_bundle_path) context.cert_store.add_file(ca_file) else context.cert_store.set_default_paths diff --git a/lib/common.rb b/lib/common.rb index 6f028ac..9b3a2dc 100644 --- a/lib/common.rb +++ b/lib/common.rb @@ -32,6 +32,15 @@ class W3DHub linux? || mac? end + # Detect system CA bundle path for SSL verification + def self.ca_bundle_path + [ + "/etc/ssl/certs/ca-certificates.crt", # Debian/Ubuntu + "/etc/pki/tls/certs/ca-bundle.crt", # RHEL/Fedora/CentOS + "/etc/ssl/ca-bundle.pem" # Some other distros + ].find { |path| File.exist?(path) } + end + def self.url(path) raise "Hazardous input: #{path}" if path.include?("&&") || path.include?(";") diff --git a/lib/pages/settings.rb b/lib/pages/settings.rb index d93bc8b..04c232a 100644 --- a/lib/pages/settings.rb +++ b/lib/pages/settings.rb @@ -85,6 +85,8 @@ class W3DHub "EspaƱol" else logger.warn("W3DHub::Settings") { "Unknown language code: #{string.inspect}" } + + "UNKNOWN" end end diff --git a/media/banners/ar.png b/media/banners/ar.png index c729c0e..cfdb2be 100644 Binary files a/media/banners/ar.png and b/media/banners/ar.png differ