kopia lustrzana https://github.com/cloudflare/wildebeest
change remaining D1Database types
rodzic
48870b88f6
commit
39636f5b99
|
@ -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
|
// 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
|
// the object in D1 and directly query the remote API, indicated by the actor's
|
||||||
// url field. For now, let's keep it simple.
|
// url field. For now, let's keep it simple.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import * as actors from '../activitypub/actors'
|
import * as actors from '../activitypub/actors'
|
||||||
|
import { type Database } from 'wildebeest/backend/src/database'
|
||||||
import type { Actor } from '../activitypub/actors'
|
import type { Actor } from '../activitypub/actors'
|
||||||
|
|
||||||
export type WebFingerResponse = {
|
export type WebFingerResponse = {
|
||||||
|
@ -11,7 +12,7 @@ const headers = {
|
||||||
accept: 'application/jrd+json',
|
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)
|
const url = await queryAcctLink(domain, acct)
|
||||||
if (url === null) {
|
if (url === null) {
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// https://docs.joinmastodon.org/methods/apps/#verify_credentials
|
// 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 { cors } from 'wildebeest/backend/src/utils/cors'
|
||||||
import { VAPIDPublicKey } from 'wildebeest/backend/src/mastodon/subscription'
|
import { VAPIDPublicKey } from 'wildebeest/backend/src/mastodon/subscription'
|
||||||
import { getVAPIDKeys } from 'wildebeest/backend/src/config'
|
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))
|
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') {
|
if (request.method !== 'GET') {
|
||||||
return new Response('', { status: 400 })
|
return new Response('', { status: 400 })
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue