Blobber is a simple yet powerful blob management application that allows authorized users to search for and delete blobs from Val Town's blob storage. It features secure authentication via LastLogin and role-based authorization to ensure only designated administrators can access the blob management interface.
What This App Does
Blobber provides a web interface for managing Val Town blob storage with the following features:
🔍 Search Blobs: Search for blobs by key prefix (case-sensitive)
📋 View Blob Metadata: See blob keys, sizes, and metadata in a clean JSON format
🗑️ Bulk Delete: Delete multiple blobs matching a prefix, with confirmation
🔒 Secure Access: Only authorized administrators can access the interface
📊 Real-time Results: See exactly how many blobs match your search criteria
Use Cases
Clean up old or unused blobs from your Val Town storage
Bulk delete blobs that you're using for a site cache
Manage blobs across the Vals in your account
Authentication & Authorization
This app implements a two-layer security model:
1. Authentication (Who are you?)
Provider: LastLogin - A simple, secure authentication service
Method: Google OAuth via LastLogin's LoginWithGoogleButton component
Flow:
Unauthenticated users see a login page with Google sign-in button
LastLogin handles the OAuth flow and returns user email
The app receives the authenticated email via the X-LastLogin-Email header
2. Authorization (What can you do?)
Role-Based Access: Only designated admin emails can access the blob management interface
Admin List: Configured via the ADMIN_EMAILS environment variable
Access Control:
✅ Admin users: Full access to search and delete blobs
❌ Authenticated non-admins: See "Access Denied" page with their email
❌ Unauthenticated users: Redirected to login page
How It Works Technically
LastLogin Wrapper: The entire app is wrapped with lastlogin(handler) which:
Intercepts all requests
Handles the OAuth flow automatically
Adds the X-LastLogin-Email header for authenticated users
Middleware Authentication Check: Every route checks for the email header:
const email = c.req.header("X-LastLogin-Email");
if (!email) {
// Show login page
}
Authorization Validation: After authentication, check if user is an admin:
constisAdmin = (email: string) => ADMIN_EMAILS.includes(email);
if (!isAdmin(email)) {
// Show access denied page
}
Secure Logout: The /auth/logout route clears the LastLogin cookie and redirects home
Environment Variables - Making It Your Own
To remix this Val and make it your own, you need to configure these environment variables:
Required Environment Variables
ADMIN_EMAILS
What it does: Comma-separated list of email addresses that have admin access to the blob management interface.