Skip to content

Commit 640b70f

Browse files
authored
Merge branch 'main' into manifest-tasks
2 parents 171b336 + 9d35b29 commit 640b70f

40 files changed

+295
-909
lines changed

README.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,38 @@
22

33
[![Netlify Status](https://api.netlify.com/api/v1/badges/c2fe0e49-4596-48e8-8e1a-9cf62d56bca2/deploy-status)](https://app.netlify.com/sites/contentauth/deploys)
44

5-
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator, and deployed
6-
on [Netlify](https://www.netlify.com/).
5+
## Overview
6+
7+
This repo contains the source code and content to generate the <https://opensource.contentauthenticity.org/> website. This site is built using [Docusaurus 2](https://docusaurus.io/), a modern static site generator, and deployed on [Netlify](https://www.netlify.com/).
8+
9+
### Directory structure
10+
11+
The `docs` sub-directory contains documentation content (in markdown or `.mdx` format) in the following sub-directories:
12+
- [`js-sdk/api`](./docs/js-sdk/api): [API documentation](https://opensource.contentauthenticity.org/docs/js-sdk/api/) for the JavaScript library generated from the source code; see [Generating JavaScript API docs](#generating-javascript-sdk-api-docs).
13+
- [`js-sdk`](./docs/js-sdk/): [Other documentation](https://opensource.contentauthenticity.org/docs/js-sdk/getting-started/overview) for the JavaScript library.
14+
(./scripts/generate-api-docs/index.js)
15+
- `includes`: Markdown content imported (transcluded) into other files.
16+
- `manifest`: Content for the [Understanding manifests](https://opensource.contentauthenticity.org/docs/manifest/understanding-manifest) section.
17+
- `static`: Additional assets such as images.
18+
19+
Additionally, the [scripts/fetch-readme.js](./scripts/fetch-readme.js) script dynamically downloads documentation files (sometimes just the `README.md` but often other markdown files, too) from other repos in the SDK. See [Running the fetch script](#running-fetch-script).
20+
21+
This table summarizes the content that this script fetches from other repos.
22+
23+
| Sub-directory | Content fetched from... | Description |
24+
|-----------|-------------------------|-------------|
25+
| `c2pa-c` | [c2pa-c](https://github.com/contentauth/c2pa-c) | C library docs. |
26+
| `c2pa-min` | [c2pa-min](https://github.com/contentauth/c2pa-min) | Minimal Rust example app. |
27+
| `c2pa-node` | [c2pa-node](https://github.com/contentauth/c2pa-node) | Node library docs. |
28+
| `c2pa-node-example` | [c2pa-node-example](https://github.com/contentauth/c2pa-node-example) | Node example app.|
29+
| `c2pa-python` | [c2pa-python](https://github.com/contentauth/c2pa-python) | Python library docs. |
30+
| `c2pa-python example` | [c2pa-python-example](https://github.com/contentauth/c2pa-python-example) | Python example app. |
31+
| `c2pa-service-example` | [c2patool-service-example](https://github.com/contentauth/c2patool-service-example) | C2PA Tool service example app. |
32+
| `c2patool` | [c2pa-rs cli directory](https://github.com/contentauth/c2pa-rs/cli) | C2PA Tool docs. |
33+
| `js-sdk` | [c2pa-js](https://github.com/contentauth/c2pa-js) | JavaScript library docs. |
34+
| `rust-sdk` | [c2pa-rs](https://github.com/contentauth/c2pa-rs) | Rust library docs. |
35+
36+
The [Manifest store reference](https://opensource.contentauthenticity.org/docs/manifest/manifest-ref) is an HTML file generated by the [json-manifest-reference](https://github.com/contentauth/json-manifest-reference) repository and imported manually.
737

838
## Installation
939

@@ -16,7 +46,7 @@ $ npm install
1646

1747
## Local development
1848

19-
**Prerequisite**: To build the site locally, you must first check out the JavaScript library in a sibling directory and build the API docs there. In the parent directory of `opensource.contentauth.org`, enter these commands:
49+
**Prerequisite**: To build the site locally, you must first check out the JavaScript library in a sibling directory and build the API docs there. In the parent directory of the `opensource.contentauth.org` directory, enter these commands:
2050

2151
```
2252
$ git clone [email protected]:contentauth/c2pa-js.git
@@ -34,23 +64,23 @@ This command starts a local development server and opens up a browser window. Mo
3464

3565
### Running fetch script
3666

37-
The `/scripts/fetch-readme.js` script pulls markdown files from other repos (e.g. `c2patool`). To rerun this script for local build, enter this command:
67+
The `/scripts/fetch-readme.js` script pulls markdown files from other repos (e.g. `c2pa-rs`). To rerun this script for local build, enter this command:
3868

3969
```
4070
npm run docs:fetch-readme
4171
```
4272

43-
NOTE: If you added a **new** repo to get .md files from, then you need to manually add the directory, add a `.gitkeep` file to it, and then commit it to Git.
73+
NOTE: If you need to get markdown files from a **new** repo that you added, then you need to manually add the sub-directory, add a `.gitkeep` file to it, and then commit it to this repository.
4474

45-
### Generate JavaScript SDK API docs
75+
### Generating JavaScript SDK API docs
4676

47-
The `/scripts/generate-api-docs/index.js` script generates API docs for the JS SDK. To run this script for local build, enter this command:
77+
The `/scripts/generate-api-docs/index.js` script generates API docs for the JS SDK (assuming you've checked it out in a sibling directory). To run this script for local build, enter this command:
4878

4979
```
5080
npm run docs:generate-api-docs
5181
```
5282

53-
## Build
83+
### Building
5484

5585
```
5686
$ npm run build
@@ -60,8 +90,7 @@ This command generates static content into the `build` directory and can be serv
6090

6191
### Deployment
6292

63-
Deployments are handled automatically by Netlify. Please open up a pull request with any changes and a preview site
64-
should be created automatically so that the preview can be shared before merging.
93+
Deployments are handled automatically by Netlify. Please open up a pull request with any changes and a preview site will be created automatically so you can share what the rendered site will look like before merging.
6594

6695
### Forcing a site rebuild
6796

docs/js-sdk/examples/.gitkeep

Whitespace-only changes.

docs/js-sdk/examples/quickstart/.gitkeep

Whitespace-only changes.

docs/js-sdk/examples/view-manifest/.gitkeep

Whitespace-only changes.

docs/js-sdk/getting-started/overview.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ The JavaScript library uses several modern browser technologies, including:
2525

2626
The JavaScript library is a monorepo containing the following packages intended for client use:
2727

28-
- [**c2pa**](https://opensource.contentauthenticity.org/docs/js-sdk/api/c2pa) is the main package used for loading and verifying manifests. This package runs all of the processing
29-
logic on the client using a [WebAssembly](https://webassembly.org/) module and exposes a [TypeScript](https://www.typescriptlang.org/)-compatible API for easy integration.
28+
- [**c2pa**](https://opensource.contentauthenticity.org/docs/js-sdk/api/c2pa) is the main package used for loading and verifying manifests. This package runs all of the processing logic on the client using a [WebAssembly](https://webassembly.org/) module and exposes a [TypeScript](https://www.typescriptlang.org/)-compatible API for easy integration.
3029
- **c2pa-wc** provides UI components designed with input from the C2PA UX working group. It enables users to get up and running with standard UI patterns quickly and easily in any front-end environment.
3130
- **@contentauth/react** provides a hooks interface for React components to quickly get manifest and thumbnail data in your React app.
3231

@@ -59,7 +58,7 @@ Because of these requirements, **the library is not supported on any version of
5958
![CAI JavaScript library browser support](../../../static/img/caniuse.png)
6059

6160
:::info
62-
This chart is accurate as of June, 2024. For the most up-to-date browser support information, see [caniuse.com](https://caniuse.com/wasm,webworkers,cryptography,typedarrays,fetch).
61+
This chart is accurate as of December, 2024. For the most up-to-date browser support information, see [caniuse.com](https://caniuse.com/wasm,webworkers,cryptography,typedarrays,fetch).
6362
:::
6463

6564
## Debugging
@@ -72,7 +71,7 @@ To view debug messages in the console, use your browser's inspector, go to the C
7271
localStorage.debug = 'c2pa:*';
7372
```
7473

75-
The debuging information includes millisecond timing differences so you can get an idea of how long different events take.
74+
The debugging information includes millisecond timing differences so you can get an idea of how long different events take.
7675

7776
:::note
7877
Debug calls and statements are stripped out of minified production builds to reduce file size.

docs/js-sdk/getting-started/quick-start.mdx

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ title: Quick start
55

66
import Tabs from '@theme/Tabs';
77
import TabItem from '@theme/TabItem';
8-
import Sandbox from '../../../src/components/Sandbox';
98

109
## Prerequisites
1110

@@ -37,19 +36,17 @@ The quickest way to get up and running is to use a CDN such as [jsDelivr](https:
3736
Static assets include the following, as seen in the config passed to [`createC2pa`](../../js-sdk/api/c2pa.createc2pa):
3837

3938
```js
39+
const version = '0.24.2';
4040
{
4141
wasmSrc: `https://cdn.jsdelivr.net/npm/c2pa@${version}/dist/assets/wasm/toolkit_bg.wasm`,
4242
workerSrc: `https://cdn.jsdelivr.net/npm/c2pa@${version}/dist/c2pa.worker.min.js`,
4343
}
4444
```
4545

4646
:::caution
47-
The version numbers provided in the CDN URLs _must_ match in all of the places you reference the
48-
library. To make it easy, use a variable that provides the version as shown in the example.
47+
The version numbers provided in the CDN URLs _must_ be the same in all of the places you reference the library. To make it easy, use a variable that provides the version as shown in the example.
4948
:::
5049

51-
<Sandbox file="/examples/cdn/main.ts" displayType="preview" />
52-
5350
### Using a package manager
5451

5552
You can also bring in the library with a package manager, such as `npm`, `pnpm`, or `yarn`. This way, all of the client side code is hosted with your app and there are no external dependencies. For example, using `npm`:
@@ -71,24 +68,30 @@ Be sure to configure your server to send proper `Content-Type` headers for these
7168

7269
Examples for common build systems are shown below. They are also available in the [c2pa-js-examples repository](https://github.com/contentauth/c2pa-js-examples).
7370

74-
export const ExampleLink = ({ example }) => {
75-
const linkText = `examples/${example}`;
76-
const link = `https://github.com/contentauth/c2pa-js/tree/main/${linkText}`;
77-
return (
78-
<div className="example-link">
79-
An example project is available here: <a href={link}>{linkText}</a>
80-
</div>
81-
);
82-
};
71+
import CodeBlock from '@theme/CodeBlock';
72+
import ViteExample from '!!raw-loader!../examples/quickstart/vite-main.ts';
73+
import RollupExample from '!!raw-loader!../examples/quickstart/rollup-main.ts';
74+
import WebPackExample from '!!raw-loader!../examples/quickstart/webpack-main.ts';
8375

8476
<Tabs lazy>
85-
<TabItem value="vite" label="Vite" default>
86-
<Sandbox file="/examples/quick-start/main.ts" />
87-
</TabItem>
88-
<TabItem value="rollup" label="Rollup">
89-
<Sandbox example="minimal-ts-rollup" file="/src/main.ts" browserPath="/" />
90-
</TabItem>
91-
<TabItem value="webpack" label="Webpack">
92-
<Sandbox example="minimal-ts-webpack" file="/src/main.ts" browserPath="/" />
93-
</TabItem>
77+
<TabItem value="vite" label="Vite" default>
78+
79+
This example is from [c2pa-js-examples/minimal-ts-vite/](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-vite/). To view and execute this example in a live [code sandbox](https://codesandbox.io/docs/learn/legacy-sandboxes/overview), see [Code Sandbox: Vite example](../guides/sandbox-qs-vite.mdx).
80+
81+
<CodeBlock language="ts">{ViteExample}</CodeBlock>
82+
</TabItem>
83+
84+
<TabItem value="rollup" label="Rollup">
85+
86+
This example is from [c2pa-js-examples/minimal-ts-rollup/](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-rollup/). To view and execute this example in a live [code sandbox](https://codesandbox.io/docs/learn/legacy-sandboxes/overview), see [Code Sandbox: Rollup example](../guides/sandbox-qs-rollup.mdx).
87+
88+
<CodeBlock language="ts">{RollupExample}</CodeBlock>
89+
</TabItem>
90+
91+
<TabItem value="webpack" label="Webpack">
92+
93+
This example is from [c2pa-js-examples/minimal-ts-webpack/](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-webpack/). To view and execute this example in a live [code sandbox](https://codesandbox.io/docs/learn/legacy-sandboxes/overview), see [Code Sandbox: Webpack example](../guides/sandbox-qs-webpack.mdx).
94+
95+
<CodeBlock language="ts">{WebPackExample}</CodeBlock>
96+
</TabItem>
9497
</Tabs>

docs/js-sdk/guides/hosting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ examples of configuring popular build systems, see the [Quick start guide](../ge
4242

4343
To host the library yourself, expose the static asset files with the following response headers to avoid errors with some browsers:
4444

45-
- `c2pa/dist/assets/wasm/toolkit_bg.wasm`: Serve with `Content-Type: application/wasm` reponse header.
45+
- `c2pa/dist/assets/wasm/toolkit_bg.wasm`: Serve with `Content-Type: application/wasm` response header.
4646
- `c2pa/dist/c2pa.worker.min.js`: Serve with `Content-Type: text/javascript` response header.
4747

4848
Then pass these URLs to the `createC2pa` function; for example:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: sandbox-rollup
3+
title: 'Code Sandbox: Rollup example'
4+
hide_table_of_contents: true
5+
---
6+
7+
import Sandbox from '../../../src/components/Sandbox';
8+
9+
The source code for this example is in the [c2pa-js-examples repo](https://github.com/contentauth/c2pa-js-examples/tree/main/minimal-ts-rollup).
10+
11+
<Sandbox file="../examples/quickstart/rollup-main.ts" browserPath="/" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: sandbox-vite
3+
title: 'Code Sandbox: Vite example'
4+
hide_table_of_contents: true
5+
---
6+
7+
import Sandbox from '../../../src/components/Sandbox';
8+
9+
The source code for this example is in the [c2pa-js-examples repo](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-vite/).
10+
11+
<Sandbox file="../examples/quickstart/vite-main.ts" browserPath="/" />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: sandbox-webpack
3+
title: 'Code Sandbox: Webpack example'
4+
hide_table_of_contents: true
5+
---
6+
7+
import Sandbox from '../../../src/components/Sandbox';
8+
9+
The source code for this example is in the [c2pa-js-examples repo](https://github.com/contentauth/c2pa-js-examples/tree/main/minimal-ts-webpack).
10+
11+
<Sandbox file="../examples/quickstart/webpack-main.ts" browserPath="/" />

0 commit comments

Comments
 (0)