mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Fixed crashes, added W3DHUB_DEBUG constant, reduced size of Excon download buffer from 4 MB to ~50KB to make ui able to more accurately show download activity
This commit is contained in:
@@ -41,6 +41,10 @@ class W3DHub
|
|||||||
@task_state
|
@task_state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log(string)
|
||||||
|
log string if W3DHUB_DEBUG
|
||||||
|
end
|
||||||
|
|
||||||
# Start task, inside its own thread
|
# Start task, inside its own thread
|
||||||
# FIXME: Ruby 3 has parallelism now: Use a Ractor to do work on a seperate core to
|
# FIXME: Ruby 3 has parallelism now: Use a Ractor to do work on a seperate core to
|
||||||
# prevent the UI from locking up while doing computation heavy work, i.e building
|
# prevent the UI from locking up while doing computation heavy work, i.e building
|
||||||
@@ -201,7 +205,7 @@ class W3DHub
|
|||||||
packages = []
|
packages = []
|
||||||
|
|
||||||
manifests.reverse.each do |manifest|
|
manifests.reverse.each do |manifest|
|
||||||
puts "#{manifest.game}-#{manifest.type}: #{manifest.version} (#{manifest.base_version})"
|
log "#{manifest.game}-#{manifest.type}: #{manifest.version} (#{manifest.base_version})"
|
||||||
|
|
||||||
manifest.files.each do |file|
|
manifest.files.each do |file|
|
||||||
@files["#{file.name}:#{manifest.version}"] = file
|
@files["#{file.name}:#{manifest.version}"] = file
|
||||||
@@ -250,7 +254,11 @@ class W3DHub
|
|||||||
file_count = manifests.map { |m| m.files.count }.sum
|
file_count = manifests.map { |m| m.files.count }.sum
|
||||||
processed_files = 0
|
processed_files = 0
|
||||||
|
|
||||||
|
folder_exists = File.directory?(path)
|
||||||
|
|
||||||
manifests.each do |manifest|
|
manifests.each do |manifest|
|
||||||
|
break unless folder_exists
|
||||||
|
|
||||||
manifest.files.each do |file|
|
manifest.files.each do |file|
|
||||||
safe_file_name = file.name.gsub("\\", "/")
|
safe_file_name = file.name.gsub("\\", "/")
|
||||||
# Fix borked data -> Data 'cause Windows don't care about capitalization
|
# Fix borked data -> Data 'cause Windows don't care about capitalization
|
||||||
@@ -266,7 +274,7 @@ class W3DHub
|
|||||||
|
|
||||||
unless File.exist?(file_path)
|
unless File.exist?(file_path)
|
||||||
rejected_files << { file: file, manifest_version: manifest.version }
|
rejected_files << { file: file, manifest_version: manifest.version }
|
||||||
puts "[#{manifest.version}] File missing: #{file_path}"
|
log "[#{manifest.version}] File missing: #{file_path}"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -279,21 +287,20 @@ class W3DHub
|
|||||||
|
|
||||||
f.close
|
f.close
|
||||||
|
|
||||||
pp file if file.checksum.nil?
|
log file.inspect if file.checksum.nil?
|
||||||
|
|
||||||
if digest.hexdigest.upcase == file.checksum.upcase
|
if digest.hexdigest.upcase == file.checksum.upcase
|
||||||
accepted_files[safe_file_name] = manifest.version
|
accepted_files[safe_file_name] = manifest.version
|
||||||
# puts "[#{manifest.version}] Verified file: #{file_path}"
|
log "[#{manifest.version}] Verified file: #{file_path}"
|
||||||
else
|
else
|
||||||
rejected_files << { file: file, manifest_version: manifest.version }
|
rejected_files << { file: file, manifest_version: manifest.version }
|
||||||
puts "[#{manifest.version}] File failed Verification: #{file_path}"
|
log "[#{manifest.version}] File failed Verification: #{file_path}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "#{rejected_files.count} missing or corrupt files"
|
log "#{rejected_files.count} missing or corrupt files"
|
||||||
|
|
||||||
# TODO: Filter packages to only the required ones
|
|
||||||
selected_packages = []
|
selected_packages = []
|
||||||
selected_packages_hash = {}
|
selected_packages_hash = {}
|
||||||
|
|
||||||
@@ -310,10 +317,8 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# FIXME: Order `selected_packages` like `packages`
|
|
||||||
|
|
||||||
# Removed packages that don't need to be fetched or processed
|
# Removed packages that don't need to be fetched or processed
|
||||||
packages.delete_if { |package| !selected_packages.find { |pkg| pkg == package } }
|
packages.delete_if { |package| !selected_packages.find { |pkg| pkg == package } } if folder_exists
|
||||||
|
|
||||||
packages
|
packages
|
||||||
end
|
end
|
||||||
@@ -421,7 +426,7 @@ class W3DHub
|
|||||||
|
|
||||||
def unpack_packages(packages)
|
def unpack_packages(packages)
|
||||||
path = Cache.install_path(@application, @channel)
|
path = Cache.install_path(@application, @channel)
|
||||||
puts "Unpacking packages in '#{path}'..."
|
log "Unpacking packages in '#{path}'..."
|
||||||
Cache.create_directories(path, true)
|
Cache.create_directories(path, true)
|
||||||
|
|
||||||
@status.operations.clear
|
@status.operations.clear
|
||||||
@@ -468,7 +473,7 @@ class W3DHub
|
|||||||
|
|
||||||
update_interface_task_status
|
update_interface_task_status
|
||||||
else
|
else
|
||||||
puts "COMMAND FAILED!"
|
log "COMMAND FAILED!"
|
||||||
fail!("Failed to unpack #{package.name}")
|
fail!("Failed to unpack #{package.name}")
|
||||||
|
|
||||||
break
|
break
|
||||||
@@ -508,7 +513,7 @@ class W3DHub
|
|||||||
|
|
||||||
@status.step = :mark_application_installed
|
@status.step = :mark_application_installed
|
||||||
|
|
||||||
puts "#{@app_id} has been installed."
|
log "#{@app_id} has been installed."
|
||||||
end
|
end
|
||||||
|
|
||||||
#############
|
#############
|
||||||
@@ -540,7 +545,7 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def package_fetch(package, &block)
|
def package_fetch(package, &block)
|
||||||
puts "Downloading: #{package.category}:#{package.subcategory}:#{package.name}-#{package.version}"
|
log "Downloading: #{package.category}:#{package.subcategory}:#{package.name}-#{package.version}"
|
||||||
|
|
||||||
Api.package(package) do |chunk, remaining_bytes, total_bytes|
|
Api.package(package) do |chunk, remaining_bytes, total_bytes|
|
||||||
block&.call(chunk, remaining_bytes, total_bytes)
|
block&.call(chunk, remaining_bytes, total_bytes)
|
||||||
@@ -548,7 +553,7 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def verify_package(package, &block)
|
def verify_package(package, &block)
|
||||||
puts "Verifying: #{package.category}:#{package.subcategory}:#{package.name}-#{package.version}"
|
log "Verifying: #{package.category}:#{package.subcategory}:#{package.name}-#{package.version}"
|
||||||
|
|
||||||
digest = Digest::SHA256.new
|
digest = Digest::SHA256.new
|
||||||
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
||||||
@@ -559,7 +564,7 @@ class W3DHub
|
|||||||
operation&.value = "Verifying..."
|
operation&.value = "Verifying..."
|
||||||
|
|
||||||
file_size = File.size(path)
|
file_size = File.size(path)
|
||||||
puts " File size: #{file_size}"
|
log " File size: #{file_size}"
|
||||||
chunk_size = package.checksum_chunk_size
|
chunk_size = package.checksum_chunk_size
|
||||||
chunks = package.checksum_chunks.size
|
chunks = package.checksum_chunks.size
|
||||||
|
|
||||||
@@ -584,11 +589,11 @@ class W3DHub
|
|||||||
|
|
||||||
if Digest::SHA256.new.hexdigest(chunk).upcase == checksum.upcase
|
if Digest::SHA256.new.hexdigest(chunk).upcase == checksum.upcase
|
||||||
valid_at = chunk_start + read_length
|
valid_at = chunk_start + read_length
|
||||||
# puts " Passed chunk: #{chunk_start}"
|
# log " Passed chunk: #{chunk_start}"
|
||||||
# package.partially_valid_at_bytes = valid_at
|
# package.partially_valid_at_bytes = valid_at
|
||||||
package.partially_valid_at_bytes = chunk_start
|
package.partially_valid_at_bytes = chunk_start
|
||||||
else
|
else
|
||||||
puts " FAILED chunk: #{chunk_start}"
|
log " FAILED chunk: #{chunk_start}"
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -602,25 +607,25 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def unpack_package(package, path)
|
def unpack_package(package, path)
|
||||||
puts " #{package.name}:#{package.version}"
|
log " #{package.name}:#{package.version}"
|
||||||
package_path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
package_path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
||||||
|
|
||||||
puts " Running #{W3DHub.tar_command} command: #{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{path}\""
|
log " Running #{W3DHub.tar_command} command: #{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{path}\""
|
||||||
return system("#{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{path}\"")
|
return system("#{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{path}\"")
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_patch(package, path)
|
def apply_patch(package, path)
|
||||||
puts " #{package.name}:#{package.version}"
|
log " #{package.name}:#{package.version}"
|
||||||
package_path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
package_path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
||||||
temp_path = "#{Store.settings[:package_cache_dir]}/temp"
|
temp_path = "#{Store.settings[:package_cache_dir]}/temp"
|
||||||
manifest_file = package.custom_is_patch
|
manifest_file = package.custom_is_patch
|
||||||
|
|
||||||
Cache.create_directories(temp_path, true)
|
Cache.create_directories(temp_path, true)
|
||||||
|
|
||||||
puts " Running #{W3DHub.tar_command} command: #{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{temp_path}\""
|
log " Running #{W3DHub.tar_command} command: #{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{temp_path}\""
|
||||||
system("#{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{temp_path}\"")
|
system("#{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{temp_path}\"")
|
||||||
|
|
||||||
puts " Loading #{temp_path}/#{manifest_file.name}.patch..."
|
log " Loading #{temp_path}/#{manifest_file.name}.patch..."
|
||||||
patch_mix = W3DHub::Mixer::Reader.new(file_path: "#{temp_path}/#{manifest_file.name}.patch", ignore_crc_mismatches: false)
|
patch_mix = W3DHub::Mixer::Reader.new(file_path: "#{temp_path}/#{manifest_file.name}.patch", ignore_crc_mismatches: false)
|
||||||
patch_info = JSON.parse(patch_mix.package.files.find { |f| f.name == ".w3dhub.patch" || f.name == ".bhppatch" }.data, symbolize_names: true)
|
patch_info = JSON.parse(patch_mix.package.files.find { |f| f.name == ".w3dhub.patch" || f.name == ".bhppatch" }.data, symbolize_names: true)
|
||||||
|
|
||||||
@@ -628,15 +633,15 @@ class W3DHub
|
|||||||
# Fix borked data -> Data 'cause Windows don't care about capitalization
|
# Fix borked data -> Data 'cause Windows don't care about capitalization
|
||||||
repaired_path = "#{path}/#{manifest_file.name.sub('data', 'Data')}" unless File.exist?(repaired_path) && path
|
repaired_path = "#{path}/#{manifest_file.name.sub('data', 'Data')}" unless File.exist?(repaired_path) && path
|
||||||
|
|
||||||
puts " Loading #{repaired_path}..."
|
log " Loading #{repaired_path}..."
|
||||||
target_mix = W3DHub::Mixer::Reader.new(file_path: repaired_path, ignore_crc_mismatches: false)
|
target_mix = W3DHub::Mixer::Reader.new(file_path: repaired_path, ignore_crc_mismatches: false)
|
||||||
|
|
||||||
puts " Removing files..." if patch_info[:removedFiles].size.positive?
|
log " Removing files..." if patch_info[:removedFiles].size.positive?
|
||||||
patch_info[:removedFiles].each do |file|
|
patch_info[:removedFiles].each do |file|
|
||||||
target_mix.package.files.delete_if { |f| f.name == file }
|
target_mix.package.files.delete_if { |f| f.name == file }
|
||||||
end
|
end
|
||||||
|
|
||||||
puts " Adding/Updating files..." if patch_info[:updatedFiles].size.positive?
|
log " Adding/Updating files..." if patch_info[:updatedFiles].size.positive?
|
||||||
patch_info[:updatedFiles].each do |file|
|
patch_info[:updatedFiles].each do |file|
|
||||||
patch = patch_mix.package.files.find { |f| f.name == file }
|
patch = patch_mix.package.files.find { |f| f.name == file }
|
||||||
target = target_mix.package.files.find { |f| f.name == file }
|
target = target_mix.package.files.find { |f| f.name == file }
|
||||||
@@ -649,7 +654,7 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
puts " Writing updated #{repaired_path}..." if patch_info[:updatedFiles].size.positive?
|
log " Writing updated #{repaired_path}..." if patch_info[:updatedFiles].size.positive?
|
||||||
W3DHub::Mixer::Writer.new(file_path: repaired_path, package: target_mix.package, memory_buffer: true)
|
W3DHub::Mixer::Writer.new(file_path: repaired_path, package: target_mix.package, memory_buffer: true)
|
||||||
|
|
||||||
FileUtils.remove_dir(temp_path)
|
FileUtils.remove_dir(temp_path)
|
||||||
@@ -666,7 +671,7 @@ class W3DHub
|
|||||||
# Force data/ to Data/
|
# Force data/ to Data/
|
||||||
return true unless File.exist?("#{path}/data") && File.directory?("#{path}/data")
|
return true unless File.exist?("#{path}/data") && File.directory?("#{path}/data")
|
||||||
|
|
||||||
puts " Moving #{path}/data/ to #{path}/Data/"
|
log " Moving #{path}/data/ to #{path}/Data/"
|
||||||
|
|
||||||
FileUtils.mv(Dir.glob("#{path}/data/**"), "#{path}/Data", force: true)
|
FileUtils.mv(Dir.glob("#{path}/data/**"), "#{path}/Data", force: true)
|
||||||
FileUtils.remove_dir("#{path}/data", force: true)
|
FileUtils.remove_dir("#{path}/data", force: true)
|
||||||
|
|||||||
@@ -33,9 +33,11 @@ class W3DHub
|
|||||||
@status.value = "Purging installation folder..."
|
@status.value = "Purging installation folder..."
|
||||||
@status.progress = Float::INFINITY
|
@status.progress = Float::INFINITY
|
||||||
|
|
||||||
|
@status.step = :uninstalling_application
|
||||||
|
|
||||||
path = Cache.install_path(@application, @channel)
|
path = Cache.install_path(@application, @channel)
|
||||||
|
|
||||||
puts path
|
log path
|
||||||
# TODO: Do some sanity checking, i.e. DO NOT start launcher if `whoami` returns root, path makes sense,
|
# TODO: Do some sanity checking, i.e. DO NOT start launcher if `whoami` returns root, path makes sense,
|
||||||
# we're not on Windows trying to uninstall a game likely installed by the official launcher
|
# we're not on Windows trying to uninstall a game likely installed by the official launcher
|
||||||
FileUtils.remove_dir(path)
|
FileUtils.remove_dir(path)
|
||||||
@@ -51,7 +53,7 @@ class W3DHub
|
|||||||
|
|
||||||
@status.step = :mark_application_uninstalled
|
@status.step = :mark_application_uninstalled
|
||||||
|
|
||||||
puts "#{@app_id} has been uninstalled."
|
log "#{@app_id} has been uninstalled."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,7 +42,11 @@ class W3DHub
|
|||||||
while BackgroundWorker.alive?
|
while BackgroundWorker.alive?
|
||||||
job = @jobs.shift
|
job = @jobs.shift
|
||||||
|
|
||||||
|
begin
|
||||||
job&.do
|
job&.do
|
||||||
|
rescue => e
|
||||||
|
pp e
|
||||||
|
end
|
||||||
|
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class W3DHub
|
|||||||
tcp_nodelay: true,
|
tcp_nodelay: true,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
body: "data=#{JSON.dump({ category: package.category, subcategory: package.subcategory, name: package.name, version: package.version })}",
|
body: "data=#{JSON.dump({ category: package.category, subcategory: package.subcategory, name: package.name, version: package.version })}",
|
||||||
chunk_size: 4_000_000,
|
chunk_size: 50_000,
|
||||||
response_block: streamer
|
response_block: streamer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -36,16 +36,27 @@ class W3DHub
|
|||||||
|
|
||||||
# Do network stuff
|
# Do network stuff
|
||||||
|
|
||||||
Api.on_fiber(:user_login, @username.value, @password.value) do |account|
|
BackgroundWorker.foreground_job(
|
||||||
|
lambda do
|
||||||
|
account = Api.user_login(@username.value, @password.value)
|
||||||
|
applications = nil
|
||||||
|
|
||||||
if account
|
if account
|
||||||
Store.account = account
|
Store.account = account
|
||||||
Store.settings[:account][:data] = account
|
Store.settings[:account][:data] = account
|
||||||
Store.settings.save_settings
|
Store.settings.save_settings
|
||||||
|
|
||||||
Cache.fetch(account.avatar_uri, true)
|
Cache.fetch(account.avatar_uri, true) if account
|
||||||
|
applications = Api.applications if account
|
||||||
|
end
|
||||||
|
|
||||||
|
[account, applications]
|
||||||
|
end,
|
||||||
|
lambda do |result|
|
||||||
|
account, applications = result
|
||||||
|
|
||||||
|
if account
|
||||||
populate_account_info
|
populate_account_info
|
||||||
applications = Api.applications
|
|
||||||
Store.applications = applications if applications
|
Store.applications = applications if applications
|
||||||
|
|
||||||
page(W3DHub::Pages::Games)
|
page(W3DHub::Pages::Games)
|
||||||
@@ -59,6 +70,7 @@ class W3DHub
|
|||||||
@error_label.value = "Incorrect username or password.\nOr too many failed login attempts, try again in a few minutes."
|
@error_label.value = "Incorrect username or password.\nOr too many failed login attempts, try again in a few minutes."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@error_label = caption "", width: 1.0, text_align: :center, color: 0xff_800000
|
@error_label = caption "", width: 1.0, text_align: :center, color: 0xff_800000
|
||||||
@@ -101,8 +113,14 @@ class W3DHub
|
|||||||
Store.settings.save_settings
|
Store.settings.save_settings
|
||||||
Store.account = nil
|
Store.account = nil
|
||||||
|
|
||||||
applications = Api.applications
|
BackgroundWorker.foreground_job(
|
||||||
Store.applications if applications
|
-> { Api.applications },
|
||||||
|
lambda do |applications|
|
||||||
|
if applications
|
||||||
|
Store.applications = applications
|
||||||
|
page(W3DHub::Pages::Games) if @host.current_page.is_a?(W3DHub::Pages::Games)
|
||||||
|
page(W3DHub::Pages::ServerBrowser) if @host.current_page.is_a?(W3DHub::Pages::ServerBrowser)
|
||||||
|
end
|
||||||
|
|
||||||
@host.instance_variable_get(:"@account_container").clear do
|
@host.instance_variable_get(:"@account_container").clear do
|
||||||
stack(width: 0.7, height: 1.0) do
|
stack(width: 0.7, height: 1.0) do
|
||||||
@@ -118,6 +136,8 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class W3DHub
|
|||||||
flow(width: 0.75, height: 1.0) do
|
flow(width: 0.75, height: 1.0) do
|
||||||
@filters.each do |app_id, enabled|
|
@filters.each do |app_id, enabled|
|
||||||
app = Store.applications.games.find { |a| a.id == app_id.to_s }
|
app = Store.applications.games.find { |a| a.id == app_id.to_s }
|
||||||
|
next unless app
|
||||||
|
|
||||||
image_path = File.exist?("#{GAME_ROOT_PATH}/media/icons/#{app_id}.png") ? "#{GAME_ROOT_PATH}/media/icons/#{app_id}.png" : "#{GAME_ROOT_PATH}/media/icons/default_icon.png"
|
image_path = File.exist?("#{GAME_ROOT_PATH}/media/icons/#{app_id}.png") ? "#{GAME_ROOT_PATH}/media/icons/#{app_id}.png" : "#{GAME_ROOT_PATH}/media/icons/default_icon.png"
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def draw
|
def draw
|
||||||
Gosu.draw_circle(window.width / 2, window.height / 2, @w3dhub_logo.width * Gosu.milliseconds / 1000.0 % 500, 128, 0x44_000000, 32)
|
Gosu.draw_circle(window.width / 2, window.height / 2, @w3dhub_logo.width * (0.6 + Math.cos(Gosu.milliseconds / 1000.0 * Math::PI).abs * 0.05), 128, 0x44_000000, 32)
|
||||||
@w3dhub_logo.draw_rot(window.width / 2, window.height / 2, 32)
|
@w3dhub_logo.draw_rot(window.width / 2, window.height / 2, 32)
|
||||||
|
|
||||||
super
|
super
|
||||||
@@ -43,7 +43,6 @@ class W3DHub
|
|||||||
def update
|
def update
|
||||||
super
|
super
|
||||||
|
|
||||||
# @fraction += 1.0 * window.dt
|
|
||||||
@fraction = 1.0 / (@tasks.size / @task_index.to_f)
|
@fraction = 1.0 / (@tasks.size / @task_index.to_f)
|
||||||
|
|
||||||
@progressbar.value = @fraction
|
@progressbar.value = @fraction
|
||||||
@@ -61,8 +60,6 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def refresh_user_token
|
def refresh_user_token
|
||||||
p :refresh_user_token
|
|
||||||
|
|
||||||
if Store.settings[:account, :data]
|
if Store.settings[:account, :data]
|
||||||
account = Api::Account.new(Store.settings[:account, :data], {})
|
account = Api::Account.new(Store.settings[:account, :data], {})
|
||||||
|
|
||||||
@@ -99,8 +96,6 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def service_status
|
def service_status
|
||||||
p :service_status
|
|
||||||
|
|
||||||
Api.on_fiber(:service_status) do |service_status|
|
Api.on_fiber(:service_status) do |service_status|
|
||||||
@service_status = service_status
|
@service_status = service_status
|
||||||
|
|
||||||
@@ -119,8 +114,6 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def applications
|
def applications
|
||||||
p :applications
|
|
||||||
|
|
||||||
@status_label.value = I18n.t(:"boot.checking_for_updates")
|
@status_label.value = I18n.t(:"boot.checking_for_updates")
|
||||||
|
|
||||||
Api.on_fiber(:applications) do |applications|
|
Api.on_fiber(:applications) do |applications|
|
||||||
@@ -136,8 +129,6 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def app_icons
|
def app_icons
|
||||||
puts :app_icons
|
|
||||||
|
|
||||||
return unless Store.applications
|
return unless Store.applications
|
||||||
|
|
||||||
packages = []
|
packages = []
|
||||||
@@ -146,8 +137,6 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
Api.on_fiber(:package_details, packages) do |package_details|
|
Api.on_fiber(:package_details, packages) do |package_details|
|
||||||
puts "Got response?"
|
|
||||||
|
|
||||||
package_details&.each do |package|
|
package_details&.each do |package|
|
||||||
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
||||||
generated_icon_path = "#{GAME_ROOT_PATH}/media/icons/#{package.subcategory}.png"
|
generated_icon_path = "#{GAME_ROOT_PATH}/media/icons/#{package.subcategory}.png"
|
||||||
@@ -176,8 +165,6 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def server_list
|
def server_list
|
||||||
puts :server_list
|
|
||||||
|
|
||||||
@status_label.value = I18n.t(:"server_browser.fetching_server_list")
|
@status_label.value = I18n.t(:"server_browser.fetching_server_list")
|
||||||
|
|
||||||
Api.on_fiber(:server_list, 2) do |list|
|
Api.on_fiber(:server_list, 2) do |list|
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ class W3DHub
|
|||||||
@page.focus
|
@page.focus
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_page
|
||||||
|
@page
|
||||||
|
end
|
||||||
|
|
||||||
def update_server_browser(server)
|
def update_server_browser(server)
|
||||||
return unless @page.is_a?(Pages::ServerBrowser)
|
return unless @page.is_a?(Pages::ServerBrowser)
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ I18n.load_path << Dir[File.expand_path("locales") + "/*.yml"]
|
|||||||
I18n.default_locale = :en
|
I18n.default_locale = :en
|
||||||
|
|
||||||
class W3DHub
|
class W3DHub
|
||||||
|
W3DHUB_DEBUG = ARGV.join.include?("--debug")
|
||||||
|
|
||||||
GAME_ROOT_PATH = File.expand_path(".", __dir__)
|
GAME_ROOT_PATH = File.expand_path(".", __dir__)
|
||||||
CACHE_PATH = "#{GAME_ROOT_PATH}/data/cache"
|
CACHE_PATH = "#{GAME_ROOT_PATH}/data/cache"
|
||||||
SETTINGS_FILE_PATH = "#{GAME_ROOT_PATH}/data/settings.json"
|
SETTINGS_FILE_PATH = "#{GAME_ROOT_PATH}/data/settings.json"
|
||||||
|
|||||||
Reference in New Issue
Block a user