This commit is contained in:
2026-06-22 10:57:00 -05:00
parent 675ab3b1a8
commit 02cbd215f5
3 changed files with 52 additions and 23 deletions

View File

@@ -7,7 +7,7 @@ GEM
io-event (~> 1.11) io-event (~> 1.11)
metrics (~> 0.12) metrics (~> 0.12)
traces (~> 0.18) traces (~> 0.18)
async-http (0.95.0) async-http (0.95.1)
async (>= 2.10.2) async (>= 2.10.2)
async-pool (~> 0.11) async-pool (~> 0.11)
io-endpoint (~> 0.14) io-endpoint (~> 0.14)
@@ -20,13 +20,13 @@ GEM
traces (~> 0.10) traces (~> 0.10)
async-pool (0.11.2) async-pool (0.11.2)
async (>= 2.0) async (>= 2.0)
async-websocket (0.30.0) async-websocket (0.30.1)
async-http (~> 0.76) async-http (~> 0.76)
protocol-http (~> 0.34) protocol-http (~> 0.34)
protocol-rack (~> 0.7) protocol-rack (~> 0.7)
protocol-websocket (~> 0.17) protocol-websocket (~> 0.17)
base64 (0.3.0) base64 (0.3.0)
console (1.34.3) console (1.36.0)
fiber-annotation fiber-annotation
fiber-local (~> 1.1) fiber-local (~> 1.1)
json json
@@ -41,10 +41,10 @@ GEM
fiber-storage (1.0.1) fiber-storage (1.0.1)
gosu (1.4.6) gosu (1.4.6)
io-endpoint (0.17.2) io-endpoint (0.17.2)
io-event (1.15.1) io-event (1.16.2)
io-stream (0.11.1) io-stream (0.13.1)
ircparser (1.0.0) ircparser (1.0.0)
json (2.19.4) json (2.19.9)
logger (1.7.0) logger (1.7.0)
metrics (0.15.0) metrics (0.15.0)
protocol-hpack (1.5.1) protocol-hpack (1.5.1)
@@ -59,12 +59,12 @@ GEM
protocol-http (~> 0.58) protocol-http (~> 0.58)
rack (>= 1.0) rack (>= 1.0)
protocol-url (0.4.0) protocol-url (0.4.0)
protocol-websocket (0.21.0) protocol-websocket (0.21.1)
protocol-http (~> 0.2) protocol-http (~> 0.2)
rack (3.2.6) rack (3.2.6)
rake (13.4.2) rake (13.4.2)
rexml (3.4.4) rexml (3.4.4)
rubyzip (3.2.2) rubyzip (3.4.0)
sdl2-bindings (0.2.3) sdl2-bindings (0.2.3)
ffi (~> 1.15) ffi (~> 1.15)
traces (0.18.2) traces (0.18.2)
@@ -88,11 +88,11 @@ DEPENDENCIES
CHECKSUMS CHECKSUMS
async (2.39.0) sha256=df18730073f2bbb45788077dfa20cb365ecc1b9453969f44de6796b5191a00aa async (2.39.0) sha256=df18730073f2bbb45788077dfa20cb365ecc1b9453969f44de6796b5191a00aa
async-http (0.95.0) sha256=08128cab255a48e41d1e856bfa9cbda001f1c57c88bafa3fa3a545ad795754aa async-http (0.95.1) sha256=0c3dd458c204c06d5c4b20b01bbec4794a1203db627fb2ce536e1799ec14786c
async-pool (0.11.2) sha256=0a43a17b02b04d9c451b7d12fafa9a50e55dc6dd00d4369aca00433f16a7e3ed async-pool (0.11.2) sha256=0a43a17b02b04d9c451b7d12fafa9a50e55dc6dd00d4369aca00433f16a7e3ed
async-websocket (0.30.0) sha256=55739954528ad8f87f7792d0452e1268d1ef2aa5b3719f79400a05a1a6202cdf async-websocket (0.30.1) sha256=54bb8a8f184e4aa64434c7a78ecc55850a67a3d1dcd02e3ae787376e2c673936
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
console (1.34.3) sha256=869fbd74697efc4c606f102d2812b0b008e4e7fd738a91c591e8577140ec0dcc console (1.36.0) sha256=45599ea906cf80a73d8941f03abf873fe66a6a954e0bac5bc1c01e2cdc406f07
cyberarm_engine (0.25.1) sha256=6f851a2ed0a32bdd25fc619172b546a8e26eefeb13a62c509f226337170d0efe cyberarm_engine (0.25.1) sha256=6f851a2ed0a32bdd25fc619172b546a8e26eefeb13a62c509f226337170d0efe
digest-crc (0.7.0) sha256=64adc23a26a241044cbe6732477ca1b3c281d79e2240bcff275a37a5a0d78c07 digest-crc (0.7.0) sha256=64adc23a26a241044cbe6732477ca1b3c281d79e2240bcff275a37a5a0d78c07
ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
@@ -101,10 +101,10 @@ CHECKSUMS
fiber-storage (1.0.1) sha256=f48e5b6d8b0be96dac486332b55cee82240057065dc761c1ea692b2e719240e1 fiber-storage (1.0.1) sha256=f48e5b6d8b0be96dac486332b55cee82240057065dc761c1ea692b2e719240e1
gosu (1.4.6) sha256=80c7fa48cf61f4960ef067fdd1c000d98b4adc8e11faeaa486543d00908a5c15 gosu (1.4.6) sha256=80c7fa48cf61f4960ef067fdd1c000d98b4adc8e11faeaa486543d00908a5c15
io-endpoint (0.17.2) sha256=3feaf766c116b35839c11fac68b6aaadc47887bb488902a57bf8e1d288fb3338 io-endpoint (0.17.2) sha256=3feaf766c116b35839c11fac68b6aaadc47887bb488902a57bf8e1d288fb3338
io-event (1.15.1) sha256=c644cdcf48254015d63f558bf4492f35471f5bb204a42180ea49752be59b30cc io-event (1.16.2) sha256=9f9cb0a96ea5c3850a672606c65f27bc96d7621399ef6196acbfe2be0cd1279c
io-stream (0.11.1) sha256=fa5f551fcff99581c1757b9d1cee2c37b124f07d2ca4f40b756a05ab9bd21b87 io-stream (0.13.1) sha256=570d7c4dfb0fbd767480b4a222048a2be6d9b78febc1ec68258d0e0a4cde20de
ircparser (1.0.0) sha256=0d4598f691172e2ad078207c50ba62c0d3428ae841836b0a682e6cd01d62878d ircparser (1.0.0) sha256=0d4598f691172e2ad078207c50ba62c0d3428ae841836b0a682e6cd01d62878d
json (2.19.4) sha256=670a7d333fb3b18ca5b29cb255eb7bef099e40d88c02c80bd42a3f30fe5239ac json (2.19.9) sha256=9b9025b7cdddafa38d316eca0b2358488e42d417045c1b90d216a9fefe46b79a
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
metrics (0.15.0) sha256=61ded5bac95118e995b1bc9ed4a5f19bc9814928a312a85b200abbdac9039072 metrics (0.15.0) sha256=61ded5bac95118e995b1bc9ed4a5f19bc9814928a312a85b200abbdac9039072
protocol-hpack (1.5.1) sha256=6feca238b8078da1cd295677d6f306c6001af92d75fe0643d33e6956cbc3ad91 protocol-hpack (1.5.1) sha256=6feca238b8078da1cd295677d6f306c6001af92d75fe0643d33e6956cbc3ad91
@@ -113,11 +113,11 @@ CHECKSUMS
protocol-http2 (0.26.0) sha256=bac89cd78082b241ccd0cf7246f5160e4bb0c9c975fb4bf7deef5f88cc317486 protocol-http2 (0.26.0) sha256=bac89cd78082b241ccd0cf7246f5160e4bb0c9c975fb4bf7deef5f88cc317486
protocol-rack (0.22.1) sha256=1185d245927ef9849a603700d6991ca353bc89724fbf98efa4a4333ed62a9fc3 protocol-rack (0.22.1) sha256=1185d245927ef9849a603700d6991ca353bc89724fbf98efa4a4333ed62a9fc3
protocol-url (0.4.0) sha256=64d4c03b6b51ad815ac6fdaf77a1d91e5baf9220d26becb846c5459dacdea9e1 protocol-url (0.4.0) sha256=64d4c03b6b51ad815ac6fdaf77a1d91e5baf9220d26becb846c5459dacdea9e1
protocol-websocket (0.21.0) sha256=6e2ccc2adf7de1895b0f6548fdfacf5f9735c0d4deb56cd2bac1ae38a1952e93 protocol-websocket (0.21.1) sha256=34325e4325697f0956877e67784bcc838cfd51ebbf4f8e9e5201be292041ee61
rack (3.2.6) sha256=5ed78e1f73b2e25679bec7d45ee2d4483cc4146eb1be0264fc4d94cb5ef212c2 rack (3.2.6) sha256=5ed78e1f73b2e25679bec7d45ee2d4483cc4146eb1be0264fc4d94cb5ef212c2
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rubyzip (3.2.2) sha256=c0ed99385f0625415c8f05bcae33fe649ed2952894a95ff8b08f26ca57ea5b3c rubyzip (3.4.0) sha256=6de39bc9eba302b635a476d16c9e16b0872ad24517c2f98f2b3a7ea23caff57b
sdl2-bindings (0.2.3) sha256=878c0755a4bea1aed0fa85c01596effd1c2b7d1878141ceec5bef808038bd309 sdl2-bindings (0.2.3) sha256=878c0755a4bea1aed0fa85c01596effd1c2b7d1878141ceec5bef808038bd309
traces (0.18.2) sha256=80f1649cb4daace1d7174b81f3b3b7427af0b93047759ba349960cb8f315e214 traces (0.18.2) sha256=80f1649cb4daace1d7174b81f3b3b7427af0b93047759ba349960cb8f315e214

View File

@@ -11,5 +11,11 @@ module W3DHubLauncher
def needs_redraw? def needs_redraw?
states.any?(&:needs_repaint?) states.any?(&:needs_repaint?)
end end
def update
super
sleep 0.001
end
end end
end end

View File

@@ -8,9 +8,22 @@ module W3DHubLauncher
def initialize def initialize
@access_token = nil @access_token = nil
@http_clients = {}
end end
def headers(form_encoded: false) def headers(form_encoded: false)
array = [
["user-agent", W3DHubLauncher::USER_AGENT],
["accept", "application/json"],
]
array << ["content-type", "application/x-www-form-urlencoded"] if form_encoded
array << ["authorization", "Bearer #{@access_token}"] if @access_token
pp array
array
end end
# return raw response to requester # return raw response to requester
@@ -19,13 +32,19 @@ module W3DHubLauncher
Sync do |task| Sync do |task|
task.with_timeout(API_TIMEOUT) do task.with_timeout(API_TIMEOUT) do
Async::HTTP::Internet.send(method, url, headers, body) do |response| endpoint = Async::HTTP::Endpoint.parse(url)
result.data = response.read client = @http_clients[endpoint.hostname.downcase] ||= Async::HTTP::Client.new(endpoint)
rescue StandardError => e
result.error = e pp endpoint, endpoint.authority, client
end response = client.get(endpoint.path)
rescue Async::TimeoutError pp response
result.error = e # client.send(method, endpoint.path, headers, body) do |response|
# result.data = response.read
# rescue StandardError => e
# result.error = e
# end
# rescue Async::TimeoutError
# result.error = e
end end
end end
@@ -80,6 +99,10 @@ module W3DHubLauncher
def fetch_applications def fetch_applications
result = CyberarmEngine::Result.new result = CyberarmEngine::Result.new
primary_result = fetch("#{PRIMARY_W3DHUB_API_ENDPOINT}/apis/launcher/1/get-applications")
alternate_result = fetch("#{ALTERNATIVE_W3DHUB_API_ENDPOINT}/apis/launcher/1/get-applications")
pp [primary_result, alternate_result]
end end
def fetch_news() def fetch_news()