Pruned gem usage, replaced Launchy since it will cause a command prompt to momentarily appear.

This commit is contained in:
2023-02-05 17:59:37 -06:00
parent ff8387be6d
commit b6d5f4135a
10 changed files with 36 additions and 37 deletions

View File

@@ -32,6 +32,18 @@ class W3DHub
linux? || mac?
end
def self.url(path)
raise "Hazardous input: #{path}" if path.include?("&&") || path.include?(";")
if windows?
system("start #{path}")
elsif linux?
system("xdg-open #{path}")
elsif mac?
system("open #{path}")
end
end
def self.prompt_for_nickname(accept_callback: nil, cancel_callback: nil)
CyberarmEngine::Window.instance.push_state(
W3DHub::States::PromptDialog,

View File

@@ -16,16 +16,16 @@ class W3DHub
flow(width: 64 * 4 + (3 * 32), height: 1.0) do
image "#{GAME_ROOT_PATH}/media/icons/app.png", hover: { color: 0xaa_ffffff }, height: 1.0, tip: "#{I18n.t(:app_name)} Github Repository" do
Launchy.open("https://github.com/cyberarm/w3d_hub_linux_launcher")
W3DHub.url("https://github.com/cyberarm/w3d_hub_linux_launcher")
end
image "#{GAME_ROOT_PATH}/media/icons/w3dhub.png", hover: { color: 0xaa_ffffff }, height: 1.0, margin_left: 32, tip: "W3D Hub Forums" do
Launchy.open("https://w3dhub.com/forum/")
W3DHub.url("https://w3dhub.com/forum/")
end
image "#{GAME_ROOT_PATH}/media/social_media_icons/discord.png", hover: { color: 0xaa_ffffff }, height: 1.0, margin_left: 32, tip: "W3D Hub Discord Server" do
Launchy.open("https://discord.com/invite/GYhW7eV")
W3DHub.url("https://discord.com/invite/GYhW7eV")
end
image "#{GAME_ROOT_PATH}/media/social_media_icons/facebook.png", hover: { color: 0xaa_ffffff }, height: 1.0, margin_left: 32, tip: "W3D Hub Facebook Page" do
Launchy.open("https://www.facebook.com/w3dhub")
W3DHub.url("https://www.facebook.com/w3dhub")
end
end
@@ -43,10 +43,10 @@ class W3DHub
tagline "<b>Help & Support</b>"
flow(width: 1.0) do
para "For help and support using this launcher or playing any W3D Hub game visit the"
link("W3D Hub forums", text_size: 16, tip: "https://w3dhub.com/forum/") { Launchy.open("https://w3dhub.com/forum/") }
link("W3D Hub forums", text_size: 16, tip: "https://w3dhub.com/forum/") { W3DHub.url("https://w3dhub.com/forum/") }
para "or join us in"
image "#{GAME_ROOT_PATH}/media/social_media_icons/discord.png", height: 16, padding_top: 4
link("#tech-support", text_size: 16, tip: "https://discord.com/invite/GYhW7eV") { Launchy.open("https://discord.com/invite/GYhW7eV") }
link("#tech-support", text_size: 16, tip: "https://discord.com/invite/GYhW7eV") { W3DHub.url("https://discord.com/invite/GYhW7eV") }
para "on the W3D Hub Discord server"
end
end
@@ -112,7 +112,7 @@ class W3DHub
# stack(width: 0.6, height: 1.0) do
# stack(width: 1.0, height: 112) do
# link "<b>#{item.title}</b>", text_size: 18 do
# Launchy.open(item.uri)
# W3DHub.url(item.uri)
# end
# inscription item.blurb.gsub(/\n+/, "\n").strip[0..180]
# end
@@ -120,7 +120,7 @@ class W3DHub
# flow(width: 1.0) do
# inscription item.timestamp.strftime("%Y-%m-%d"), width: 0.499
# link I18n.t(:"games.read_more"), width: 0.5, text_align: :right, text_size: 14 do
# Launchy.open(item.uri)
# W3DHub.url(item.uri)
# end
# end
# end
@@ -142,7 +142,7 @@ class W3DHub
inscription item.blurb.gsub(/\n+/, "\n").strip[0..1024], fill: true
button I18n.t(:"games.read_more"), width: 1.0, margin_top: 8, margin_bottom: 0, padding_top: 4, padding_bottom: 4 do
Launchy.open(item.uri)
W3DHub.url(item.uri)
end
end

View File

@@ -116,7 +116,7 @@ class W3DHub
flow(width: 1.0, height: 22, margin_bottom: 8) do
image "#{GAME_ROOT_PATH}/media/ui_icons/share1.png", width: 0.11
link item.name, text_size: 18 do
Launchy.open(item.uri)
W3DHub.url(item.uri)
end
end
end
@@ -223,7 +223,7 @@ class W3DHub
stack(width: 0.6, height: 1.0) do
stack(width: 1.0, height: 112) do
link "<b>#{item.title}</b>", text_size: 18 do
Launchy.open(item.uri)
W3DHub.url(item.uri)
end
inscription item.blurb.gsub(/\n+/, "\n").strip[0..180]
end
@@ -231,7 +231,7 @@ class W3DHub
flow(width: 1.0) do
inscription item.timestamp.strftime("%Y-%m-%d"), width: 0.5
link I18n.t(:"games.read_more"), width: 0.5, text_align: :right, text_size: 14 do
Launchy.open(item.uri)
W3DHub.url(item.uri)
end
end
end
@@ -265,7 +265,7 @@ class W3DHub
stack(width: 0.75, height: 1.0) do
stack(width: 1.0, height: 128 - 28) do
link(mod[:name]) { Launchy.open(mod[:url]) }
link(mod[:name]) { W3DHub.url(mod[:url]) }
inscription "Author: #{mod[:author]} | #{mod[:type]} | #{mod[:subtype]}"
para mod[:description][0..180]
end

View File

@@ -136,7 +136,7 @@ class W3DHub
flow(width: 1.0, height: 22, margin_bottom: 8) do
image "#{GAME_ROOT_PATH}/media/ui_icons/share1.png", width: 24
link item.name, text_size: 18 do
Launchy.open(item.uri)
W3DHub.url(item.uri)
end
end
end
@@ -426,7 +426,7 @@ class W3DHub
inscription item.blurb.gsub(/\n+/, "\n").strip[0..1024], fill: true
button I18n.t(:"games.read_more"), width: 1.0, margin_top: 8, margin_bottom: 0, padding_top: 4, padding_bottom: 4 do
Launchy.open(item.uri)
W3DHub.url(item.uri)
end
end
@@ -525,7 +525,7 @@ class W3DHub
stack(width: 0.75, height: 1.0) do
stack(width: 1.0, height: 128 - 28) do
link(mod[:name]) { Launchy.open(mod[:url]) }
link(mod[:name]) { W3DHub.url(mod[:url]) }
inscription "Author: #{mod[:author]} | #{mod[:type]} | #{mod[:subtype]}"
para mod[:description][0..180]
end

View File

@@ -98,7 +98,7 @@ class W3DHub
flow(width: 1.0) do
link(I18n.t(:"interface.log_out"), text_size: 16, width: 0.5) { depopulate_account_info }
link I18n.t(:"interface.profile"), text_size: 16, width: 0.49 do
Launchy.open("https://secure.w3dhub.com/forum/index.php?showuser=#{Store.account.id}")
W3DHub.url("https://secure.w3dhub.com/forum/index.php?showuser=#{Store.account.id}")
end
end
end
@@ -131,7 +131,7 @@ class W3DHub
flow(width: 1.0) do
link(I18n.t(:"interface.log_in"), text_size: 16, width: 0.5) { page(W3DHub::Pages::Login) }
link I18n.t(:"interface.register"), text_size: 16, width: 0.49 do
Launchy.open("https://secure.w3dhub.com/forum/index.php?app=core&module=global&section=register")
W3DHub.url("https://secure.w3dhub.com/forum/index.php?app=core&module=global&section=register")
end
end
end

View File

@@ -67,7 +67,7 @@ class W3DHub
flow(width: 1.0) do
link(I18n.t(:"interface.log_in"), text_size: 16, width: 0.5) { page(W3DHub::Pages::Login) }
link I18n.t(:"interface.register"), text_size: 16, width: 0.49 do
Launchy.open("https://secure.w3dhub.com/forum/index.php?app=core&module=global&section=register")
W3DHub.url("https://secure.w3dhub.com/forum/index.php?app=core&module=global&section=register")
end
end
end

View File

@@ -91,7 +91,7 @@ class W3DHub
flow(width: 1.0) do
link(I18n.t(:"interface.log_in"), text_size: 16, width: 0.5) { page(W3DHub::Pages::Login) }
link I18n.t(:"interface.register"), text_size: 16, width: 0.49 do
Launchy.open("https://secure.w3dhub.com/forum/index.php?app=core&module=global&section=register")
W3DHub.url("https://secure.w3dhub.com/forum/index.php?app=core&module=global&section=register")
end
end
end