mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-15 08:42:34 +00:00
Compare commits
5 Commits
2dc750a686
...
d67ffa14a3
| Author | SHA1 | Date | |
|---|---|---|---|
| d67ffa14a3 | |||
| 71047ce9e8 | |||
| 7da716dde4 | |||
| 3a72a2e094 | |||
| 3c565e6fee |
@@ -91,7 +91,7 @@ class W3DHub
|
||||
retry_interval: 1,
|
||||
retry_errors: [Excon::Error::Socket, Excon::Error::HTTPStatus] # Don't retry on timeout
|
||||
)
|
||||
rescue Excon::Errors::Timeout => e
|
||||
rescue Excon::Error::Timeout => e
|
||||
logger.error(LOG_TAG) { "Connection to \"#{url}\" timed out after: #{API_TIMEOUT} seconds" }
|
||||
|
||||
DummyResponse.new(e)
|
||||
@@ -135,7 +135,7 @@ class W3DHub
|
||||
retry_interval: 1,
|
||||
retry_errors: [Excon::Error::Socket, Excon::Error::HTTPStatus] # Don't retry on timeout
|
||||
)
|
||||
rescue Excon::Errors::Timeout => e
|
||||
rescue Excon::Error::Timeout => e
|
||||
logger.error(LOG_TAG) { "Connection to \"#{url}\" timed out after: #{API_TIMEOUT} seconds" }
|
||||
|
||||
DummyResponse.new(e)
|
||||
|
||||
18
lib/cache.rb
18
lib/cache.rb
@@ -133,10 +133,24 @@ class W3DHub
|
||||
return true
|
||||
else
|
||||
logger.debug(LOG_TAG) { " Failed to retrieve package: (#{package.category}:#{package.subcategory}:#{package.name}:#{package.version})" }
|
||||
logger.debug(LOG_TAG) { " Download URL: #{endpoint_download_url}, response: #{response.status}" }
|
||||
logger.debug(LOG_TAG) { " Download URL: #{endpoint_download_url}, response: #{response&.status || -1}" }
|
||||
|
||||
false
|
||||
return false
|
||||
end
|
||||
rescue Excon::Error::Timeout => e
|
||||
logger.error(LOG_TAG) { " Connection to \"#{endpoint_download_url}\" timed out after: #{W3DHub::Api::API_TIMEOUT} seconds" }
|
||||
logger.error(LOG_TAG) { e }
|
||||
logger.debug(LOG_TAG) { " Failed to retrieve package: (#{package.category}:#{package.subcategory}:#{package.name}:#{package.version})" }
|
||||
logger.debug(LOG_TAG) { " Download URL: #{endpoint_download_url}, response: #{response&.status || -1}" }
|
||||
|
||||
return false
|
||||
rescue Excon::Error => e
|
||||
logger.error(LOG_TAG) { " Connection to \"#{endpoint_download_url}\" errored:" }
|
||||
logger.error(LOG_TAG) { e }
|
||||
logger.debug(LOG_TAG) { " Failed to retrieve package: (#{package.category}:#{package.subcategory}:#{package.name}:#{package.version})" }
|
||||
logger.debug(LOG_TAG) { " Download URL: #{endpoint_download_url}, response: #{response&.status || -1}" }
|
||||
|
||||
return false
|
||||
ensure
|
||||
file&.close
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ class W3DHub
|
||||
@fraction = 0.0
|
||||
@w3dhub_logo = get_image("#{GAME_ROOT_PATH}/media/icons/app.png")
|
||||
@tasks = {
|
||||
# connectivity_check: { started: false, complete: false }, # HEAD connectivity-check.ubuntu.com or HEAD secure.w3dhub.com?
|
||||
connectivity_check: { started: false, complete: false }, # HEAD connectivity-check.ubuntu.com or HEAD secure.w3dhub.com?
|
||||
# launcher_updater: { started: false, complete: false },
|
||||
server_list: { started: false, complete: false },
|
||||
refresh_user_token: { started: false, complete: false },
|
||||
@@ -139,6 +139,41 @@ class W3DHub
|
||||
@tasks[:refresh_user_token][:complete] = true
|
||||
end
|
||||
|
||||
def connectivity_check
|
||||
domains = {
|
||||
"w3dhub-api.w3d.cyberarm.dev": false,
|
||||
"s3.w3d.cyberarm.dev": false,
|
||||
"secure.w3dhub.com": false
|
||||
}
|
||||
|
||||
@status_label.value = "Checking uplink..."
|
||||
domains.each do |key, value|
|
||||
begin
|
||||
Resolv.getaddress(key.to_s)
|
||||
rescue => e
|
||||
logger.error(LOG_TAG) {"Failed to resolve hostname: #{key.to_s}"}
|
||||
logger.error(LOG_TAG) {e}
|
||||
|
||||
push_state(
|
||||
ConfirmDialog,
|
||||
title: "DNS Resolution Failure",
|
||||
message: "Failed to resolve: #{key.to_s}\n\nTry disabling VPN or proxy if in use.\n\n\nContinue offline?",
|
||||
cancel_callback: ->() { window.close },
|
||||
accept_callback: ->() {
|
||||
@offline_mode = true
|
||||
Store.offline_mode = true
|
||||
@tasks[:connectivity_check][:complete] = true
|
||||
}
|
||||
)
|
||||
|
||||
# Prevent task from being marked as completed
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@tasks[:connectivity_check][:complete] = true
|
||||
end
|
||||
|
||||
def service_status
|
||||
Api.on_thread(:service_status) do |service_status|
|
||||
@service_status = service_status
|
||||
|
||||
@@ -24,6 +24,7 @@ class W3DHub
|
||||
stack(width: 1.0, height: 46, padding: 8) do
|
||||
button "Okay", width: 1.0 do
|
||||
pop_state
|
||||
@options[:accept_callback]&.call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class W3DHub
|
||||
DIR_NAME = "W3DHubAlt"
|
||||
VERSION = "0.7.0"
|
||||
end
|
||||
VERSION = "0.8.0"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user