use different fonts for captcha

update packages
This commit is contained in:
HF 2021-08-21 17:08:28 +02:00
parent 2cec2e728f
commit f6d05b46ff
8 changed files with 3639 additions and 3674 deletions

BIN
captchaFonts/Comismsh.ttf Normal file

Binary file not shown.

2
captchaFonts/LICENSE.md Normal file
View File

@ -0,0 +1,2 @@
license: free
website: http://www.moorstation.org/typoasis/designers/gemnew/home.htm

Binary file not shown.

View File

@ -34,6 +34,7 @@ do
echo "---RESTARTING CANVAS---"
cp -r build/*.js "${PFOLDER}/"
cp -r build/public "${PFOLDER}/"
cp -r build/captchaFonts "${PFOLDER}/"
cp -r build/package.json "${PFOLDER}/"
cp -r build/assets.json "${PFOLDER}/"
cp -r build/styleassets.json "${PFOLDER}/"
@ -61,6 +62,7 @@ do
echo "---RESTARTING CANVAS---"
cp -r build/*.js "${DEVFOLDER}/"
cp -r build/public "${DEVFOLDER}/"
cp -r build/captchaFonts "${DEVFOLDER}/"
cp -r build/package.json "${DEVFOLDER}/"
cp -r build/assets.json "${DEVFOLDER}/"
cp -r build/styleassets.json "${DEVFOLDER}/"

7174
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -34,25 +34,25 @@
"bufferutil": "^4.0.3",
"commonmark": "^0.29.3",
"compression": "^1.7.3",
"connect-redis": "^5.1.0",
"connect-redis": "^6.0.0",
"cookie": "^0.4.1",
"core-js": "^3.9.1",
"core-js": "^3.16.2",
"cors": "^2.8.4",
"etag": "^1.8.1",
"express": "^4.15.3",
"express-limiter": "^1.6.0",
"express-session": "^1.17.1",
"express-session": "^1.17.2",
"global": "^4.3.2",
"http-proxy-agent": "^4.0.1",
"image-q": "^2.1.2",
"ip-address": "^7.1.0",
"isomorphic-fetch": "^3.0.0",
"js-file-download": "^0.4.12",
"localforage": "^1.9.0",
"localforage": "^1.10.0",
"morgan": "^1.10.0",
"multer": "^1.4.1",
"mysql2": "^2.2.5",
"nodemailer": "^6.5.0",
"multer": "^1.4.3",
"mysql2": "^2.3.0",
"nodemailer": "^6.6.3",
"passport": "^0.4.0",
"passport-discord": "^0.1.4",
"passport-facebook": "^3.0.0",
@ -60,80 +60,80 @@
"passport-json": "^1.2.0",
"passport-reddit": "^0.2.4",
"passport-vkontakte": "^0.5.0",
"ppfun-captcha": "^1.6.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"ppfun-captcha": "^1.6.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.2.0",
"react-redux": "^7.2.1",
"react-redux": "^7.2.4",
"react-responsive": "^8.2.0",
"react-stay-scrolled": "^7.3.0",
"react-stay-scrolled": "^7.3.1",
"react-toggle-button": "^2.1.0",
"redis": "^3.0.2",
"redis": "^3.1.2",
"redlock": "^4.0.0",
"redux": "^4.0.4",
"redux": "^4.1.1",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.2.0",
"sequelize": "^6.5.1",
"sequelize": "^6.6.5",
"sharp": "^0.27.2",
"startaudiocontext": "^1.2.1",
"three": "^0.125.2",
"three-trackballcontrols": "^0.9.0",
"ttag": "^1.7.24",
"ttag-po-loader": "0.0.2",
"url-search-params-polyfill": "^8.1.0",
"url-search-params-polyfill": "^8.1.1",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.1",
"ws": "^7.4.4"
"winston-daily-rotate-file": "^4.5.5",
"ws": "^7.5.3"
},
"devDependencies": {
"@babel/cli": "^7.14.3",
"@babel/core": "^7.13.10",
"@babel/node": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-decorators": "^7.13.5",
"@babel/plugin-proposal-do-expressions": "^7.12.13",
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-proposal-export-namespace-from": "^7.12.13",
"@babel/plugin-proposal-function-bind": "^7.12.13",
"@babel/plugin-proposal-function-sent": "^7.12.13",
"@babel/plugin-proposal-json-strings": "^7.13.8",
"@babel/plugin-proposal-logical-assignment-operators": "^7.13.8",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
"@babel/plugin-proposal-numeric-separator": "^7.12.13",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/plugin-proposal-optional-chaining": "^7.13.8",
"@babel/plugin-proposal-pipeline-operator": "^7.12.13",
"@babel/plugin-proposal-throw-expressions": "^7.12.13",
"@babel/cli": "^7.14.8",
"@babel/core": "^7.15.0",
"@babel/node": "^7.14.9",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
"@babel/plugin-proposal-do-expressions": "^7.14.5",
"@babel/plugin-proposal-export-default-from": "^7.14.5",
"@babel/plugin-proposal-export-namespace-from": "^7.14.5",
"@babel/plugin-proposal-function-bind": "^7.14.5",
"@babel/plugin-proposal-function-sent": "^7.14.5",
"@babel/plugin-proposal-json-strings": "^7.14.5",
"@babel/plugin-proposal-logical-assignment-operators": "^7.14.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
"@babel/plugin-proposal-numeric-separator": "^7.14.5",
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/plugin-proposal-pipeline-operator": "^7.15.0",
"@babel/plugin-proposal-throw-expressions": "^7.14.5",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-flow-strip-types": "^7.13.0",
"@babel/plugin-transform-react-constant-elements": "^7.13.10",
"@babel/plugin-transform-react-inline-elements": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.14.5",
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
"@babel/plugin-transform-react-inline-elements": "^7.14.5",
"@babel/polyfill": "^7.11.5",
"@babel/preset-env": "^7.13.10",
"@babel/preset-flow": "^7.12.13",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"assets-webpack-plugin": "^7.0.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-flow": "^7.14.5",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"assets-webpack-plugin": "^7.1.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-transform-react-pure-class-to-function": "^1.0.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-ttag": "^1.7.30",
"clean-css": "^5.1.1",
"copy-webpack-plugin": "^8.0.0",
"css-loader": "^5.1.3",
"eslint": "^7.22.0",
"clean-css": "^5.1.5",
"copy-webpack-plugin": "^8.1.1",
"css-loader": "^5.2.7",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-flowtype": "^5.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-flowtype": "^5.9.0",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react": "^7.24.0",
"flow-bin": "^0.143.1",
"generate-package-json-webpack-plugin": "^2.1.2",
"glob": "^7.1.6",
"generate-package-json-webpack-plugin": "^2.1.3",
"glob": "^7.1.7",
"json-loader": "^0.5.4",
"mkdirp": "^1.0.4",
"npm-check": "^5.9.2",
@ -142,11 +142,11 @@
"react-svg-loader": "^3.0.3",
"rimraf": "^3.0.2",
"style-loader": "^2.0.0",
"ttag-cli": "^1.9.1",
"webpack": "^5.26.3",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.5.0",
"webpack-dev-middleware": "^4.1.0",
"ttag-cli": "^1.9.3",
"webpack": "^5.51.1",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^4.8.0",
"webpack-dev-middleware": "^4.3.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-node-externals": "^2.5.2",
"write-file-webpack-plugin": "^4.0.2"

View File

@ -4,6 +4,8 @@
/* eslint-disable no-console */
import path from 'path';
import fs from 'fs';
import process from 'process';
import http from 'http';
import ppfunCaptcha from 'ppfun-captcha';
@ -14,17 +16,24 @@ import { setCaptchaSolution } from './utils/captcha';
const PORT = process.env.PORT || 8080;
const HOST = process.env.HOST || 'localhost';
const font = fs.readdirSync(path.resolve(__dirname, 'captchaFonts'))
.filter((e) => e.endsWith('.ttf'))
.map((e) => ppfunCaptcha.loadFont(
path.resolve(__dirname, 'captchaFonts', e),
));
const server = http.createServer((req, res) => {
const captcha = ppfunCaptcha.create({
width: 500,
height: 300,
fontSize: 220,
fontSize: 180,
stroke: 'black',
fill: 'none',
nodeDeviation: 3.0,
connectionPathDeviation: 3.0,
nodeDeviation: 2.5,
connectionPathDeviation: 10.0,
style: 'stroke-width: 4;',
background: '#EFEFEF',
font,
});
const ip = getIPFromRequest(req);

View File

@ -168,6 +168,10 @@ export default ({
__dirname, 'build', 'ecosystem-backup.yml'
),
},
{
from: path.resolve(__dirname, 'captchaFonts'),
to: path.resolve(__dirname, 'build', 'captchaFonts'),
},
{
from: path.resolve(
__dirname, 'deployment', 'example-ecosystem-captchas.yml'