Skip to content

Commit

Permalink
Merge branch 'main' into oltp
Browse files Browse the repository at this point in the history
  • Loading branch information
llun committed Feb 23, 2025
2 parents fe080fc + a343169 commit b67c6af
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 64 deletions.
11 changes: 2 additions & 9 deletions app/api/v1/accounts/verify_credentials/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Scope } from '@/lib/database/types/oauth'
import { OAuthGuard } from '@/lib/services/guards/OAuthGuard'
import { getMastodonAccount } from '@/lib/services/mastodon/getMastodonAccount'
import { HttpMethod } from '@/lib/utils/getCORSHeaders'
import { apiResponse, defaultOptions } from '@/lib/utils/response'

Expand All @@ -10,12 +9,6 @@ export const OPTIONS = defaultOptions(CORS_HEADERS)

export const GET = OAuthGuard([Scope.enum.read], async (req, context) => {
const { currentActor, database } = context

console.log(
'Current actor for timeline',
currentActor?.id,
Boolean(currentActor)
)
const mastodonAccount = await getMastodonAccount(database, currentActor)
return apiResponse(req, CORS_HEADERS, mastodonAccount)
const actor = await database.getMastodonActorFromId({ id: currentActor.id })
return apiResponse(req, CORS_HEADERS, actor)
})
3 changes: 1 addition & 2 deletions app/api/v1/statuses/[id]/favourited_by/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Scope } from '@/lib/database/types/oauth'
import { OAuthGuard } from '@/lib/services/guards/OAuthGuard'
import { getMastodonAccount } from '@/lib/services/mastodon/getMastodonAccount'
import { HttpMethod } from '@/lib/utils/getCORSHeaders'
import {
apiErrorResponse,
Expand Down Expand Up @@ -29,7 +28,7 @@ export const GET = OAuthGuard<Params>(
req,
CORS_HEADERS,
await Promise.all(
actors.map((actor) => getMastodonAccount(database, actor))
actors.map((actor) => database.getMastodonActorFromId({ id: actor.id }))
)
)
}
Expand Down
49 changes: 0 additions & 49 deletions lib/services/mastodon/getMastodonAccount.ts

This file was deleted.

5 changes: 1 addition & 4 deletions lib/services/mastodon/getMastodonStatus.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { Mastodon } from '@llun/activities.schema'

import { Database } from '@/lib/database/types'
import { Actor } from '@/lib/models/actor'
import { getMastodonAttachment } from '@/lib/models/attachment'
import { Status } from '@/lib/models/status'
import { getISOTimeUTC } from '@/lib/utils/getISOTimeUTC'

import { getMastodonAccount } from './getMastodonAccount'

export const getMastodonStatus = async (
database: Database,
status: Status
): Promise<Mastodon.Status> => {
const account = await getMastodonAccount(database, status.actor as Actor)
const account = await database.getMastodonActorFromId({ id: status.actorId })
const baseData = {
// Identifiers & timestamps
id: status.id,
Expand Down

0 comments on commit b67c6af

Please sign in to comment.