mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-15 08:42:34 +00:00
Show error message at start up if we cannot resolve critical domains. Fixes #15
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user