summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/mastodon/endpoints
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-01-31 11:38:20 -0500
committerHazelnoot <acomputerdog@gmail.com>2025-02-08 13:17:50 -0500
commit3550ce27d50f160917b3e68829fd649e3e3f0571 (patch)
tree198886ede1a76df378871999ac4cd1d26851700d /packages/backend/src/server/api/mastodon/endpoints
parentfix relationship data for Mastodon API (resolves #714) (diff)
downloadsharkey-3550ce27d50f160917b3e68829fd649e3e3f0571.tar.gz
sharkey-3550ce27d50f160917b3e68829fd649e3e3f0571.tar.bz2
sharkey-3550ce27d50f160917b3e68829fd649e3e3f0571.zip
hide restricted edit history from mastodon api (resolves #811)
Diffstat (limited to 'packages/backend/src/server/api/mastodon/endpoints')
-rw-r--r--packages/backend/src/server/api/mastodon/endpoints/status.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts
index 1767439c2f..99259d2542 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/status.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts
@@ -7,8 +7,9 @@ import querystring, { ParsedUrlQueryInput } from 'querystring';
import { emojiRegexAtStartToEnd } from '@/misc/emoji-regex.js';
import { getErrorData, MastodonLogger } from '@/server/api/mastodon/MastodonLogger.js';
import { parseTimelineArgs, TimelineArgs, toBoolean, toInt } from '@/server/api/mastodon/timelineArgs.js';
+import { AuthenticateService } from '@/server/api/AuthenticateService.js';
import { convertAttachment, convertPoll, MastoConverters } from '../converters.js';
-import { getClient } from '../MastodonApiServerService.js';
+import { getAccessToken, getClient } from '../MastodonApiServerService.js';
import type { Entity } from 'megalodon';
import type { FastifyInstance } from 'fastify';
@@ -22,6 +23,7 @@ export class ApiStatusMastodon {
private readonly fastify: FastifyInstance,
private readonly mastoConverters: MastoConverters,
private readonly logger: MastodonLogger,
+ private readonly authenticateService: AuthenticateService,
) {}
public getStatus() {
@@ -81,7 +83,8 @@ export class ApiStatusMastodon {
this.fastify.get<{ Params: { id?: string } }>('/v1/statuses/:id/history', async (_request, reply) => {
try {
if (!_request.params.id) return reply.code(400).send({ error: 'Missing required parameter "id"' });
- const edits = await this.mastoConverters.getEdits(_request.params.id);
+ const [user] = await this.authenticateService.authenticate(getAccessToken(_request.headers.authorization));
+ const edits = await this.mastoConverters.getEdits(_request.params.id, user);
reply.send(edits);
} catch (e) {
const data = getErrorData(e);