change remaining D1Database types

pull/352/head
Sven Sauleau 2023-02-28 16:32:30 +00:00
rodzic 48870b88f6
commit 39636f5b99
3 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -24,7 +24,7 @@ export async function getAccount(domain: string, accountId: string, db: Database
}
}
async function getRemoteAccount(handle: Handle, acct: string, db: D1Database): Promise<MastodonAccount | null> {
async function getRemoteAccount(handle: Handle, acct: string, db: Database): Promise<MastodonAccount | null> {
// TODO: using webfinger isn't the optimal implementation. We could cache
// the object in D1 and directly query the remote API, indicated by the actor's
// url field. For now, let's keep it simple.

Wyświetl plik

@ -1,4 +1,5 @@
import * as actors from '../activitypub/actors'
import { type Database } from 'wildebeest/backend/src/database'
import type { Actor } from '../activitypub/actors'
export type WebFingerResponse = {
@ -11,7 +12,7 @@ const headers = {
accept: 'application/jrd+json',
}
export async function queryAcct(domain: string, db: D1Database, acct: string): Promise<Actor | null> {
export async function queryAcct(domain: string, db: Database, acct: string): Promise<Actor | null> {
const url = await queryAcctLink(domain, acct)
if (url === null) {
return null

Wyświetl plik

@ -1,5 +1,6 @@
// https://docs.joinmastodon.org/methods/apps/#verify_credentials
import { type Database } from 'wildebeest/backend/src/database'
import { cors } from 'wildebeest/backend/src/utils/cors'
import { VAPIDPublicKey } from 'wildebeest/backend/src/mastodon/subscription'
import { getVAPIDKeys } from 'wildebeest/backend/src/config'
@ -24,7 +25,7 @@ export const onRequest: PagesFunction<Env, any, ContextData> = async ({ request,
return handleRequest(env.DATABASE, request, getVAPIDKeys(env))
}
export async function handleRequest(db: D1Database, request: Request, vapidKeys: JWK) {
export async function handleRequest(db: Database, request: Request, vapidKeys: JWK) {
if (request.method !== 'GET') {
return new Response('', { status: 400 })
}