obs-r2-uploader/ADMIN_QUICKSTART.md

2.7 KiB

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

./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

python3 scripts/build-worker.py

This embeds the admin interface into your Cloudflare Worker.

3. Update Wrangler Config

cd worker
cp wrangler-enhanced.toml wrangler.toml

Verify the KV namespace ID is correct in wrangler.toml:

[[kv_namespaces]]
binding = "VIDEO_METADATA"
id = "abc123..."  # Should be filled in automatically

4. Deploy

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:

cd worker
wrangler secret put ADMIN_PASSWORD

KV Namespace Not Found

List your namespaces:

wrangler kv:namespace list

Update the ID in wrangler.toml.

Admin Panel Shows Placeholder

The admin HTML wasn't embedded. Run:

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


Need Help?

  • Check ADMIN.md for detailed docs
  • Review SETUP.md for configuration
  • Run wrangler tail to see worker logs