Fix handling of extended-data in offline mode

This commit is contained in:
2024-03-12 10:42:10 -05:00
parent 0ab616f48b
commit 7fdb406588
2 changed files with 3 additions and 2 deletions

View File

@@ -35,10 +35,11 @@ class W3DHub
color = @data[:"extended-data"].find { |h| h[:name] == "colour" }[:value].sub("#", "") color = @data[:"extended-data"].find { |h| h[:name] == "colour" }[:value].sub("#", "")
color = color.sub("ff", "") if color.length == 8
@color = "ff#{color}".to_i(16) @color = "ff#{color}".to_i(16)
cfg = @data[:"extended-data"].find { |h| h[:name] == "usesEngineCfg" } cfg = @data[:"extended-data"].find { |h| h[:name] == "usesEngineCfg" }
@uses_engine_cfg = (cfg && cfg[:value].downcase.strip == "true") == true # explicit truthy compare to prevent return `nil` @uses_engine_cfg = (cfg && cfg[:value].to_s.downcase.strip == "true") == true # explicit truthy compare to prevent return `nil`
end end
def uses_engine_cfg? def uses_engine_cfg?

View File

@@ -65,7 +65,7 @@ class W3DHub
application = Store.applications.games.find { |g| g.id == key.to_s.split("_", 2).first } application = Store.applications.games.find { |g| g.id == key.to_s.split("_", 2).first }
next unless application next unless application
game[:colour] = application.color game[:colour] = "##{application.color.to_s(16)}"
game[:uses_engine_cfg] = application.uses_engine_cfg? game[:uses_engine_cfg] = application.uses_engine_cfg?
end end
end end