···
const [loading, setLoading] = useState(false);
const [results, setResults] = useState<BenchmarkResult[]>([]);
16
+
const resolveHandle = async (handle: string): Promise<string | null> => {
18
+
const response = await fetch(
19
+
`https://quickdid.smokesignal.tools/xrpc/com.atproto.identity.resolveHandle?handle=${encodeURIComponent(handle)}`
21
+
const data = await response.json();
24
+
toast.error(`Unable to resolve handle: ${data.message || "Invalid handle"}`);
30
+
toast.error("Failed to resolve handle");
31
+
console.error(error);
const handleBenchmark = async () => {
18
-
toast.error("Please enter a DID");
38
+
toast.error("Please enter a DID or handle");
···
26
-
const benchmarkResults = await benchmarkAllMirrors(mirrors, did.trim());
46
+
let resolvedDid = did.trim();
48
+
// If input doesn't start with "did:plc", treat it as a handle
49
+
if (!resolvedDid.startsWith("did:plc")) {
50
+
const resolved = await resolveHandle(resolvedDid);
55
+
resolvedDid = resolved;
56
+
toast.success(`Resolved to ${resolvedDid}`);
59
+
const benchmarkResults = await benchmarkAllMirrors(mirrors, resolvedDid);
setResults(benchmarkResults);
const successCount = benchmarkResults.filter(r => r.status === "success").length;
···
<div className="space-y-4">
<label htmlFor="did-input" className="block text-sm font-medium mb-2">
97
+
ATProto DID or Handle
<div className="flex gap-3">
70
-
placeholder="did:plc:example123..."
103
+
placeholder="did:plc:example123... or handle.bsky.social"
onChange={(e) => setDid(e.target.value)}
onKeyPress={handleKeyPress}
···
<div className="bg-muted/30 border border-border rounded-lg p-6">
<h3 className="font-semibold mb-2">How to use:</h3>
<ol className="list-decimal list-inside space-y-1 text-sm text-muted-foreground">
113
-
<li>Enter an ATProto DID (e.g., did:plc:z72i7hdynmk6r22z27h6tvur)</li>
146
+
<li>Enter an ATProto DID or handle (e.g., did:plc:z72i7hdynmk6r22z27h6tvur or handle.bsky.social)</li>
<li>Click "Run Benchmark" or press Enter</li>
<li>View response times and status for each mirror</li>