Skip to content

Commit

Permalink
Fix remark warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Sep 15, 2023
1 parent 02cb11d commit b38ca81
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# comomile

**camomile** is a Node.js HTTP proxy to route images through SSL, compatible with unified plugins, to safely embed user content on the web.
**camomile** is a Node.js HTTP proxy to route images through SSL,
compatible with unified plugins, to safely embed user content on the web.

## Contents

Expand All @@ -18,7 +19,6 @@
* [Types](#types)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [Sponsor](#sponsor)
* [Acknowledgments](#acknowledgments)
* [License](#license)

Expand All @@ -27,19 +27,22 @@
A Node.js HTTP proxy to route images through SSL,
integrable in any Node.js server (even a front-end framework like Next.js).

camomile works together with [`rehype-github-image`][], which does the following at build time:
camomile works together with [`rehype-github-image`][],
which does the following at build time:

1. The original URL in the content is parsed.
2. An [HMAC][] signature of the URL is generated.
3. The URL and HMAC are encoded.
4. The encoded URL and HMAC are placed into the expected format, creating the signed URL.
4. The encoded URL and HMAC are placed into the expected format,
creating the signed URL.
5. The signed URL replaces the original image URL.

After your web app serves the content to the user, camomile takes over:

1. The client requests the signed URL from camomile.
2. camomile validates the [HMAC][], decodes the URL, then requests the content from
the origin server and streams it to the client.
2. camomile validates the [HMAC][], decodes the URL,
then requests the content from the origin server
and streams it to the client.

## When should I use this?

Expand Down Expand Up @@ -87,7 +90,8 @@ Creates a new camomile server with options.

#### `options.HMACKey`

The HMAC key to decrypt the URLs and used by [`rehype-github-image`][] (`string`, required).
The HMAC key to decrypt the URLs and used by [`rehype-github-image`][]
(`string`, required).

#### `options.serverName`

Expand All @@ -97,7 +101,8 @@ Name used for the `Via` HTTP header (`string`, default: `'camomile'`).

Limit the maximum size of a resource in bytes (`number`, default: `null`).

The server responds with `404` and `Content-Length exceeded` if the resource is larger than the maximum size.
The server responds with `404` and `Content-Length exceeded`
if the resource is larger than the maximum size.

## Examples

Expand Down Expand Up @@ -218,7 +223,6 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
}
```


## Types

This package is fully typed with [TypeScript][].
Expand Down Expand Up @@ -261,7 +265,7 @@ and maintained image proxy in Go.

[`rehype-github-image`]: https://github.com/rehypejs/rehype-github/tree/main/packages/image

[HMAC]: https://en.wikipedia.org/wiki/HMAC
[hmac]: https://en.wikipedia.org/wiki/HMAC

[`constants`]: https://rehypejs/camomile/tree/main/lib/constants.js

Expand Down

0 comments on commit b38ca81

Please sign in to comment.