MCPcopy
hub / github.com/produck/svg-captcha

github.com/produck/svg-captcha @v1.04 sqlite

repository ↗ · DeepWiki ↗ · release v1.04 ↗
5 symbols 9 edges 9 files 0 documented · 0%
README

svg-captcha

svg captcha

Build Status

generate svg captcha in node.js

useful if you

  • cannot or do not want to use google recaptcha
  • have issue with install c++ addon

usage

var svgCaptcha = require('svg-captcha');
// generate random text of length 4
var text = svgCaptcha.randomText();
// generate svg image
var captcha = svgCaptcha(text);

with express

var svgCaptcha = require('svg-captcha');

app.get('/captcha', function (req, res) {
    var text = svgCaptcha.randomText();
    var captcha = svgCaptcha(text);
    req.session.captcha = text;

    res.set('Content-Type', 'image/svg+xml');
    res.status(200).send(captcha);
});

sample image

image

why use svg?

It does not require any c++ addon.
The result image is smaller than jpeg image.

This has to be a joke. /\<text.+>;.+\<\/text>/g.test...

svg captcha uses opentype.js underneath, which means that there is no '<text>1234</text>'.
You get '<path fill="#444" d="M104.83 19.74L107.85 19.74L112 33.56L116.13 19.74L119.15 19.74L113.48 36.85...'
instead.

Even though you can write a program that convert svg to png, svg captcha has done its job
—— make captcha recognition harder

Translations

中文

License

MIT

Core symbols most depended-on inside this repo

randomInt
called by 6
lib/random.js
getLineNoise
called by 1
lib/index.js
getSVGOptions
called by 1
lib/index.js
getText
called by 1
lib/index.js
createCaptcha
called by 0
lib/index.js

Shape

Function 5

Languages

TypeScript100%

Modules by API surface

lib/index.js4 symbols
lib/random.js1 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

mocha2.5.3 · 1×
opentype.js0.6.4 · 1×
xo0.16.0 · 1×

For agents

$ claude mcp add svg-captcha \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact