diff --git a/domain.sh b/domain.sh new file mode 100644 index 0000000..1c30124 --- /dev/null +++ b/domain.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Domain Check +# @raycast.mode silent + +# Optional parameters: +# @raycast.icon 🌐 +# @raycast.argument1 { "type": "text", "placeholder": "example.com" } +# @raycast.packageName Bolt + +# Documentation: +# @raycast.description Check WHOIS, DNS, nameservers, and Bolt hosting status for a domain. +# @raycast.author Jorn + +# --- Config --- +LOOKUP_URL="https://domain-lookup-bolt.jorn-968.workers.dev" + +# --- Clean the input --- +DOMAIN="$1" + +# Strip protocol, www., paths, query strings, trailing slashes, and whitespace +DOMAIN=$(echo "$DOMAIN" \ + | tr -d '[:space:]' \ + | sed -E 's|^https?://||' \ + | sed -E 's|^www\.||' \ + | sed -E 's|/.*$||' \ + | sed -E 's|\?.*$||' \ + | tr '[:upper:]' '[:lower:]') + +if [ -z "$DOMAIN" ]; then + echo "No domain provided." + exit 1 +fi + +# URL-encode the domain (safe characters only - domains rarely need encoding) +ENCODED_DOMAIN=$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$DOMAIN" 2>/dev/null || echo "$DOMAIN") + +open "${LOOKUP_URL}/?domain=${ENCODED_DOMAIN}"