Revert "yeet koabody"

This reverts commit d5eb131f58.
This commit is contained in:
cutestnekoaqua 2023-02-10 20:40:54 +01:00
parent d1dda3a178
commit f331592d66
No known key found for this signature in database
GPG Key ID: 6BF0964A5069C1E0
7 changed files with 17 additions and 17 deletions

View File

@ -33,7 +33,7 @@ export function apiAccountMastodon(router: Router): void {
ctx.body = e.response.data; ctx.body = e.response.data;
} }
}); });
router.patch('/v1/accounts/update_credentials', async (ctx) => { router.patch('/v1/accounts/update_credentials', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
const accessTokens = ctx.headers.authorization; const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -177,7 +177,7 @@ export function apiAccountMastodon(router: Router): void {
ctx.body = e.response.data; ctx.body = e.response.data;
} }
}); });
router.post<{ Params: { id: string } }>('/v1/accounts/:id/mute', async (ctx) => { router.post<{ Params: { id: string } }>('/v1/accounts/:id/mute', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
const accessTokens = ctx.headers.authorization; const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);

View File

@ -42,7 +42,7 @@ const writeScope = [
export function apiAuthMastodon(router: Router): void { export function apiAuthMastodon(router: Router): void {
router.post('/v1/apps', async (ctx) => { router.post('/v1/apps', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);

View File

@ -5,7 +5,7 @@ import { getClient } from '../ApiMastodonCompatibleService.js';
export function apiFilterMastodon(router: Router): void { export function apiFilterMastodon(router: Router): void {
router.get('/v1/filters', async (ctx) => { router.get('/v1/filters', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -20,7 +20,7 @@ export function apiFilterMastodon(router: Router): void {
} }
}); });
router.get('/v1/filters/:id', async (ctx) => { router.get('/v1/filters/:id', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -35,7 +35,7 @@ export function apiFilterMastodon(router: Router): void {
} }
}); });
router.post('/v1/filters', async (ctx) => { router.post('/v1/filters', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -50,7 +50,7 @@ export function apiFilterMastodon(router: Router): void {
} }
}); });
router.post('/v1/filters/:id', async (ctx) => { router.post('/v1/filters/:id', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -65,7 +65,7 @@ export function apiFilterMastodon(router: Router): void {
} }
}); });
router.delete('/v1/filters/:id', async (ctx) => { router.delete('/v1/filters/:id', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);

View File

@ -10,7 +10,7 @@ function toLimitToInt(q: any) {
export function apiNotificationsMastodon(router: Router): void { export function apiNotificationsMastodon(router: Router): void {
router.get('/v1/notifications', async (ctx) => { router.get('/v1/notifications', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -35,7 +35,7 @@ export function apiNotificationsMastodon(router: Router): void {
} }
}); });
router.get('/v1/notification/:id', async (ctx) => { router.get('/v1/notification/:id', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -56,7 +56,7 @@ export function apiNotificationsMastodon(router: Router): void {
} }
}); });
router.post('/v1/notifications/clear', async (ctx) => { router.post('/v1/notifications/clear', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -71,7 +71,7 @@ export function apiNotificationsMastodon(router: Router): void {
} }
}); });
router.post('/v1/notification/:id/dismiss', async (ctx) => { router.post('/v1/notification/:id/dismiss', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);

View File

@ -5,7 +5,7 @@ import { getClient } from '../ApiMastodonCompatibleService.js';
export function apiSearchMastodon(router: Router): void { export function apiSearchMastodon(router: Router): void {
router.get('/v1/search', async (ctx) => { router.get('/v1/search', koaBody(), async (ctx) => {
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const accessTokens = ctx.request.headers.authorization; const accessTokens = ctx.request.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);

View File

@ -11,7 +11,7 @@ import axios from 'axios';
const pump = promisify(pipeline); const pump = promisify(pipeline);
export function apiStatusMastodon(router: Router): void { export function apiStatusMastodon(router: Router): void {
router.post('/v1/statuses', async (ctx, reply) => { router.post('/v1/statuses', koaBody(), async (ctx, reply) => {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
const accessTokens = ctx.headers.authorization; const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -284,7 +284,7 @@ export function apiStatusMastodon(router: Router): void {
ctx.body = e.response.data; ctx.body = e.response.data;
} }
}); });
router.put<{ Params: { id: string } }>('/v1/media/:id', async (ctx, reply) => { router.put<{ Params: { id: string } }>('/v1/media/:id', koaBody(), async (ctx, reply) => {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
const accessTokens = ctx.headers.authorization; const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
@ -310,7 +310,7 @@ export function apiStatusMastodon(router: Router): void {
ctx.body = e.response.data; ctx.body = e.response.data;
} }
}); });
router.post<{ Params: { id: string } }>('/v1/polls/:id/votes', async (ctx, reply) => { router.post<{ Params: { id: string } }>('/v1/polls/:id/votes', koaBody(), async (ctx, reply) => {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
const accessTokens = ctx.headers.authorization; const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);

View File

@ -141,7 +141,7 @@ router.get("/oauth/authorize", async (ctx) => {
ctx.redirect(Buffer.from(client_id?.toString() || '', 'base64').toString()); ctx.redirect(Buffer.from(client_id?.toString() || '', 'base64').toString());
}); });
router.post("/oauth/token", async (ctx) => { router.get("/oauth/token", koaBody(), async (ctx) => {
const body: any = ctx.request.body; const body: any = ctx.request.body;
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`; const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
const generator = (megalodon as any).default; const generator = (megalodon as any).default;