Skip to content

Commit

Permalink
Merge pull request #17 from FriendlyCaptcha/consolidated
Browse files Browse the repository at this point in the history
Create a consolidated docs site that incorporates the v1 docs into the v2 site
  • Loading branch information
greenberga authored Sep 27, 2024
2 parents 0be08ed + 5eeef5c commit bcc98c4
Show file tree
Hide file tree
Showing 66 changed files with 4,118 additions and 2,017 deletions.
9 changes: 2 additions & 7 deletions blog/2023-06-01-announcing-the-v2-beta/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,5 @@ We aim for all organizations to eventually upgrade to version 2, but we are also

## Further reading

* [Migration guide from v1 to v2](/docs/guides/upgrading-to-v2/introduction)
* [Why upgrade to v2?](/docs/guides/upgrading-to-v2/why-upgrade)





* [Migration guide from v1 to v2](/docs/v2/guides/upgrading-from-v1)
* [Why upgrade to v2?](/docs/v2/versions#whats-new-in-v2)
8 changes: 0 additions & 8 deletions docs/api/_category_.json

This file was deleted.

4 changes: 0 additions & 4 deletions docs/api/authentication.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 2
---

# Authentication

To make requests to the Friendly Captcha API you need to prove who you are. You do this by passing an API key in a header.
Expand Down
8 changes: 0 additions & 8 deletions docs/api/endpoints/_category_.json

This file was deleted.

9 changes: 2 additions & 7 deletions docs/api/overview.md → docs/api/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
---
sidebar_position: 1
---

# Overview

# Server-side Validation

## [**Authentication**](./authentication.md)
[Authentication](./authentication.md) is how you prove to our servers that it's you making the request. You generally use API keys for that.

## Endpoints

### [`/api/v2/captcha/siteverify`](./endpoints/siteverify.md)
### [`/api/v2/captcha/siteverify`](./siteverify.md)
The **Siteverify** endpoint is used to verify the captcha responses you receive from your users.
8 changes: 2 additions & 6 deletions docs/api/endpoints/siteverify.md → docs/api/siteverify.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 0
---

# `/api/v2/captcha/siteverify`

The siteverify endpoint is used to verify captcha responses. A captcha response is the value that is embedded in your form by the captcha widget when the challenge has been completed.
Expand All @@ -16,7 +12,7 @@ Make a **POST** request to `https://global.frcapi.com/api/v2/captcha/siteverify`
| `sitekey` | `string` | **Optional:** the sitekey that you want to make sure the puzzle was generated from. |

:::tip
Remember to authenticate the request [using the `X-API-Key` header](../authentication).
Remember to authenticate the request [using the `X-API-Key` header](./authentication).
:::

You can pass these parameters in a JSON body, or as formdata.
Expand Down Expand Up @@ -92,4 +88,4 @@ It is better to temporarily accept bots or spam than to reject all requests. *Do
If you are seeing an error that includes `method_not_allowed`, you are likely making a HTTP **GET** request. You can fix this by making a HTTP **POST** request instead.

### How do I use automated testing with Friendly Captcha?
You can mock out the siteverify response. Instead of talking to our API, your code could always return `{success: true}`. [This documentation page](../../sdk/advanced/automated-testing) has more details and alternative techniques.
You can mock out the siteverify response. Instead of talking to our API, your code could always return `{success: true}`. [This documentation page](../guides/automated-testing) has more details and alternative techniques.
7 changes: 0 additions & 7 deletions docs/changelog.md

This file was deleted.

10 changes: 0 additions & 10 deletions docs/getting-started/_category_.json

This file was deleted.

13 changes: 0 additions & 13 deletions docs/getting-started/client.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
---
sidebar_position: 1
---

# Introduction
# Getting Started

Friendly Captcha is a service that protects your websites and applications from automated abuse.

This guide shows you how to add our widget to your website to fight spam with little impact to your user's experience.

**Integration usually takes around than 10 minutes to complete.**
**Integration has 3 steps and usually takes around 10 minutes to complete.**

## Create an account

To add Friendly Captcha to your website you will need to [**sign up for an account at Friendly Captcha**](https://friendlycaptcha.com/signup).

:::tip Try before you commit
We offer a free 30-day trial, _no credit card required_.
:::
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
sidebar_position: 2
---
# Installing the widget
# Install the widget

## Option A: HTML Scripts

Expand Down Expand Up @@ -43,7 +40,7 @@ You can customize the widget's behavior by using [HTML attributes](../sdk/config
::::
### Next steps

The next step is to [**verify the captcha response**](./siteverify.md) in your backend server code.
The next step is to [**verify the captcha response**](./verify.md) in your backend server code.


## Option B: Programmatically (Javascript SDK)
Expand Down Expand Up @@ -88,5 +85,4 @@ You can customize the widget's behavior and integrate with it using the SDK. See

### Next steps

The next step is to [**verify the captcha response**](./siteverify.md) embedded in the request to your backend server.

The next step is to [**verify the captcha response**](./verify.md) embedded in the request to your backend server.
13 changes: 13 additions & 0 deletions docs/getting-started/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Create a sitekey

Log in to your Friendly Captcha account and head to the [Applications](https://app.friendlycaptcha.eu/dashboard/accounts/-/apps) page.

Click **Create New Application** and enter the necessary details.

After you've created the application, take note of the **sitekey** value under the application name—we'll need it in the next step.

:::tip Did you know?

A sitekey always starts with the characters `FC`.

:::
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 3
---

# Verify the response

When the captcha challenge is completed by the user, the user's browser receives a piece of text that proves that they completed the challenge. This proof is called the **response**.
Expand Down Expand Up @@ -106,4 +102,4 @@ It is better to temporarily accept bots or spam than to reject all requests. *Do
:::

## API Reference
For more thorough docs, please see the [API Reference](../api/overview.md).
For more thorough docs, please see the [API Reference](../api/index.md).
6 changes: 0 additions & 6 deletions docs/guides/_category_.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 4
---

# Automated Testing

Testing can be at odds with a captcha you add to your website or app. Perhaps you use automated testing tools like [Cypress](https://www.cypress.io/), [Selenium](https://www.selenium.dev/), or [Puppeteer](https://github.com/puppeteer/puppeteer).
Expand All @@ -11,7 +7,7 @@ This page has some tips and approaches that will help work out a testing story f
## Testing tips

### Mocking out the API
The easiest and recommended approach is to mock out the API in the backend. Instead of calling our [siteverify API](../../api/endpoints/siteverify) and getting the JSON response, you instead always use `{success: true}` when running in test mode.
The easiest and recommended approach is to mock out the API in the backend. Instead of calling our [siteverify API](../api/siteverify) and getting the JSON response, you instead always use `{success: true}` when running in test mode.

With this approach you can keep all other code in your application the same.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
sidebar_position: 4
---

# Browser support
# Browser Support

All modern browsers are supported, on both mobile and desktop, all releases up to at least 8 years old.

Expand Down
4 changes: 0 additions & 4 deletions docs/sdk/advanced/csp.md → docs/guides/csp.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 100
---

# Content Security Policy (CSP)

Content Security Policy is a way to secure your website from cross-site scripting (XSS).
Expand Down
8 changes: 7 additions & 1 deletion docs/guides/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Guides

## Advanced

* [Widget Language](./localization.md)
* [Browser Support](./browser-support)
* [Automated testing](./automated-testing)
* [Content Security Policy](./csp)

## Migration Guides

* [Switch from Google reCAPTCHA](./migrating-from-recaptcha.md) to Friendly Captcha.
* [Switch from hCaptcha](./migrating-from-hcaptcha.md) to Friendly Captcha.

## Upgrading from v1 to v2
* [Upgrade from Friendly Captcha v1 to v2](./upgrading-to-v2/introduction.md)
* [Upgrade from Friendly Captcha v1 to v2](./upgrading-from-v1/index.md)
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 30
---

# Language Detection

If your website is in German it makes sense to have the widget in German too.
Expand Down Expand Up @@ -36,7 +32,7 @@ To force a specific language you can set the `lang` attribute on the HTML elemen
<div class="frc-captcha" lang="de" data-sitekey="<my sitekey>"></div>
```

If you are creating widgets programmatically you can use the `language` field in the [configuration object](../reference/sdk.createwidgetoptions.md).
If you are creating widgets programmatically you can use the `language` field in the [configuration object](../sdk/reference/sdk.createwidgetoptions.md).

## Language Codes

Expand Down
8 changes: 2 additions & 6 deletions docs/guides/migrating-from-hcaptcha.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 7
---

# Migrating from hCaptcha

Switching from [hCaptcha](https://www.hcaptcha.com/) to Friendly Captcha is straightforward.
Expand All @@ -22,7 +18,7 @@ Log in to the [Friendly Captcha Dashboard](https://app.friendlycaptcha.eu/dashbo
2. [Create a new API key](https://app.friendlycaptcha.eu/dashboard/accounts/-/apikeys) and copy it somewhere safe.

:::tip
If you are using a CMS like Wordpress, you probably don't have to do the below steps.
If you are using a CMS like WordPress, you probably don't have to do the below steps.

Instead you would replace the hCaptcha plugin and install a plugin that supports Friendly Captcha.
:::
Expand Down Expand Up @@ -58,7 +54,7 @@ Instead you would replace the hCaptcha plugin and install a plugin that supports

## Update your server's integration

Follow the guide [here](../getting-started/siteverify) to set up your server's integration.
Follow the guide [here](../getting-started/verify) to set up your server's integration.

## Compatibility notes (only relevant for advanced usage)

Expand Down
8 changes: 2 additions & 6 deletions docs/guides/migrating-from-recaptcha.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 6
---

# Migrating from reCAPTCHA

Switching from [Google's reCAPTCHA (v2)](https://www.google.com/recaptcha/about/) to Friendly Captcha is straightforward.
Expand All @@ -22,7 +18,7 @@ Log in to the [Friendly Captcha Dashboard](https://app.friendlycaptcha.eu/dashbo
2. [Create a new API key](https://app.friendlycaptcha.eu/dashboard/accounts/-/apikeys) and copy it somewhere safe.

:::tip
If you are using a CMS like Wordpress, you probably don't have to do the below steps.
If you are using a CMS like WordPress, you probably don't have to do the below steps.

Instead you would replace the reCAPTCHA plugin and install a plugin that supports Friendly Captcha.
:::
Expand Down Expand Up @@ -56,7 +52,7 @@ Instead you would replace the reCAPTCHA plugin and install a plugin that support

## Update your server's integration

Follow the guide [here](../getting-started/siteverify) to set up your server's integration.
Follow the guide [here](../getting-started/verify) to set up your server's integration.

## Compatibility notes (only relevant for advanced usage)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
sidebar_position: 4
---

# Backend Integration

## 1. Change the field name in your forms
Expand Down Expand Up @@ -55,6 +51,4 @@ The most notable change is that in v2 the `errors` array is removed, and replace
}
}
```
For possible values of `error_code`, see the [documentation page](../../api/endpoints/siteverify). The status codes are unchanged.


For possible values of `error_code`, see the [documentation page](../../api/siteverify). The status codes are unchanged.
27 changes: 27 additions & 0 deletions docs/guides/upgrading-from-v1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Upgrading from v1 to v2

This guide describes how to upgrade from v1 to v2 of Friendly Captcha.

To learn more about the ways v2 improves upon v1, and why upgrading is worth the effort, [**click here**](/docs/v2/versions#whats-new-in-v2).

## Changes to your website (front-end changes)

### Script tag installation

If you installed Friendly Captcha to your website by adding a `<script>` tag, follow [this guide](./script).

### Programmatic JavaScript API

If you are using the Javascript API to programmatically create widgets, please follow [this guide](./javascript-api).

:::tip

If you are using a [plugin or library](/integrations) that adds Friendly Captcha to your framework or CMS, usually you only have to update your plugin.

We are working on bringing v2 support to all popular languages and frameworks.

:::

## Back-end changes

You will also need to make small changes to your back-end code. These are described in [this guide](./backend-integration).
Loading

0 comments on commit bcc98c4

Please sign in to comment.