make mildly safer
This commit is contained in:
parent
c32a4143dc
commit
41bb37b3c6
1 changed files with 9 additions and 6 deletions
15
mewny.rb
15
mewny.rb
|
|
@ -17,11 +17,11 @@ options = {
|
||||||
}
|
}
|
||||||
OptionParser.new do |opt|
|
OptionParser.new do |opt|
|
||||||
opt.on('-pPORT', '--port PORT', Integer,
|
opt.on('-pPORT', '--port PORT', Integer,
|
||||||
'Port to serve/listen on (defaults to 7570)') do |o|
|
'Port to serve/listen on (defaults to 7570)') do |o|
|
||||||
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,11 +44,13 @@ 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|
|
||||||
options[:server_host] = PUBLIC_HOST
|
if o == "please"
|
||||||
|
options[:server_host] = PUBLIC_HOST
|
||||||
|
end
|
||||||
end
|
end
|
||||||
opt.on('-x', '--private',
|
opt.on('-x', '--private',
|
||||||
# x -- not visible
|
# x -- not visible
|
||||||
|
|
@ -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 >>> "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue