mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-15 16:52:34 +00:00
Fixed ICO implementation having a top and left offset for bitmap images, icons are now fetched at start up instead of statically being included (More work needed to fetch them after logging), fixed importer incorrectly storing executable basename instead of dirname
This commit is contained in:
@@ -14,6 +14,7 @@ class W3DHub
|
||||
refresh_user_token: { started: false, complete: false },
|
||||
service_status: { started: false, complete: false },
|
||||
applications: { started: false, complete: false },
|
||||
app_icons: { started: false, complete: false },
|
||||
server_list: { started: false, complete: false }
|
||||
}
|
||||
|
||||
@@ -118,6 +119,41 @@ class W3DHub
|
||||
end
|
||||
end
|
||||
|
||||
def app_icons
|
||||
return unless Store.applications
|
||||
|
||||
packages = []
|
||||
Store.applications.games.each do |app|
|
||||
packages << { category: app.category, subcategory: app.id, name: "#{app.id}.ico", version: "" }
|
||||
end
|
||||
|
||||
if (package_details = Api.package_details(packages))
|
||||
package_details.each do |package|
|
||||
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
||||
generated_icon_path = "#{GAME_ROOT_PATH}/media/icons/#{package.subcategory}.png"
|
||||
|
||||
regenerate = false
|
||||
|
||||
if File.exist?(path)
|
||||
regenerate = Digest::SHA256.new.hexdigest(File.binread(path)).upcase != package.checksum.upcase
|
||||
regenerate ||= !File.exist?(generated_icon_path)
|
||||
else
|
||||
Cache.fetch_package(package, proc {})
|
||||
regenerate = true
|
||||
end
|
||||
|
||||
if regenerate
|
||||
ico = ICO.new(file: path)
|
||||
image = ico.images.sort_by(&:width).last
|
||||
|
||||
ico.save(image, generated_icon_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@tasks[:app_icons][:complete] = true
|
||||
end
|
||||
|
||||
def server_list
|
||||
@status_label.value = I18n.t(:"server_browser.fetching_server_list")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user