From f1953c45e760299cfb24e833530641cec5274b9d Mon Sep 17 00:00:00 2001 From: The Unnamed Engineer Date: Tue, 10 Jun 2025 11:20:55 -0400 Subject: [PATCH 1/6] Initial support for binary packaging --- .github/workflows/build-tebako.yml | 47 ++++++++++++++++++++++++++++++ w3d_hub_linux_launcher.rb | 11 +++++-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-tebako.yml diff --git a/.github/workflows/build-tebako.yml b/.github/workflows/build-tebako.yml new file mode 100644 index 0000000..57b1686 --- /dev/null +++ b/.github/workflows/build-tebako.yml @@ -0,0 +1,47 @@ +name: Build Launcher Binary + +on: + push: + branches: [ master ] + workflow_dispatch: + +jobs: + build-tebako: + runs-on: ubuntu-latest + strategy: + matrix: + architecture: [x64] + container: + image: ghcr.io/tamatebako/tebako-ubuntu-20.04:latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + + - name: Install Gosu and native dependencies + run: | + apt-get update + apt-get install -y libsdl2-dev libgl1-mesa-dev libopenal-dev libgmp-dev libfontconfig1-dev libsndfile1-dev libmpg123-dev libpango1.0-dev libtool libssl-dev libffi-dev + + - name: Update Bundler and lockfile + run: | + gem install bundler -v 2.4.22 + bundle _2.4.22_ lock --update --bundler + + - name: Build Tebako binary + run: | + tebako press -P -R 3.4.1 -m bundle -o w3d_hub_linux_launcher -r $PWD -e w3d_hub_linux_launcher.rb + + - name: Prepare artifact directory + run: | + mkdir w3d-hub-launcher-x86_64 + cp w3d_hub_linux_launcher w3d-hub-launcher-x86_64/ + cp -r media w3d-hub-launcher-x86_64/ + cp -r locales w3d-hub-launcher-x86_64/ + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: w3d-hub-launcher-x86_64 + path: w3d-hub-launcher-x86_64 diff --git a/w3d_hub_linux_launcher.rb b/w3d_hub_linux_launcher.rb index 9af7df7..7c747fc 100644 --- a/w3d_hub_linux_launcher.rb +++ b/w3d_hub_linux_launcher.rb @@ -20,12 +20,19 @@ class W3DHub W3DHUB_DEBUG = ARGV.join.include?("--debug") W3DHUB_DEVELOPER = ARGV.join.include?("--developer") - GAME_ROOT_PATH = File.expand_path(".", __dir__) + # Use the real working directory as the root for runtime data/logs + GAME_ROOT_PATH = Dir.pwd + CACHE_PATH = "#{GAME_ROOT_PATH}/data/cache" + LOGS_PATH = "#{GAME_ROOT_PATH}/data/logs" SETTINGS_FILE_PATH = "#{GAME_ROOT_PATH}/data/settings.json" APPLICATIONS_CACHE_FILE_PATH = "#{GAME_ROOT_PATH}/data/applications_cache.json" - LOGGER = Logger.new("#{GAME_ROOT_PATH}/data/logs/w3d_hub_linux_launcher.log", "daily") + # Ensure data/cache and data/logs exist + FileUtils.mkdir_p(CACHE_PATH) unless Dir.exist?(CACHE_PATH) + FileUtils.mkdir_p(LOGS_PATH) unless Dir.exist?(LOGS_PATH) + + LOGGER = Logger.new("#{LOGS_PATH}/w3d_hub_linux_launcher.log", "daily") LOGGER.level = Logger::Severity::DEBUG # W3DHUB_DEBUG ? Logger::Severity::DEBUG : Logger::Severity::WARN LOG_TAG = "W3DHubLinuxLauncher" From 4d3163740a062053699c9f3dffde4f12c2bde119 Mon Sep 17 00:00:00 2001 From: The Unnamed Engineer Date: Tue, 10 Jun 2025 12:37:33 -0400 Subject: [PATCH 2/6] Update API to support RHEL cert bundle --- .github/workflows/build-tebako.yml | 2 +- lib/api.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-tebako.yml b/.github/workflows/build-tebako.yml index 57b1686..61c23b0 100644 --- a/.github/workflows/build-tebako.yml +++ b/.github/workflows/build-tebako.yml @@ -2,7 +2,7 @@ name: Build Launcher Binary on: push: - branches: [ master ] + branches: [ master, test ] workflow_dispatch: jobs: diff --git a/lib/api.rb b/lib/api.rb index 763323b..816f439 100644 --- a/lib/api.rb +++ b/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 From c3cee782656eca19595cb99cf7f3d9c7565e068a Mon Sep 17 00:00:00 2001 From: The Unnamed Engineer Date: Tue, 10 Jun 2025 13:00:41 -0400 Subject: [PATCH 3/6] Fix language error crash --- lib/pages/settings.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pages/settings.rb b/lib/pages/settings.rb index 789cabd..d096a7a 100644 --- a/lib/pages/settings.rb +++ b/lib/pages/settings.rb @@ -10,7 +10,7 @@ class W3DHub para "Language" para "Launcher Language", width: 0.249, margin_left: 32, margin_top: 12 stack(width: 0.75) do - @language_menu = list_box items: I18n.available_locales.map { |l| expand_language_code(l.to_s) }, choose: expand_language_code(Store.settings[:language]), width: 1.0 + @language_menu = list_box items: I18n.available_locales.map { |l| begin; expand_language_code(l.to_s); rescue => e; logger.warn("W3DHub::Settings") { "expand_language_code error for #{l.inspect}: #{e}" }; nil; end }.compact, choose: expand_language_code(Store.settings[:language]), width: 1.0 para "Select the UI language you'd like to use in the W3D Hub Launcher." end end @@ -114,7 +114,7 @@ class W3DHub when "es" "Español" else - raise "Unknown language error" + raise "Unknown language code: #{string.inspect}" end end end From 1081832df03eb6cf0a8d105282560f462bdfdf9b Mon Sep 17 00:00:00 2001 From: The Unnamed Engineer Date: Tue, 10 Jun 2025 13:32:08 -0400 Subject: [PATCH 4/6] Handle cases where image has not yet downloaded --- lib/pages/community.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pages/community.rb b/lib/pages/community.rb index 1b95373..7f2c7c1 100644 --- a/lib/pages/community.rb +++ b/lib/pages/community.rb @@ -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 "#{item.title}", width: 1.0 From b68d24deda4ccad28440efff4dcc8961de74d53d Mon Sep 17 00:00:00 2001 From: The Unnamed Engineer Date: Tue, 10 Jun 2025 14:54:05 -0400 Subject: [PATCH 5/6] Simply warn for unknown languages. --- lib/pages/settings.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pages/settings.rb b/lib/pages/settings.rb index d096a7a..84f82b7 100644 --- a/lib/pages/settings.rb +++ b/lib/pages/settings.rb @@ -10,7 +10,7 @@ class W3DHub para "Language" para "Launcher Language", width: 0.249, margin_left: 32, margin_top: 12 stack(width: 0.75) do - @language_menu = list_box items: I18n.available_locales.map { |l| begin; expand_language_code(l.to_s); rescue => e; logger.warn("W3DHub::Settings") { "expand_language_code error for #{l.inspect}: #{e}" }; nil; end }.compact, choose: expand_language_code(Store.settings[:language]), width: 1.0 + @language_menu = list_box items: I18n.available_locales.map { |l| expand_language_code(l.to_s) }, choose: expand_language_code(Store.settings[:language]), width: 1.0 para "Select the UI language you'd like to use in the W3D Hub Launcher." end end @@ -114,7 +114,7 @@ class W3DHub when "es" "Español" else - raise "Unknown language code: #{string.inspect}" + logger.warn("W3DHub::Settings") { "Unknown language code: #{string.inspect}" } end end end From e239f9cd4da391496b0eff4fbf8f3aa1f3a047a2 Mon Sep 17 00:00:00 2001 From: The Unnamed Engineer Date: Wed, 11 Jun 2025 06:20:29 -0400 Subject: [PATCH 6/6] Patch IRC config to detect RHEL cert bundle --- lib/asterisk/irc_client.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/asterisk/irc_client.rb b/lib/asterisk/irc_client.rb index 5f2dafd..0c7541a 100644 --- a/lib/asterisk/irc_client.rb +++ b/lib/asterisk/irc_client.rb @@ -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