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