make mildly safer

This commit is contained in:
Mewrry the Kitty 2026-02-07 17:36:50 -06:00
parent c32a4143dc
commit 41bb37b3c6

View file

@ -21,7 +21,7 @@ OptionParser.new do |opt|
options[:port] = o options[:port] = o
end end
opt.on('-S', '--server', opt.on('-S', '--server',
'Make this instance function as a server.' 'Make this instance function as a server'
) do ) do
options[:server] = true options[:server] = true
end end
@ -44,12 +44,14 @@ OptionParser.new do |opt|
) do |o| ) do |o|
options[:cols] = o options[:cols] = o
end end
opt.on('-X', '--public', opt.on('--expose-this-instance-for-the-world-to-see-because-I-know-what-I\'m-doing [please]',
# X -- eXposed # X -- eXposed
'(server only) Serve publicly, rather than privately' '(server only) Serve publicly, rather than privately. Please ONLY add this option if you entierly know what you\'re doing and have permission from/are the server owner. Say please to expose.'
) do ) do |o|
if o == "please"
options[:server_host] = PUBLIC_HOST options[:server_host] = PUBLIC_HOST
end end
end
opt.on('-x', '--private', opt.on('-x', '--private',
# x -- not visible # x -- not visible
'(server only) Serve privately, rather than publicly (default)' '(server only) Serve privately, rather than publicly (default)'
@ -80,6 +82,7 @@ def do_server
puts "PORT: #{PORT}" puts "PORT: #{PORT}"
puts "GRID SIZE: #{ROWS}r#{COLS}c" puts "GRID SIZE: #{ROWS}r#{COLS}c"
if SRV_HOST == PUBLIC_HOST then puts "EXPOSED" end
puts 'Listening...' puts 'Listening...'
pre = "#{ROWS}r#{COLS}c >>> " pre = "#{ROWS}r#{COLS}c >>> "