Initial pass at lazily loading app icons

This commit is contained in:
2026-09-08 11:42:54 -05:00
parent efc9c2f150
commit 969a82a262
5 changed files with 46 additions and 5 deletions

View File

@@ -147,6 +147,9 @@ module W3DHubLauncher
)
})
rescue JSON::ParserError => e
puts "This should never happen!?!?!"
rescue Errno::EWOULDBLOCK
end
@@ -157,6 +160,14 @@ module W3DHubLauncher
response
end
def create_directory(path)
pathname = Pathname.new(path)
unless Dir.exist?(pathname.dirname)
FileUtils.mkdir_p(pathname.dirname)
end
end
#
# ------------ query / request handlers ------------
#
@@ -194,6 +205,8 @@ module W3DHubLauncher
headers = query.data["headers"] || DEFAULT_HEADERS
body = query.data["body"]
create_directory(path)
Sync do |task|
task.with_timeout(DEFAULT_NETWORK_TIMEOUT) do
Async::HTTP::Internet.send(method, url, headers, body) do |response|
@@ -230,6 +243,20 @@ module W3DHubLauncher
deliver_response(result, query)
end
def ico_to_png(query)
result = CyberarmEngine::Result.new
begin
ico = ICO.new(file: query.data["ico_path"])
ico.save(ico.images.max_by(&:width), query.data["png_path"])
result.data = { path: query.data["png_path"] }
rescue => e
result.error = e
end
deliver_response(result, query)
end
def dns_resolution(query)
result = CyberarmEngine::Result.new