mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Merge branch 'feature-buildBinaryPackage' of github.com:The-Unnamed-Engineer/w3d_hub_linux_launcher into The-Unnamed-Engineer-feature-buildBinaryPackage
This commit is contained in:
14
lib/api.rb
14
lib/api.rb
@@ -1,5 +1,19 @@
|
||||
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
|
||||
Excon.defaults[:ssl_ca_file] = ca_file
|
||||
end
|
||||
|
||||
LOG_TAG = "W3DHub::Api".freeze
|
||||
|
||||
API_TIMEOUT = 30 # seconds
|
||||
|
||||
@@ -10,6 +10,15 @@ 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
|
||||
@@ -23,7 +32,13 @@ class W3DHub
|
||||
def self.verify_peer
|
||||
no_verify.tap do |context|
|
||||
context.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||
context.cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
||||
context.cert_store = OpenSSL::X509::Store.new
|
||||
ca_file = ca_bundle_path
|
||||
if ca_file
|
||||
context.cert_store.add_file(ca_file)
|
||||
else
|
||||
context.cert_store.set_default_paths
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -161,7 +161,13 @@ class W3DHub
|
||||
flow(width: 1.0, max_width: 1230, height: 200, margin: 8, border_thickness: 1, border_color: lighten(Gosu::Color.new(0xff_252525))) do
|
||||
background 0x44_000000
|
||||
|
||||
image image_path, height: 1.0
|
||||
# Ensure the image file exists before trying to load it
|
||||
if File.exist?(image_path)
|
||||
image image_path, height: 1.0
|
||||
else
|
||||
logger.warn("W3DHub::Community") { "Image not found in cache: #{image_path}" }
|
||||
image BLACK_IMAGE, height: 1.0
|
||||
end
|
||||
|
||||
stack(fill: true, height: 1.0, padding: 4, border_thickness_left: 1, border_color_left: lighten(Gosu::Color.new(0xff_252525))) do
|
||||
tagline "<b>#{item.title}</b>", width: 1.0
|
||||
|
||||
@@ -84,7 +84,7 @@ class W3DHub
|
||||
when "es"
|
||||
"Español"
|
||||
else
|
||||
raise "Unknown language error"
|
||||
logger.warn("W3DHub::Settings") { "Unknown language code: #{string.inspect}" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user