mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Updated the Cloudflare R2 setup instructions in `content/upload-content.md` to include `POST` and `HEAD` in the `AllowedMethods` CORS configuration. This is necessary for multipart uploads (which use POST) and verification checks (which use HEAD) to function correctly.
2.6 KiB
2.6 KiB
How to Upload Content
bitvid is a decentralized platform, but for larger video files, we currently support Cloudflare R2 as a storage backend. This allows you to upload files directly from your browser to a high-performance, affordable storage bucket.
Prerequisites
- A Cloudflare Account (free to create).
- An activated R2 Plan (there is a generous free tier, but you may need to add a payment method).
Step-by-Step Guide
1. Create a Bucket & Enable Public Access
- Log in to your Cloudflare Dashboard.
- Navigate to R2 in the sidebar.
- Click "Create Bucket".
- Give it a name (e.g.,
my-bitvid-videos) and click "Create Bucket". - Go to the Settings tab of your new bucket.
- Scroll down to "Public Access" and click "Enable" under "R2.dev subdomain".
- Copy the Public Bucket URL (it looks like
https://pub-xxxxxx.r2.dev). You will need this later.
2. Configure CORS
To allow your browser to upload files directly to Cloudflare, you must allow Cross-Origin Resource Sharing (CORS).
- Still in your bucket's Settings tab, scroll down to "CORS Policy".
- Click "Add CORS Policy" (or Edit).
- Paste the following JSON configuration:
[
{
"AllowedOrigins": ["*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
"AllowedHeaders": ["*"],
"ExposeHeaders": ["ETag", "Content-Length", "Content-Range", "Accept-Ranges"],
"MaxAgeSeconds": 3600
}
]
Note: You can replace
"*"inAllowedOriginswith your specific domain (e.g.,["https://bitvid.network"]) for tighter security, but"*"is easiest for getting started.
- Click "Save".
3. Create an API Token
- Go back to the R2 Overview page.
- Click "Manage R2 API Tokens" (right sidebar).
- Click "Create API Token".
- Configure the token:
- Token name: e.g., "bitvid-upload".
- Permissions: Select "Object Read & Write". This is the minimal permission needed to upload and delete files.
- Specific Bucket(s): Select the bucket you created in Step 1.
- TTL: "Forever".
- Click "Create API Token".
4. Configure bitvid
- Copy the Access Key ID, Secret Access Key, and your Account ID (found on the R2 Overview page).
- Return to the Upload Video modal in bitvid.
- Click "Configure R2 Storage".
- Enter your:
- Account ID
- Access Key ID
- Secret Access Key
- Public Bucket URL (from Step 1)
- Click "Verify & Save".
bitvid will verify your credentials by uploading a small test file. Once verified, you are ready to upload!