From 7ab9af6a9e7914fc7f8c5c0ae6c7cf3526019692 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 10 Sep 2008 20:45:48 -0500 Subject: [PATCH] make a webapp that shows you your ip --- extra/webapps/ip/ip.factor | 16 ++++++++++++++++ extra/webapps/ip/ip.xml | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 extra/webapps/ip/ip.factor create mode 100644 extra/webapps/ip/ip.xml diff --git a/extra/webapps/ip/ip.factor b/extra/webapps/ip/ip.factor new file mode 100644 index 0000000000..7124d4a5c4 --- /dev/null +++ b/extra/webapps/ip/ip.factor @@ -0,0 +1,16 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors furnace.actions http.server.dispatchers +html.forms io.servers.connection namespaces prettyprint ; +IN: webapps.ip + +TUPLE: ip-app < dispatcher ; + +: ( -- action ) + + [ remote-address get host>> "ip" set-value ] >>init + { ip-app "ip" } >>template ; + +: ( -- dispatcher ) + ip-app new-dispatcher + "" add-responder ; diff --git a/extra/webapps/ip/ip.xml b/extra/webapps/ip/ip.xml new file mode 100644 index 0000000000..c8529c27ce --- /dev/null +++ b/extra/webapps/ip/ip.xml @@ -0,0 +1,7 @@ + + + + Your IP address is: + + +