diff --git a/lib/api.rb b/lib/api.rb index 451a75a..c9c5cdd 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -262,6 +262,8 @@ class W3DHub #! === Server List API === !# SERVER_LIST_ENDPOINT = "https://gsh.w3dhub.com".freeze + # SERVER_LIST_ENDPOINT = "https://gsh.w3d.cyberarm.dev".freeze + # SERVER_LIST_ENDPOINT = "http://127.0.0.1:9292".freeze GSH_CONNECTION = Excon.new(SERVER_LIST_ENDPOINT, persistent: true) def self.get(url, headers = DEFAULT_HEADERS, body = nil, api = :api) diff --git a/lib/api/server_list_updater.rb b/lib/api/server_list_updater.rb index b250daa..902c64e 100644 --- a/lib/api/server_list_updater.rb +++ b/lib/api/server_list_updater.rb @@ -35,7 +35,7 @@ class W3DHub puts e puts e.backtrace - sleep 10 + sleep 30 retry end end @@ -48,12 +48,18 @@ class W3DHub @auto_reconnect = false logger.debug(LOG_TAG) { "Requesting connection token..." } - response = Excon.post("https://gsh.w3dhub.com/listings/push/v2/negotiate?negotiateVersion=1", headers: Api::DEFAULT_HEADERS, body: "") + response = Api.post("#{Api::SERVER_LIST_ENDPOINT}/listings/push/v2/negotiate?negotiateVersion=1", Api::DEFAULT_HEADERS, "", :gsh) + + if response.status != 200 + @auto_reconnect = true + return + end + data = JSON.parse(response.body, symbolize_names: true) @invocation_id = 0 if @invocation_id > 9095 id = data[:connectionToken] - endpoint = "https://gsh.w3dhub.com/listings/push/v2?id=#{id}" + endpoint = "#{Api::SERVER_LIST_ENDPOINT}/listings/push/v2?id=#{id}" logger.debug(LOG_TAG) { "Connecting to websocket..." } this = self diff --git a/lib/pages/server_browser.rb b/lib/pages/server_browser.rb index cf2bc81..b1f071f 100644 --- a/lib/pages/server_browser.rb +++ b/lib/pages/server_browser.rb @@ -63,19 +63,13 @@ class W3DHub populate_server_list end end - - # button get_image("#{GAME_ROOT_PATH}/media/ui_icons/return.png"), tip: I18n.t(:"server_browser.refresh"), image_height: 1.0, margin_left: 16, padding_left: 2, padding_right: 2, padding_top: 2, padding_bottom: 2 do - # fetch_server_list - # end - - flow(fill: true) - - button "Direct Connect", height: 1.0, padding_top: 4, padding_bottom: 4 do - push_state(W3DHub::States::DirectConnectDialog) - end end flow(min_width: 372, width: 0.38, max_width: 512, height: 1.0) do |container| + button "Direct Connect", height: 1.0, padding_top: 4, padding_bottom: 4 do + push_state(W3DHub::States::DirectConnectDialog) + end + flow(fill: true) para "#{I18n.t(:"server_browser.nickname")}:" diff --git a/lib/theme.rb b/lib/theme.rb index f542b00..9259ff3 100644 --- a/lib/theme.rb +++ b/lib/theme.rb @@ -80,15 +80,15 @@ class W3DHub padding_bottom: 8, border_thickness: 2, border_color: Gosu::Color::NONE, - background: 0xff_0074e0, + background: 0xff_0074e0..0xff_0052c0, hover: { color: 0xff_f2f2f2, - background: 0xff_004c94, + background: 0xff_0052c0..0xff_0030a0, border_color: 0xff_0074e0 }, active: { color: 0xff_aaaaaa, - background: 0xff_005aad, + background: 0xff_0030a0..0xff_0052c0, border_color: 0xff_0074e0 } }, @@ -151,7 +151,18 @@ class W3DHub MenuItem: { width: 1.0, text_left: :left, - margin: 0 + margin: 0, + border_color: Gosu::Color::NONE, + background: 0xff_0074e0, + hover: { + color: 0xff_f2f2f2, + background: 0xff_0052c0, + border_color: Gosu::Color::NONE + }, + active: { + background: 0xff_0030a0, + border_color: Gosu::Color::NONE + } } } end