handy online tools for AT Protocol boat.kelinci.net
atproto bluesky atcute typescript solidjs
20
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: move constants to env

Mary a242c58a 55bab911

+17 -4
+2
.env
··· 1 + VITE_PLC_DIRECTORY_URL=https://plc.directory 2 + VITE_APPVIEW_URL=https://public.api.bsky.app
+2 -1
src/api/queries/did-doc.ts
··· 20 20 let rawDoc: any; 21 21 22 22 if (type === 'plc') { 23 - const response = await fetch(`https://plc.directory/${did}`, { signal }); 23 + const origin = import.meta.env.VITE_PLC_DIRECTORY_URL; 24 + const response = await fetch(`${origin}/${did}`, { signal }); 24 25 25 26 if (response.status === 404) { 26 27 throw new Error(`did not found in directory`);
+2 -1
src/api/queries/plc.ts
··· 5 5 import { plcLogEntries } from '../types/plc'; 6 6 7 7 export const getPlcAuditLogs = async ({ did, signal }: { did: At.DID; signal?: AbortSignal }) => { 8 - const response = await fetch(`https://plc.directory/${did}/log/audit`, { signal }); 8 + const origin = import.meta.env.VITE_PLC_DIRECTORY_URL; 9 + const response = await fetch(`${origin}/${did}/log/audit`, { signal }); 9 10 if (!response.ok) { 10 11 throw new Error(`got resposne ${response.status}`); 11 12 }
+2 -2
src/globals/rpc.ts
··· 1 1 import { simpleFetchHandler, XRPC } from '@atcute/client'; 2 2 3 - export const APPVIEW_URL = 'https://public.api.bsky.app'; 4 - 3 + const APPVIEW_URL = import.meta.env.VITE_APPVIEW_URL; 4 + console.log(import.meta.env); 5 5 export const appViewRpc = new XRPC({ handler: simpleFetchHandler({ service: APPVIEW_URL }) });
+9
src/vite-env.d.ts
··· 1 1 /// <reference types="vite/client" /> 2 2 /// <reference types="@atcute/bluesky" /> 3 + 4 + interface ImportMetaEnv { 5 + VITE_PLC_DIRECTORY_URL: string; 6 + VITE_APPVIEW_URL: string; 7 + } 8 + 9 + interface ImportMeta { 10 + readonly env: ImportMetaEnv; 11 + }