m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-08-27 20:58:44 -0700
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-08-27 20:58:44 -0700
commitbd41113ec0a6a64bf0c41c130ad95fdc239767c4 (patch)
tree15ad36743fcf88fcba2308da751154256d9027cc
parentf9aeca796df3acf09feb773c257f29f056ef3f1b (diff)
Detect non-curl user agents
-rw-r--r--curling.rb13
1 files changed, 13 insertions, 0 deletions
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