feat: add osu status to rpc

This commit is contained in:
2025-07-08 14:56:44 +02:00
parent 9f62332334
commit d6623891bb
10 changed files with 256 additions and 15 deletions

24
tests/imageCheck.test.ts Normal file
View File

@@ -0,0 +1,24 @@
import { expect, test } from 'bun:test';
const urlIsValidImage = async (url: string) => {
try {
const request = await fetch(url);
if (!request.ok) return false;
const contentType = request.headers.get('content-type');
return contentType?.startsWith('image/');
} catch {
return false;
}
};
test('image check', async () => {
const imageUrl = 'https://assets.ppy.sh/beatmaps/1/covers/list@2x.jpg';
const imageCheckResult = await urlIsValidImage(imageUrl);
expect(imageCheckResult).toBe(true);
});
test('image check fail', async () => {
const imageUrl = 'https://assets.ppy.sh/beatmaps/0/covers/list@2x.jpg';
const imageCheckResult = await urlIsValidImage(imageUrl);
expect(imageCheckResult).toBe(false);
});