Wk-notes-01-31-g-recaptcha-npmshrinkwrap

npmshrinkwrap

$> npm shrinkwrap is an old cmd to lock the version of the dependencies. It will generate a npmshrinkwrap.json. Using latest node/npm could cause the change of it because the lockVersion format have been updated in new node.

Google recaptcha in China

Original google recaptcha service is blocked for obvious reason. To make it work, a chagne to hostname is necessary. Simply change www.google.com to recaptcha.net in both frontend js script and backend(if it's set inside China firewall) verify site call.

Library like react-google-recaptcha would support a setting (useRecaptchaNet) to enable global recaptcha by changing the hostname.

Tips :In frontend, the init script https://recaptcha.net/recaptcha/api.js will return a second layer of script to inject an iframe. This static file is differed by region. It will still return iframe to google.com if the region is not china, while if you request from China, it will return iframe direct to recaptcha.net. In the other hand, https://www.google.com/recaptcha/api.js will not do this trick.

But do not use that service unless you have to.

Last updated