summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-10-31 11:34:25 +0100
committerMar0xy <marie@kaifa.ch>2023-10-31 11:34:25 +0100
commit0a9ca195e27321c8f959bfb69a7272a70bfaaa89 (patch)
treef57917938b7849cb704ff83815deec843d5d9135 /packages/backend/src/server/api
parentupd: change handling of suggestions and status trends (diff)
downloadsharkey-0a9ca195e27321c8f959bfb69a7272a70bfaaa89.tar.gz
sharkey-0a9ca195e27321c8f959bfb69a7272a70bfaaa89.tar.bz2
sharkey-0a9ca195e27321c8f959bfb69a7272a70bfaaa89.zip
fix: create trends/tags endpoint
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/mastodon/MastodonApiServerService.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts
index 4a81320de5..8a93392599 100644
--- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts
+++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts
@@ -207,6 +207,20 @@ export class MastodonApiServerService {
}
});
+ fastify.get('/v1/trends/tags', async (_request, reply) => {
+ const BASE_URL = `${_request.protocol}://${_request.hostname}`;
+ const accessTokens = _request.headers.authorization;
+ const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt
+ // displayed without being logged in
+ try {
+ const data = await client.getInstanceTrends();
+ reply.send(data.data);
+ } catch (e: any) {
+ /* console.error(e); */
+ reply.code(401).send(e.response.data);
+ }
+ });
+
fastify.post('/v1/apps', async (_request, reply) => {
const BASE_URL = `${_request.protocol}://${_request.hostname}`;
const client = getClient(BASE_URL, ''); // we are using this here, because in private mode some info isnt