From bd41113ec0a6a64bf0c41c130ad95fdc239767c4 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 27 Aug 2019 20:58:44 -0700 Subject: Detect non-curl user agents --- curling.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'curling.rb') diff --git a/curling.rb b/curling.rb index 59c67db..4b03e8d 100644 --- a/curling.rb +++ b/curling.rb @@ -9,6 +9,19 @@ end before do headers 'Content-Type' => 'text/plain' + if request.user_agent !~ /^curl/ + halt <<~MSG +Welcome to Hex Curler! +====================== +This game is based on Jeff Moore's Hex (www.1km1kt.net/rpg/hex). +Source code: gitlab.com/m-chrzan/hex-curler + +This game is meant to be experienced in the command line. Run the following line +of bash to get started: + +c=; while clear; curl -c k -b k hex.m-chrzan.xyz/$c; read c; [ $c ]; do :; done + MSG + end end get '/' do -- cgit v1.2.3