atproto explorer

fix handle resolution

handle.invalid 2e07016d f8898e18

verified
+8 -14
+1 -1
src/components/navbar.tsx
··· 43 didDocCache[props.params.repo]?.alsoKnownAs 44 ?.filter((alias) => alias.startsWith("at://"))[0] 45 .split("at://")[1] ?? props.params.repo; 46 - if (hdl !== handle()) { 47 setValidHandle(undefined); 48 setHandle(hdl); 49 setValidHandle(await validateHandle(hdl as Handle, props.params.repo as Did));
··· 43 didDocCache[props.params.repo]?.alsoKnownAs 44 ?.filter((alias) => alias.startsWith("at://"))[0] 45 .split("at://")[1] ?? props.params.repo; 46 + if (hdl !== handle() || validHandle() === undefined) { 47 setValidHandle(undefined); 48 setHandle(hdl); 49 setValidHandle(await validateHandle(hdl as Handle, props.params.repo as Did));
+6 -11
src/utils/api.ts
··· 12 DohJsonHandleResolver, 13 PlcDidDocumentResolver, 14 WellKnownHandleResolver, 15 - XrpcHandleResolver, 16 } from "@atcute/identity-resolver"; 17 import { Did, Handle } from "@atcute/lexicons"; 18 import { isHandle } from "@atcute/lexicons/syntax"; ··· 28 }, 29 }); 30 31 - const handleResolver = new XrpcHandleResolver({ 32 - serviceUrl: "https://public.api.bsky.app", 33 }); 34 35 const didPDSCache: Record<string, string> = {}; ··· 76 77 const validateHandle = async (handle: Handle, did: Did) => { 78 if (!isHandle(handle)) return false; 79 - 80 - const handleResolver = new CompositeHandleResolver({ 81 - strategy: "dns-first", 82 - methods: { 83 - dns: new DohJsonHandleResolver({ dohUrl: "https://dns.google/resolve?" }), 84 - http: new WellKnownHandleResolver(), 85 - }, 86 - }); 87 88 let resolvedDid: string; 89 try {
··· 12 DohJsonHandleResolver, 13 PlcDidDocumentResolver, 14 WellKnownHandleResolver, 15 } from "@atcute/identity-resolver"; 16 import { Did, Handle } from "@atcute/lexicons"; 17 import { isHandle } from "@atcute/lexicons/syntax"; ··· 27 }, 28 }); 29 30 + const handleResolver = new CompositeHandleResolver({ 31 + strategy: "dns-first", 32 + methods: { 33 + dns: new DohJsonHandleResolver({ dohUrl: "https://dns.google/resolve?" }), 34 + http: new WellKnownHandleResolver(), 35 + }, 36 }); 37 38 const didPDSCache: Record<string, string> = {}; ··· 79 80 const validateHandle = async (handle: Handle, did: Did) => { 81 if (!isHandle(handle)) return false; 82 83 let resolvedDid: string; 84 try {
+1 -2
src/views/repo.tsx
··· 8 } from "@atcute/did-plc"; 9 import { DidDocument } from "@atcute/identity"; 10 import { ActorIdentifier, Handle } from "@atcute/lexicons"; 11 - import { resolveHandle } from "@atcute/oauth-browser-client"; 12 import { A, useLocation, useNavigate, useParams } from "@solidjs/router"; 13 import { createResource, createSignal, ErrorBoundary, For, Show, Suspense } from "solid-js"; 14 import { Backlinks } from "../components/backlinks.jsx"; 15 import { Button } from "../components/button.jsx"; 16 import { TextInput } from "../components/text-input.jsx"; 17 import Tooltip from "../components/tooltip.jsx"; 18 - import { didDocCache, resolvePDS } from "../utils/api.js"; 19 import { localDateFromTimestamp } from "../utils/date.js"; 20 import { createOperationHistory, DiffEntry, groupBy } from "../utils/plc-logs.js"; 21 import { BlobView } from "./blob.jsx";
··· 8 } from "@atcute/did-plc"; 9 import { DidDocument } from "@atcute/identity"; 10 import { ActorIdentifier, Handle } from "@atcute/lexicons"; 11 import { A, useLocation, useNavigate, useParams } from "@solidjs/router"; 12 import { createResource, createSignal, ErrorBoundary, For, Show, Suspense } from "solid-js"; 13 import { Backlinks } from "../components/backlinks.jsx"; 14 import { Button } from "../components/button.jsx"; 15 import { TextInput } from "../components/text-input.jsx"; 16 import Tooltip from "../components/tooltip.jsx"; 17 + import { didDocCache, resolveHandle, resolvePDS } from "../utils/api.js"; 18 import { localDateFromTimestamp } from "../utils/date.js"; 19 import { createOperationHistory, DiffEntry, groupBy } from "../utils/plc-logs.js"; 20 import { BlobView } from "./blob.jsx";