recaptcha-8.05.26/ 0000755 0001750 0001750 00000000000 11016734047 012373 5 ustar yuri yuri recaptcha-8.05.26/lua/ 0000755 0001750 0001750 00000000000 11016733026 013150 5 ustar yuri yuri recaptcha-8.05.26/lua/luadoc.log 0000644 0001750 0001750 00000000340 11016733026 015117 0 ustar yuri yuri Tue May 27 00:14:41 2008 INFO processing file `recaptcha.lua' Tue May 27 00:14:41 2008 DEBUG found module `...' Tue May 27 00:19:51 2008 INFO processing file `recaptcha.lua' Tue May 27 00:19:51 2008 DEBUG found module `...' recaptcha-8.05.26/lua/recaptcha.lua 0000644 0001750 0001750 00000007332 11016733026 015612 0 ustar yuri yuri module(..., package.seeall) ----------------------------------------------------------------------------- -- ReCaptcha (http://recaptcha.net/) is a free captcha web service that -- shows the visitors words from old books helping digitize them. This, -- module provides a Lua interface to recaptcha. You will need to get your -- own API key from recaptcha.net to use it. -- -- See http://sputnik.freewisdom.org/lib/recaptcha -- License: MIT/X -- (c) 2008 Yuri Takhteyev ----------------------------------------------------------------------------- local ReCaptcha = {} local ReCaptcha_mt = {__metatable = {}, __index = ReCaptcha} ----------------------------------------------------------------------------- -- Creates a new ReCaptcha object. -- -- @param args a single argument with two fields: the private API -- key and the public API key. -- @return an instance of ReCaptcha. ----------------------------------------------------------------------------- function new(args) local obj = setmetatable({}, ReCaptcha_mt) obj.private = args[2] obj.public = args[1] return obj end ----------------------------------------------------------------------------- -- Returns a table of names of fields posted by the captcha widget. -- -- @return a table of field names. ----------------------------------------------------------------------------- function ReCaptcha:get_fields() return {"recaptcha_challenge_field", "recaptcha_response_field"} end ----------------------------------------------------------------------------- -- Returns the html block that creates the ReCaptcha widget. -- -- @param options a table of options. -- @return a string containing JavaScript and HTML for -- inclusion in an HTML document. ----------------------------------------------------------------------------- function ReCaptcha:get_html(options) options = options or {} return string.format([[ ]], options.theme or "white", options.lang or "en", self.public, self.public) end ----------------------------------------------------------------------------- -- Verifies the captcha. -- -- @param params the table of POST parameters submitted by the client. -- @param remote_ip user's IP address. -- @return true if the verification is successful and false -- otherwise. ----------------------------------------------------------------------------- function ReCaptcha:verify(params, remote_ip) require("socket.http") local result, err = socket.http.request( "http://api-verify.recaptcha.net/verify", "privatekey="..self.private .."&remoteip="..remote_ip .."&challenge="..params.recaptcha_challenge_field .."&response="..(params.recaptcha_response_field or "") ) if not result then return false, err else if result=="true" then return true else result, err = string.match(result, "(%w+)\n(.*)") return (result and result=="true"), err end end end recaptcha-8.05.26/petrodoc~ 0000644 0001750 0001750 00000004235 11016733026 014333 0 ustar yuri yuri package = 'ReCaptcha' versions = { {'8.05.26', 'May 26, 2008', 'the initial release'}, } summary = 'A Lua interface to reCaptcha.' maintainer = 'Yuri Takhteyev (yuri@freewisdom.org)' detailed = [[ reCaptcha is a free captcha web service that shows the visitors words from old books helping digitize them. This, module provides a Lua interface to recaptcha. You will need to get your own API key from recaptcha.net to use it. ]] license = 'MIT/X11' homepage = 'http://sputnik.freewisdom.org/lib/recaptcha/' favicon = 'http://media.freewisdom.org/etc/recaptcha.ico' download = 'http://sputnik.freewisdom.org/files/recaptcha-$version.tar.gz' --download = "/tmp/versium-$version.tar.gz" push = "scp %s yuri@web10.webfaction.com:~/webapps/static/files/" --push = "cp %s /tmp/" logo = 'recaptcha.png' keywords = 'lua, recaptcha, captcha' rss = homepage.."releases.rss" -------------------------------------------------------------------------------- dependencies = [[ 'luasocket >= 2.0' ]] -------------------------------------------------------------------------------- Installation = [[ The Lua interface Recaptcha to recaptcha consists of a single file (recaptcha.lua) of less than 100 lines, plus a test script (tests/recaptcha.cgi) which is meant to be used with WSAPI. Here is a list of recent releases:
"..detailed.."
" }, { "Installation", markdown(Installation) }, { "Using Recaptcha", markdown(include("doc/howto.md")) }, { "Contact", "Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions."}, { "LuaDoc", make_luadoc{"recaptcha.lua"} }, { "License", markdown(include("LICENSE.txt")) } } ------------------------------------------------------------------------------- recaptcha-8.05.26/recaptcha/ 0000755 0001750 0001750 00000000000 11016734047 014325 5 ustar yuri yuri recaptcha-8.05.26/recaptcha/lua/ 0000755 0001750 0001750 00000000000 11016734047 015106 5 ustar yuri yuri recaptcha-8.05.26/recaptcha/lua/luadoc.log 0000644 0001750 0001750 00000001060 11016734662 017060 0 ustar yuri yuri Tue May 27 00:14:41 2008 INFO processing file `recaptcha.lua' Tue May 27 00:14:41 2008 DEBUG found module `...' Tue May 27 00:19:51 2008 INFO processing file `recaptcha.lua' Tue May 27 00:19:51 2008 DEBUG found module `...' Tue May 27 00:28:40 2008 INFO processing file `recaptcha.lua' Tue May 27 00:28:40 2008 DEBUG found module `...' Tue May 27 00:29:41 2008 INFO processing file `recaptcha.lua' Tue May 27 00:29:41 2008 DEBUG found module `...' Tue May 27 00:35:14 2008 INFO processing file `recaptcha.lua' Tue May 27 00:35:14 2008 DEBUG found module `...' recaptcha-8.05.26/recaptcha/lua/recaptcha.lua 0000644 0001750 0001750 00000007332 11016734662 017553 0 ustar yuri yuri module(..., package.seeall) ----------------------------------------------------------------------------- -- ReCaptcha (http://recaptcha.net/) is a free captcha web service that -- shows the visitors words from old books helping digitize them. This, -- module provides a Lua interface to recaptcha. You will need to get your -- own API key from recaptcha.net to use it. -- -- See http://sputnik.freewisdom.org/lib/recaptcha -- License: MIT/X -- (c) 2008 Yuri Takhteyev ----------------------------------------------------------------------------- local ReCaptcha = {} local ReCaptcha_mt = {__metatable = {}, __index = ReCaptcha} ----------------------------------------------------------------------------- -- Creates a new ReCaptcha object. -- -- @param args a single argument with two fields: the private API -- key and the public API key. -- @return an instance of ReCaptcha. ----------------------------------------------------------------------------- function new(args) local obj = setmetatable({}, ReCaptcha_mt) obj.private = args[2] obj.public = args[1] return obj end ----------------------------------------------------------------------------- -- Returns a table of names of fields posted by the captcha widget. -- -- @return a table of field names. ----------------------------------------------------------------------------- function ReCaptcha:get_fields() return {"recaptcha_challenge_field", "recaptcha_response_field"} end ----------------------------------------------------------------------------- -- Returns the html block that creates the ReCaptcha widget. -- -- @param options a table of options. -- @return a string containing JavaScript and HTML for -- inclusion in an HTML document. ----------------------------------------------------------------------------- function ReCaptcha:get_html(options) options = options or {} return string.format([[ ]], options.theme or "white", options.lang or "en", self.public, self.public) end ----------------------------------------------------------------------------- -- Verifies the captcha. -- -- @param params the table of POST parameters submitted by the client. -- @param remote_ip user's IP address. -- @return true if the verification is successful and false -- otherwise. ----------------------------------------------------------------------------- function ReCaptcha:verify(params, remote_ip) require("socket.http") local result, err = socket.http.request( "http://api-verify.recaptcha.net/verify", "privatekey="..self.private .."&remoteip="..remote_ip .."&challenge="..params.recaptcha_challenge_field .."&response="..(params.recaptcha_response_field or "") ) if not result then return false, err else if result=="true" then return true else result, err = string.match(result, "(%w+)\n(.*)") return (result and result=="true"), err end end end recaptcha-8.05.26/recaptcha/petrodoc~ 0000644 0001750 0001750 00000004235 11016734662 016274 0 ustar yuri yuri package = 'ReCaptcha' versions = { {'8.05.26', 'May 26, 2008', 'the initial release'}, } summary = 'A Lua interface to reCaptcha.' maintainer = 'Yuri Takhteyev (yuri@freewisdom.org)' detailed = [[ reCaptcha is a free captcha web service that shows the visitors words from old books helping digitize them. This, module provides a Lua interface to recaptcha. You will need to get your own API key from recaptcha.net to use it. ]] license = 'MIT/X11' homepage = 'http://sputnik.freewisdom.org/lib/recaptcha/' favicon = 'http://media.freewisdom.org/etc/recaptcha.ico' download = 'http://sputnik.freewisdom.org/files/recaptcha-$version.tar.gz' --download = "/tmp/versium-$version.tar.gz" push = "scp %s yuri@web10.webfaction.com:~/webapps/static/files/" --push = "cp %s /tmp/" logo = 'recaptcha.png' keywords = 'lua, recaptcha, captcha' rss = homepage.."releases.rss" -------------------------------------------------------------------------------- dependencies = [[ 'luasocket >= 2.0' ]] -------------------------------------------------------------------------------- Installation = [[ The Lua interface Recaptcha to recaptcha consists of a single file (recaptcha.lua) of less than 100 lines, plus a test script (tests/recaptcha.cgi) which is meant to be used with WSAPI. Here is a list of recent releases:"..detailed.."
" }, { "Installation", markdown(Installation) }, { "Using Recaptcha", markdown(include("doc/howto.md")) }, { "Contact", "Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions."}, { "LuaDoc", make_luadoc{"recaptcha.lua"} }, { "License", markdown(include("LICENSE.txt")) } } ------------------------------------------------------------------------------- recaptcha-8.05.26/recaptcha/doc/ 0000755 0001750 0001750 00000000000 11016734047 015072 5 ustar yuri yuri recaptcha-8.05.26/recaptcha/doc/howto.md~ 0000644 0001750 0001750 00000001500 11016734662 016751 0 ustar yuri yuri ## Creating the catpcha object You will need to get your PRIVATE and PUBLIC API keys from recaptcha. Once you have them, create an instance or ReCaptcha like this: captcha = recaptcha.new{PRIVATE, PUBLIC} ## Generating the Widget Include the output of captcha:get_html() into your form. For instance: my_html = "" ## Verifying user's input Send your POST fields and the user's IP address to captcha:verify(). For instance, for WSAPI: local request = wsapi.request.new(wsapi_env) local ok, err = captcha:verify(request.POST, wsapi_env.REMOTE_ADDR) if ok then ... else print ("Error: "..err) end recaptcha-8.05.26/recaptcha/doc/recaptcha.png 0000644 0001750 0001750 00000017435 11016734662 017547 0 ustar yuri yuri PNG IHDR ^; sRGB bKGD pHYs tIME/0M tEXtComment Created with The GIMPd%n tIDATx{\eC*HbFb[yCeV{Pj㛇Yfg55!JC5K,I * #M=< ss߿F#1\zAb"A 1 HLAb"D$& 1Ab"AD HLAb"A$& 1 AD$& HLAb"A((FxTGʠPA,F^^eq!zB$rC`Q=DKVV!@GpW5JIɅZ]Ze2BB|绐ƋFCJJ.u5:H䆨-(r@6[g5 եHKՠJFڦyyEPƅRAN*te$& kzwHLD+1!BQDb"]ًuPJILDçX_Бa6lz ht&0 B!IOCbo|ju)TR,Z"B,vHkb[DJˣP!/uӦ@cVE"7{B*Ֆ D"7ar Ž:}ëեPKqRG"뢢7D1Q+f\FNx>RO{9dwVH-#,^\.+BW׳ )#C \e\XB*cq2V G @L , M=q%si|JiifD #,̷ pZ~tAN`UL^fG~{4njMm0_:#CBV۩R'L .eA*mxSJ RSΤsq!J:˚E&!,̯5Ppg ܆dQoGMpվTM7!5'xMI ܬopBB*È|DGB&H ]H5Sd\BmCzv-V} /))V ~OD"OAlfޝ{h!>Wo;Z֦b`&$>QJWju(!#OyScLb/vb/VsF!{ޯbI.EJJMAnN(u"&îuN[OS`?8B@