#!/bin/sh

    # Change this to your Caddy domain (e.g., "https://x.us.to") when you deploy it
    SERVER_URL="https://itchyballsack.crabdance.com"

    if [ -z "$1" ]; then
        echo "Usage: ./shorten.sh <URL_TO_SHORTEN> [BEARER_TOKEN]"
        echo "Example: ./shorten.sh https://google.com mysecret"
        exit 1
    fi

    TARGET_URL="$1"
    # Uses the second argument as the token, or defaults to "mysecret" if not provided
    TOKEN="${2:-mysecret}"

    # Send the request and print the link
    curl -s -H "Authorization: Bearer $TOKEN" -d "$TARGET_URL" "$SERVER_URL"
