#!/bin/bash # Reset Rate Limit - Utility Script # Helps reset rate limits during testing echo "================================================" echo "Rate Limit Reset Utility" echo "================================================" echo "" echo "This script helps you reset rate limits for testing." echo "" echo "Options:" echo "1. Reset for 'unknown-ip' (default dev identifier)" echo "2. Reset for specific IP address" echo "3. Reset ALL rate limits (use with caution)" echo "4. Show current rate limit records" echo "" read -p "Select option (1-4): " option case $option in 1) echo "" echo "SQL to run in Supabase SQL Editor:" echo "https://app.supabase.com/project/mxadgucxhmstlzsbgmoz/sql" echo "" echo "DELETE FROM rate_limits WHERE identifier = 'unknown-ip';" echo "" echo "After running this query, rate limits will reset for the dev environment." ;; 2) echo "" read -p "Enter IP address to reset: " ip_address echo "" echo "SQL to run in Supabase SQL Editor:" echo "https://app.supabase.com/project/mxadgucxhmstlzsbgmoz/sql" echo "" echo "DELETE FROM rate_limits WHERE identifier = '$ip_address';" echo "" ;; 3) echo "" echo "⚠️ WARNING: This will reset ALL rate limits!" read -p "Are you sure? (yes/no): " confirm if [ "$confirm" = "yes" ]; then echo "" echo "SQL to run in Supabase SQL Editor:" echo "https://app.supabase.com/project/mxadgucxhmstlzsbgmoz/sql" echo "" echo "TRUNCATE TABLE rate_limits;" echo "" else echo "Cancelled." fi ;; 4) echo "" echo "SQL to run in Supabase SQL Editor:" echo "https://app.supabase.com/project/mxadgucxhmstlzsbgmoz/sql" echo "" echo "SELECT * FROM rate_limits ORDER BY window_start DESC;" echo "" echo "This will show all current rate limit records." ;; *) echo "Invalid option." exit 1 ;; esac echo "" echo "Note: Rate limits can also naturally expire after 1 hour."