diff --git a/src/components/Login.tsx b/src/components/Login.tsx
index 2e340f9..868e0ba 100644
--- a/src/components/Login.tsx
+++ b/src/components/Login.tsx
@@ -161,7 +161,7 @@ const TabButton = ({
onClick={onClick}
className={`px-4 py-2 text-sm font-medium transition-colors rounded-full flex-1 ${
active
- ? "text-gray-950 dark:text-gray-200 border-gray-500 bg-gray-400 dark:bg-gray-500"
+ ? "text-gray-50 dark:text-gray-200 border-gray-500 bg-gray-400 dark:bg-gray-500"
: "text-gray-600 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-200"
}`}
>
diff --git a/src/routes/notifications.tsx b/src/routes/notifications.tsx
index c5d4791..3520ffb 100644
--- a/src/routes/notifications.tsx
+++ b/src/routes/notifications.tsx
@@ -1,7 +1,9 @@
import { createFileRoute } from "@tanstack/react-router";
+import { useAtom } from "jotai";
import React, { useEffect, useRef,useState } from "react";
import { useAuth } from "~/providers/UnifiedAuthProvider";
+import { constellationURLAtom } from "~/utils/atoms";
const HANDLE_DID_CACHE_TIMEOUT = 60 * 60 * 1000; // 1 hour
@@ -70,14 +72,16 @@ function NotificationsComponent() {
}
}
+ const [constellationURL] = useAtom(constellationURLAtom)
+
useEffect(() => {
if (!did) return;
setLoading(true);
setError(null);
const urls = [
- `https://constellation.microcosm.blue/links?target=${encodeURIComponent(did)}&collection=app.bsky.feed.post&path=.facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet%23mention].did`,
- `https://constellation.microcosm.blue/links?target=${encodeURIComponent(did)}&collection=app.bsky.feed.post&path=.facets[].features[app.bsky.richtext.facet%23mention].did`,
- `https://constellation.microcosm.blue/links?target=${encodeURIComponent(did)}&collection=app.bsky.graph.follow&path=.subject`,
+ `https://${constellationURL}/links?target=${encodeURIComponent(did)}&collection=app.bsky.feed.post&path=.facets[app.bsky.richtext.facet].features[app.bsky.richtext.facet%23mention].did`,
+ `https://${constellationURL}/links?target=${encodeURIComponent(did)}&collection=app.bsky.feed.post&path=.facets[].features[app.bsky.richtext.facet%23mention].did`,
+ `https://${constellationURL}/links?target=${encodeURIComponent(did)}&collection=app.bsky.graph.follow&path=.subject`,
];
let ignore = false;
Promise.all(
diff --git a/src/routes/settings.tsx b/src/routes/settings.tsx
index f3f6370..440e742 100644
--- a/src/routes/settings.tsx
+++ b/src/routes/settings.tsx
@@ -1,7 +1,14 @@
import { createFileRoute } from "@tanstack/react-router";
+import { useAtom } from "jotai";
import { Header } from "~/components/Header";
import Login from "~/components/Login";
+import {
+ constellationURLAtom,
+ defaultconstellationURL,
+ defaultslingshotURL,
+ slingshotURLAtom,
+} from "~/utils/atoms";
export const Route = createFileRoute("/settings")({
component: Settings,
@@ -21,6 +28,69 @@ export function Settings() {
}}
/>
+
+
>
);
}
+
+export function TextInputSetting({
+ atom,
+ title,
+ description,
+ init,
+}: {
+ atom: typeof constellationURLAtom;
+ title?: string;
+ description?: string;
+ init?: string;
+}) {
+ const [value, setValue] = useAtom(atom);
+ return (
+
+
+ {title && (
+
+ {title}
+
+ )}
+ {description && (
+
+ {description}
+
+ )}
+
+
+
+ setValue(e.target.value)}
+ className="flex-1 px-3 py-2 rounded-lg bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700
+ text-gray-900 dark:text-gray-100 placeholder:text-gray-500 dark:placeholder:text-gray-400
+ focus:outline-none focus:ring-2 focus:ring-gray-400 dark:focus:ring-gray-600"
+ placeholder="Enter value..."
+ />
+
+
+
+ );
+}
diff --git a/src/utils/atoms.ts b/src/utils/atoms.ts
index da60331..8ea22e9 100644
--- a/src/utils/atoms.ts
+++ b/src/utils/atoms.ts
@@ -21,6 +21,17 @@ export const likedPostsAtom = atomWithStorage>(
{}
);
+export const defaultconstellationURL = 'constellation.microcosm.blue'
+export const constellationURLAtom = atomWithStorage(
+ 'constellationURL',
+ defaultconstellationURL
+)
+export const defaultslingshotURL = 'slingshot.microcosm.blue'
+export const slingshotURLAtom = atomWithStorage(
+ 'slingshotURL',
+ defaultslingshotURL
+)
+
export const isAtTopAtom = atom(true);
type ComposerState =
diff --git a/src/utils/useQuery.ts b/src/utils/useQuery.ts
index 8a6f867..21d950d 100644
--- a/src/utils/useQuery.ts
+++ b/src/utils/useQuery.ts
@@ -7,13 +7,16 @@ import {
useQuery,
type UseQueryResult} from "@tanstack/react-query";
+import { constellationURLAtom, slingshotURLAtom, store } from "./atoms";
+
export function constructIdentityQuery(didorhandle?: string) {
return queryOptions({
queryKey: ["identity", didorhandle],
queryFn: async () => {
if (!didorhandle) return undefined as undefined
+ const slingshoturl = store.get(slingshotURLAtom)
const res = await fetch(
- `https://slingshot.microcosm.blue/xrpc/com.bad-example.identity.resolveMiniDoc?identifier=${encodeURIComponent(didorhandle)}`
+ `https://${slingshoturl}/xrpc/com.bad-example.identity.resolveMiniDoc?identifier=${encodeURIComponent(didorhandle)}`
);
if (!res.ok) throw new Error("Failed to fetch post");
try {
@@ -63,8 +66,9 @@ export function constructPostQuery(uri?: string) {
queryKey: ["post", uri],
queryFn: async () => {
if (!uri) return undefined as undefined
+ const slingshoturl = store.get(slingshotURLAtom)
const res = await fetch(
- `https://slingshot.microcosm.blue/xrpc/com.bad-example.repo.getUriRecord?at_uri=${encodeURIComponent(uri)}`
+ `https://${slingshoturl}/xrpc/com.bad-example.repo.getUriRecord?at_uri=${encodeURIComponent(uri)}`
);
let data: any;
try {
@@ -126,8 +130,9 @@ export function constructProfileQuery(uri?: string) {
queryKey: ["profile", uri],
queryFn: async () => {
if (!uri) return undefined as undefined
+ const slingshoturl = store.get(slingshotURLAtom)
const res = await fetch(
- `https://slingshot.microcosm.blue/xrpc/com.bad-example.repo.getUriRecord?at_uri=${encodeURIComponent(uri)}`
+ `https://${slingshoturl}/xrpc/com.bad-example.repo.getUriRecord?at_uri=${encodeURIComponent(uri)}`
);
let data: any;
try {
@@ -249,8 +254,9 @@ export function constructConstellationQuery(query?:{
const path = query?.path
const cursor = query.cursor
const dids = query?.dids
+ const constellation = store.get(constellationURLAtom);
const res = await fetch(
- `https://constellation.microcosm.blue${method}?target=${encodeURIComponent(target)}${collection ? `&collection=${encodeURIComponent(collection)}` : ""}${path ? `&path=${encodeURIComponent(path)}` : ""}${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ""}${dids ? dids.map((did) => `&did=${encodeURIComponent(did)}`).join("") : ""}`
+ `https://${constellation}${method}?target=${encodeURIComponent(target)}${collection ? `&collection=${encodeURIComponent(collection)}` : ""}${path ? `&path=${encodeURIComponent(path)}` : ""}${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ""}${dids ? dids.map((did) => `&did=${encodeURIComponent(did)}`).join("") : ""}`
);
if (!res.ok) throw new Error("Failed to fetch post");
try {
@@ -450,8 +456,9 @@ export function constructArbitraryQuery(uri?: string) {
queryKey: ["arbitrary", uri],
queryFn: async () => {
if (!uri) return undefined as undefined
+ const slingshoturl = store.get(slingshotURLAtom)
const res = await fetch(
- `https://slingshot.microcosm.blue/xrpc/com.bad-example.repo.getUriRecord?at_uri=${encodeURIComponent(uri)}`
+ `https://${slingshoturl}/xrpc/com.bad-example.repo.getUriRecord?at_uri=${encodeURIComponent(uri)}`
);
let data: any;
try {
@@ -624,7 +631,7 @@ export function yknowIReallyHateThisButWhateverGuardedConstructConstellationInfi
collection: string
path: string
}) {
- const constellationHost = 'constellation.microcosm.blue'
+ const constellationHost = store.get(constellationURLAtom)
console.log(
'yknowIReallyHateThisButWhateverGuardedConstructConstellationInfiniteQueryLinks',
query,