Files
bitvid/content/docs/guides/upload-content.md
T
google-labs-jules[bot]andPR0M3TH3AN f6e48b3bd6 docs: align upload guides with code and add consistency test
- Updates `content/docs/guides/upload-content.md` and `getting-started.md` to accurately reflect supported file types, S3-compatible storage options, and metadata requirements.
- Clarifies CORS configuration steps for R2 vs. generic S3.
- Adds `tests/docs/verify-upload-claims.test.mjs` to programmatically ensure documentation claims match frontend code attributes.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 03:00:29 +00:00

101 lines
4.4 KiB
Markdown

# How to Upload Content
bitvid is a decentralized platform, but for larger video files, we support **Cloudflare R2** and **S3-compatible** storage backends. This allows you to upload files directly from your browser to a high-performance storage bucket.
## Prerequisites
- A **Cloudflare Account** (free to create) or an **S3-compatible provider**.
- An activated **R2 Plan** (if using Cloudflare).
## Supported Media & Limits
Before you start, ensure your content meets the following requirements:
### Accepted File Types
- **Video:** `.mp4`, `.webm`, `.mov`, `.mkv`, `.ts`, `.m3u8`, `.mpg`, `.mpeg`
- **Thumbnail:** Any standard image format (`image/*`)
### File Size
- **Recommended:** Up to **2GB** per file.
- **Why?** Browser-based uploads rely on your device's memory for hashing and chunk management. Files larger than 2GB may cause browser instability or crashes.
### Metadata
- **Title:** **Required**.
- **Description:** Optional.
- **Thumbnail:** Optional.
- **Tags (Hashtags):** Optional but highly recommended for discoverability.
## Step-by-Step Guide
### 1. Create a Bucket & Enable Public Access
1. Log in to your provider's dashboard (e.g., Cloudflare).
2. Create a new bucket (e.g., `my-bitvid-videos`).
3. **Enable Public Access**:
- **Cloudflare R2**: Go to **Settings** > **Public Access** and enable "R2.dev subdomain" or connect a custom domain.
- **S3 Compatible**: Ensure the bucket policy allows public read access for objects.
4. **Copy the Public Bucket URL** (e.g., `https://pub-xxxxxx.r2.dev`). You will need this later.
### 2. Configure CORS
To allow your browser to upload files directly to the storage bucket, you must allow Cross-Origin Resource Sharing (CORS).
**Cloudflare R2 (Manual Configuration Required):**
1. In your bucket's **Settings** tab, scroll down to **"CORS Policy"**.
2. Click **"Add CORS Policy"** (or Edit).
3. Paste the following JSON configuration. You **must** allow headers used by the AWS SDK (`amz-sdk-*`).
```json
[
{
"AllowedOrigins": ["http://127.0.0.1:5500", "https://bitvid.network"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD", "OPTIONS"],
"AllowedHeaders": ["*"],
"ExposeHeaders": ["ETag", "Content-Length", "Content-Range", "Accept-Ranges"],
"MaxAgeSeconds": 3600
}
]
```
> **Note:** Replace `AllowedOrigins` with your actual development or production origins.
**S3 Compatible Providers:**
bitvid will attempt to configure CORS automatically for generic S3 providers if your credentials have sufficient permissions. However, if uploads fail with CORS errors, apply a similar policy manually in your provider's console.
### 3. Create API Credentials
1. Create an API Token or Access Key pair.
2. **Permissions**: Ensure **"Object Read & Write"** access (or `s3:PutObject`, `s3:DeleteObject`).
3. **Copy the credentials**: You will need the **Access Key ID** and **Secret Access Key**.
### 4. Configure bitvid
1. In bitvid, open your **Profile** (click your avatar).
2. Navigate to the **Storage** tab (or click **"Configure Storage"** in the Upload Modal).
3. Click **"Add Connection"** (or use the default form).
4. Select **Cloudflare R2** or **S3 Compatible**.
5. Enter your credentials:
- **Account ID** (R2 only)
- **Access Key ID**
- **Secret Access Key**
- **Bucket Name**
- **Public Access URL** (The URL from Step 1)
- **Endpoint** (S3 Compatible only)
6. Click **"Save Connection"**.
bitvid will verify your credentials by attempting to list or upload a test file. Once verified, return to the Upload Modal to start sharing!
## Upload Lifecycle & Moderation
### How Uploads Work
1. **Direct Upload**: Your browser uploads the file directly to your storage bucket. No video data passes through a bitvid server.
2. **Client-Side Hashing**: Your browser calculates a cryptographic hash (info hash) of the file to enable WebTorrent support.
3. **Publication**: The video metadata (title, URL, hash, tags) is signed by your Nostr key and published to relays.
### Moderation & Visibility
While publication is decentralized and permissionless, the bitvid.network instance may enforce moderation policies:
- **Whitelists**: If the instance is in "whitelist mode", you may need approval before your videos appear in public feeds.
- **Blacklists**: Violating community guidelines may result in your account being hidden from this instance.
- **User Blocks**: Viewers can mute or block your content individually.
Check the [Community Guidelines](../community/community-guidelines.md) for more details.