chore: lint and fmt

This commit is contained in:
Julien Calixte
2026-03-28 09:38:55 +01:00
parent 8e8706e258
commit 5f48aa5690
108 changed files with 726 additions and 680 deletions

View File

@@ -1,4 +1,4 @@
import { createSchema, createFetch } from "@better-fetch/fetch"
import { createFetch, createSchema } from "@better-fetch/fetch"
import { type } from "arktype"
export type Author = { handle: string; pds: string }
@@ -12,20 +12,20 @@ const schema = createSchema(
did: "string",
handle: "string",
pds: "string",
signing_key: "string",
signing_key: "string"
}),
query: type({
identifier: "string",
}),
},
identifier: "string"
})
}
},
{ strict: true },
{ strict: true }
)
const microcosmSlingshot = createFetch({
baseURL: "https://slingshot.microcosm.blue",
// plugins: [logger()],
schema,
schema
})
export const getAuthor = async (did: string): Promise<Author | null> => {
@@ -36,7 +36,7 @@ export const getAuthor = async (did: string): Promise<Author | null> => {
try {
const { data: author } = await microcosmSlingshot(
"/xrpc/blue.microcosm.identity.resolveMiniDoc",
{ query: { identifier: did } },
{ query: { identifier: did } }
)
if (!author) {
@@ -62,7 +62,7 @@ export const getAuthors = async (dids: Set<string>) => {
const { data: author } = await microcosmSlingshot(
"/xrpc/blue.microcosm.identity.resolveMiniDoc",
{ query: { identifier: did } },
{ query: { identifier: did } }
)
if (!author) {
@@ -72,7 +72,7 @@ export const getAuthors = async (dids: Set<string>) => {
correspondanceCache.set(did, author)
return [did, author] as [string, Author | null]
}),
})
)
return new Map(correspondance)

View File

@@ -1,6 +1,6 @@
import {
BrowserOAuthClient,
buildLoopbackClientId,
buildLoopbackClientId
} from "@atproto/oauth-client-browser"
const getClientId = () =>
@@ -14,7 +14,7 @@ export const getOAuthClient = (): Promise<BrowserOAuthClient> => {
if (!clientPromise) {
clientPromise = BrowserOAuthClient.load({
clientId: getClientId(),
handleResolver: "https://bsky.social",
handleResolver: "https://bsky.social"
})
}
return clientPromise

View File

@@ -1,6 +1,6 @@
import { data } from '@/data/data'
import { DataType } from '@/data/DataType.enum'
import { AtprotoSession } from '@/data/models/AtprotoSession'
import { data } from "@/data/data"
import { DataType } from "@/data/DataType.enum"
import { AtprotoSession } from "@/data/models/AtprotoSession"
const SESSION_ID = `${DataType.AtprotoSession}-current`
@@ -8,12 +8,15 @@ export const loadSession = (): Promise<AtprotoSession | null> => {
return data.get<DataType.AtprotoSession, AtprotoSession>(SESSION_ID)
}
export const saveSession = async (did: string, handle: string): Promise<void> => {
export const saveSession = async (
did: string,
handle: string
): Promise<void> => {
const session: AtprotoSession = {
_id: SESSION_ID,
$type: DataType.AtprotoSession,
did,
handle,
handle
}
await data.update<DataType.AtprotoSession, AtprotoSession>(session)
}

View File

@@ -3,15 +3,18 @@ export const getFollows = async (did: string): Promise<Set<string>> => {
let cursor: string | undefined
do {
const url = new URL('https://public.api.bsky.app/xrpc/app.bsky.graph.getFollows')
url.searchParams.set('actor', did)
url.searchParams.set('limit', '100')
const url = new URL(
"https://public.api.bsky.app/xrpc/app.bsky.graph.getFollows"
)
url.searchParams.set("actor", did)
url.searchParams.set("limit", "100")
if (cursor) {
url.searchParams.set('cursor', cursor)
url.searchParams.set("cursor", cursor)
}
const response = await fetch(url)
const result: { follows: { did: string }[]; cursor?: string } = await response.json()
const result: { follows: { did: string }[]; cursor?: string } =
await response.json()
for (const follow of result.follows) {
follows.add(follow.did)

View File

@@ -1,6 +1,6 @@
export const withATProtoImages = (
markdown: string,
{ pds, did }: { pds: string; did: string },
{ pds, did }: { pds: string; did: string }
): string => {
const imageLinkPattern = /!\[([^\]]*)\]\((bafkrei[a-z0-9]+)\)/g