There are three approaches to my knowledge
- using a number or some letters and showing a "strange" picture representing it, the user has to enter the number or the letters
- using a formula, the user has to do the calculation and enter the result
- using a fragmented picture and the user has to choose the fragments that fit to a question (a google service can be used for that)
I preferred the first approach with the strange picture. I found captchapng, a solution that only uses javascript and not installation of other applications aside of node.js and no big C++ addon ...
BUT: captchapng has a statement that is recognized as error by the V8 javascript engine that is running on openshift as my node.js server.
The problem:
- there are branches to captchapng and pnglib with fixes to the problem
- but theses branches are not releases to new packages
- a fix in the local source of pnglib.js is ignored by node.js on openshift, the implementation seems to strictly reagard package.json directives and not the sources provided via git.
- experiments with changes to package.json on the app-level and the module-level were not successful
- I simplified:
- captchapng.js is in the root, where I have server.js
- pnglib.js is in the root, where I have server.js
- server.js references require("./captchapng.js");
- catpchapng.js references require ("./pnglib.js");
- additionally var myself is defined for strict mode
- and the correction in pgnlib.js is done:
- return "\x89PNG\r\n\x1a\n" + this.buffer.join('');
- and everything is fine
The error message referes to
octal escape sequence are deprecated in es5, and cause error when pnglib is run or bundled in 'strict mode'
It would be great it the npm version of captchapng would be updates to directly support the corrected solution.
No comments:
Post a Comment