mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 12:39:59 +01:00
fix some ctx stuff
This commit is contained in:
parent
0756e980d1
commit
bb711adff8
@ -88,23 +88,23 @@ export function apiMastodonCompatible(router: Router): void {
|
|||||||
ctx.body = data.data;
|
ctx.body = data.data;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
reply.code(401);
|
ctx.status = 401;
|
||||||
return e.response.data;
|
return e.response.data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.get('/v1/custom_emojis', async (ctx) => {
|
router.get('/v1/custom_emojis', async (ctx) => {
|
||||||
const BASE_URL = request.protocol + '://' + request.hostname;
|
const BASE_URL = `${ctx.request.protocol}://${ctx.request.hostname}`;
|
||||||
const accessTokens = request.headers.authorization;
|
const accessTokens = ctx.request.headers.authorization;
|
||||||
const client = getClient(BASE_URL, accessTokens);
|
const client = getClient(BASE_URL, accessTokens);
|
||||||
try {
|
try {
|
||||||
const data = await client.getInstanceCustomEmojis();
|
const data = await client.getInstanceCustomEmojis();
|
||||||
return data.data;
|
ctx.body = data.data;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
reply.code(401);
|
ctx.status = 401;
|
||||||
return e.response.data;
|
ctx.body = e.response.data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user