forked from pdsls.dev/pdsls
atproto explorer

Compare changes

Choose any two refs to compare.

Changed files
+12 -10
src
components
utils
+2 -2
src/components/search.tsx
··· 2 2 import { A, useLocation, useNavigate } from "@solidjs/router"; 3 3 import { createResource, createSignal, For, onCleanup, onMount, Show } from "solid-js"; 4 4 import { isTouchDevice } from "../layout"; 5 - import { appHandleLink, appList, AppUrl } from "../utils/app-urls"; 5 + import { appHandleLink, appList } from "../utils/app-urls"; 6 6 import { createDebouncedValue } from "../utils/hooks/debounced"; 7 7 8 8 export const [showSearch, setShowSearch] = createSignal(false); ··· 78 78 if (!(host in appList)) { 79 79 navigate(`/${input.replace("https://", "").replace("http://", "").replace("/", "")}`); 80 80 } else { 81 - const app = appList[host as AppUrl]; 81 + const app = appList[host as keyof typeof appList]; 82 82 const path = input.slice(hostLength + 1).split("/"); 83 83 84 84 const uri = appHandleLink[app](path);
+10 -8
src/utils/app-urls.ts
··· 1 1 export type AppUrl = `${string}.${string}` | `localhost:${number}`; 2 + type AppUrlObject = Record<AppUrl, App>; 3 + type AppHandleLinkObject = Record<App, (url: string[]) => string>; 2 4 3 5 export enum App { 4 - Bluesky, 5 - Tangled, 6 - Whitewind, 7 - Frontpage, 8 - Pinksea, 9 - Linkat, 6 + Bluesky = 0, 7 + Tangled = 1, 8 + Whitewind = 2, 9 + Frontpage = 3, 10 + Pinksea = 4, 11 + Linkat = 5, 10 12 } 11 13 12 - export const appList: Record<AppUrl, App> = { 14 + export const appList: AppUrlObject = { 13 15 "localhost:19006": App.Bluesky, 14 16 "blacksky.community": App.Bluesky, 15 17 "bsky.app": App.Bluesky, ··· 26 28 "linkat.blue": App.Linkat, 27 29 }; 28 30 29 - export const appHandleLink: Record<App, (url: string[]) => string> = { 31 + export const appHandleLink: AppHandleLinkObject = { 30 32 [App.Bluesky]: (path) => { 31 33 const baseType = path[0]; 32 34 const user = path[1];