/extra/webapps/ip/ip.factor
http://github.com/abeaumont/factor · Factor · 23 lines · 16 code · 5 blank · 2 comment · 0 complexity · 0a9c76cdbd1bf189f51a9fac4f4ffaec MD5 · raw file
- ! Copyright (C) 2008 Doug Coleman.
- ! See http://factorcode.org/license.txt for BSD license.
- USING: accessors furnace.actions http.server
- http.server.dispatchers html.forms io.sockets
- namespaces prettyprint kernel ;
- IN: webapps.ip
- TUPLE: ip-app < dispatcher ;
- : <display-ip-action> ( -- action )
- <page-action>
- [ remote-address get host>> "ip" set-value ] >>init
- { ip-app "ip" } >>template ;
- : <ip-app> ( -- dispatcher )
- ip-app new-dispatcher
- <display-ip-action> "" add-responder ;
- : run-ip-app ( -- )
- <ip-app> main-responder set-global
- 8080 httpd drop ;
- MAIN: run-ip-app