mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-09-19 23:03:53 +00:00
Initial pass at lazily loading app icons
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user