forked from pdsls.dev/pdsls
atproto explorer

Compare changes

Choose any two refs to compare.

Changed files
+10 -12
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 } from "../utils/app-urls"; 5 + import { appHandleLink, appList, AppUrl } 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 keyof typeof appList]; 81 + const app = appList[host as AppUrl]; 82 82 const path = input.slice(hostLength + 1).split("/"); 83 83 84 84 const uri = appHandleLink[app](path);
+8 -10
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>; 4 2 5 3 export enum App { 6 - Bluesky = 0, 7 - Tangled = 1, 8 - Whitewind = 2, 9 - Frontpage = 3, 10 - Pinksea = 4, 11 - Linkat = 5, 4 + Bluesky, 5 + Tangled, 6 + Whitewind, 7 + Frontpage, 8 + Pinksea, 9 + Linkat, 12 10 } 13 11 14 - export const appList: AppUrlObject = { 12 + export const appList: Record<AppUrl, App> = { 15 13 "localhost:19006": App.Bluesky, 16 14 "blacksky.community": App.Bluesky, 17 15 "bsky.app": App.Bluesky, ··· 28 26 "linkat.blue": App.Linkat, 29 27 }; 30 28 31 - export const appHandleLink: AppHandleLinkObject = { 29 + export const appHandleLink: Record<App, (url: string[]) => string> = { 32 30 [App.Bluesky]: (path) => { 33 31 const baseType = path[0]; 34 32 const user = path[1];