mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-28 01:23:08 +02:00
16 lines
667 B
TypeScript
16 lines
667 B
TypeScript
import { type SharedOptions, rest } from 'msw';
|
|
|
|
export const onUnhandledRequest = ((req, print) => {
|
|
if (req.url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|sb-|static-assets\/|vite\/)/.test(req.url.pathname)) {
|
|
return
|
|
}
|
|
print.warning()
|
|
}) satisfies SharedOptions['onUnhandledRequest'];
|
|
|
|
export const commonHandlers = [
|
|
rest.get('/twemoji/:codepoints.svg', async (req, res, ctx) => {
|
|
const { codepoints } = req.params;
|
|
const file = await import(`../node_modules/@discordapp/twemoji/dist/svg/${codepoints}.svg?raw`);
|
|
return res(ctx.set('Content-Type', 'image/svg+xml'), ctx.body(file.default));
|
|
}),
|
|
];
|