Giter VIP home page Giter VIP logo

wcaptcha-api's Introduction

wcaptcha-api

Backend API of wCaptcha

中文说明点此

Private Deployment

wCaptcha provides official services, so if you don't want to deploy it yourself, you can go directly to using official services.

If you want to deploy privately, follow the steps below.

General Deployment

Before installing, make sure you have go installed

Build from source

git clone https://github.com/wcaptcha/wcaptcha-api
cd wcaptcha-api
go build

You can also download the pre-compiled binaries at the Release page

Next, create a configuration file named .env, you can just cp .env.example .env then edit it.

Once the configuration is set, you can start the service.

./wcaptcha

Now let's create a site.

curl -X POST localhost:8090/site/create

The result is returned in JSON format, containing api_key and api_secret, which is the key of your site.

To modify the difficulty (aka client proofing time), you can execute.

curl -X POST localhost:8090/site/update --data "api_secret=YOUR_API_SECRET&hardness=HARDNESS

Where HARDNESS is a number, the default HARDNESS for a site is 4194303 (2^22-1), you can set any number.

Docker Deployment

docker pull wcaptcha/wcaptcha-api
docker run -p 8090:8090 -v /data:/data wcaptcha/wcaptcha-api

When using docker deployment, the default STORAGE is file. This is configurable via environment variables. See .env.example for available environment variables.

Deploy to Vercel

You can also deploy the service to vercel. Please be noticed file storage is not available while deploying to vercel, because vercel is a serverless and the filesystem is not persist.

First install the vercel cli tool,

npm i -g vercel

Then run:

cp .env .env.production
./vercel-deploy.sh

then follow the instructions to finish deployment.

Set wcaptcha-js To Use Private Deployed Service

w = new wcaptcha(API_KEY)
w.setEndpoint("https://your-deployed-service.com/")

// Then use wcaptcha as usual
// w.bind("any-selector")

wcaptcha-api's People

Contributors

cf-pages avatar greensea avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.