obs-r2-uploader/ADMIN_QUICKSTART.md

140 lines
2.7 KiB
Markdown

# Admin Panel - Quick Start Guide
Get your admin panel up and running in 5 minutes.
## Prerequisites
✅ Basic system is already set up (R2 bucket, worker deployed)
✅ Wrangler CLI is authenticated
✅ Python 3.8+ installed
## Setup Steps
### 1. Run Admin Setup Script
```bash
./scripts/setup-admin.sh
```
This will:
- Create a KV namespace for video metadata
- Prompt you to set an admin password
- Update configuration automatically
**Set a strong password!** This protects your admin panel.
### 2. Build the Worker
```bash
python3 scripts/build-worker.py
```
This embeds the admin interface into your Cloudflare Worker.
### 3. Update Wrangler Config
```bash
cd worker
cp wrangler-enhanced.toml wrangler.toml
```
Verify the KV namespace ID is correct in `wrangler.toml`:
```toml
[[kv_namespaces]]
binding = "VIDEO_METADATA"
id = "abc123..." # Should be filled in automatically
```
### 4. Deploy
```bash
wrangler deploy
```
### 5. Access Admin Panel
Open: `https://videos.jeffemmett.com/admin`
Login with the password you set in step 1.
## Quick Usage
### Set Video Visibility
1. Find your video in the list
2. Click the dropdown
3. Choose:
- **Private** (🔒): Only you can access
- **Shareable** (🔗): Anyone with link
- **Clip Shareable** (✂️): Only clips are public
### Create a Shareable Clip
1. Click "Create Clip" on any video
2. Enter start time: `1:30` (1 minute 30 seconds)
3. Enter end time: `3:00` (3 minutes)
4. Click "Generate Clip Link"
5. Share the URL!
### Delete a Video
1. Click "Delete" button
2. Confirm deletion
3. Video is permanently removed from R2
## Troubleshooting
### "Unauthorized" Error
Reset your password:
```bash
cd worker
wrangler secret put ADMIN_PASSWORD
```
### KV Namespace Not Found
List your namespaces:
```bash
wrangler kv:namespace list
```
Update the ID in `wrangler.toml`.
### Admin Panel Shows Placeholder
The admin HTML wasn't embedded. Run:
```bash
python3 scripts/build-worker.py
cd worker && wrangler deploy
```
## Default Behavior
- New uploads are **Shareable** by default
- Public gallery shows only **Shareable** videos
- **Private** videos return 403 to non-admin users
- **Clip Shareable** videos require auth for full video
## Security Tips
✅ Use a strong, unique password
✅ Don't share your admin credentials
✅ Review video permissions regularly
✅ Sessions expire after 24 hours
✅ HTTPS-only cookies
## Next Steps
- Read [ADMIN.md](ADMIN.md) for complete documentation
- Learn about [API endpoints](ADMIN.md#api-endpoints)
- Explore [advanced features](ADMIN.md#advanced-usage)
---
**Need Help?**
- Check [ADMIN.md](ADMIN.md) for detailed docs
- Review [SETUP.md](SETUP.md) for configuration
- Run `wrangler tail` to see worker logs