tangled
alpha
login
or
join now
partially.dead.aylac.top
/
pdsls
forked from
pds.ls/pdsls
0
fork
atom
atproto explorer
0
fork
atom
overview
issues
pulls
pipelines
support more bsky clients than just bsky.app
partially.dead.aylac.top
5 months ago
329eced3
4dde7b1f
verified
This commit was signed with the committer's
known signature
.
partially.dead.aylac.top
SSH Key Fingerprint:
SHA256:0I0RwJANCpgZd/yP0LOSXWEd0lfj1yyKsKISzeJAJ78=
+30
-13
2 changed files
expand all
collapse all
unified
split
src
components
search.tsx
utils
bsky-clients.ts
+16
-13
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
5
+
import { BskyClient, bskyClients } from "../utils/bsky-clients";
5
6
import { createDebouncedValue } from "../utils/hooks/debounced";
6
7
7
8
export const [showSearch, setShowSearch] = createSignal(false);
···
68
69
setShowSearch(false);
69
70
if (input === "me" && localStorage.getItem("lastSignedIn") !== null) {
70
71
navigate(`/at://${localStorage.getItem("lastSignedIn")}`);
71
71
-
} else if (
72
72
-
!input.startsWith("https://bsky.app/") &&
73
73
-
(input.startsWith("https://") || input.startsWith("http://"))
74
74
-
) {
75
75
-
navigate(`/${input.replace("https://", "").replace("http://", "").replace("/", "")}`);
76
72
} else if (search()?.length) {
77
73
navigate(`/at://${search()![0].did}`);
74
74
+
} else if (input.startsWith("https://") || input.startsWith("http://")) {
75
75
+
const host = input.slice(0, input.indexOf("/profile/", 8)) as BskyClient;
76
76
+
if (!bskyClients.has(host)) {
77
77
+
navigate(`/${input.replace("https://", "").replace("http://", "").replace("/", "")}`);
78
78
+
} else {
79
79
+
const uri = input
80
80
+
.replace("at://", "")
81
81
+
.replace(`${host}/profile/`, "")
82
82
+
.replace("/post/", "/app.bsky.feed.post/");
83
83
+
const uriParts = uri.split("/");
84
84
+
navigate(
85
85
+
`/at://${uriParts[0]}${uriParts.length > 1 ? `/${uriParts.slice(1).join("/")}` : ""}`,
86
86
+
);
87
87
+
}
78
88
} else {
79
79
-
const uri = input
80
80
-
.replace("at://", "")
81
81
-
.replace("https://bsky.app/profile/", "")
82
82
-
.replace("/post/", "/app.bsky.feed.post/");
83
83
-
const uriParts = uri.split("/");
84
84
-
navigate(
85
85
-
`/at://${uriParts[0]}${uriParts.length > 1 ? `/${uriParts.slice(1).join("/")}` : ""}`,
86
86
-
);
89
89
+
navigate(`/${input}`);
87
90
}
88
91
setShowSearch(false);
89
92
};
+14
src/utils/bsky-clients.ts
···
1
1
+
export type BskyClient = `${"http" | "https"}://${string}`;
2
2
+
type BskyClientSet = Set<BskyClient>;
3
3
+
4
4
+
export const bskyClients: BskyClientSet = new Set<BskyClient>([
5
5
+
"http://localhost:19006",
6
6
+
"https://blacksky.community",
7
7
+
"https://bsky.app",
8
8
+
"https://catsky.social",
9
9
+
"https://deer.aylac.top",
10
10
+
"https://deer-social-ayla.pages.dev",
11
11
+
"https://deer.social",
12
12
+
"https://main.bsky.dev",
13
13
+
"https://social.daniela.lol",
14
14
+
]);