fix lint
All checks were successful
Code quality checks / biome (push) Successful in 8s

This commit is contained in:
creations 2025-04-20 14:39:31 -04:00
parent 6d46ef48d0
commit df6e2325d9
Signed by: creations
GPG key ID: 8F553AA4320FC711
4 changed files with 36 additions and 16 deletions

View file

@ -248,7 +248,7 @@ function buildActivityHTML(activity) {
${activity.assets?.large_text ? `title="${activity.assets.large_text}"` : ""} ${activity.assets?.large_text ? `title="${activity.assets.large_text}"` : ""}
/> />
${`<img class="activity-image-small ${smallArt ?? "no-asset"}" src="${smallArt ?? ""}" ${activity.assets?.small_text ? `title="${activity.assets.small_text}"` : ""}>`} ${`<img class="activity-image-small ${smallArt ?? "no-asset"}" src="${smallArt ?? ""}" ${activity.assets?.small_text ? `title="${activity.assets.small_text}"` : ""}>`}
</div>` </div>`;
return ` return `
<li class="activity"> <li class="activity">
@ -431,7 +431,9 @@ function updatePresence(data) {
} }
async function getAllNoAsset() { async function getAllNoAsset() {
const noAssetImages = document.querySelectorAll("img.activity-image.no-asset"); const noAssetImages = document.querySelectorAll(
"img.activity-image.no-asset",
);
console.log("Images with .no-asset:", noAssetImages.length, noAssetImages); console.log("Images with .no-asset:", noAssetImages.length, noAssetImages);

View file

@ -11,7 +11,9 @@ const routeDef: RouteDef = {
async function handler(request: ExtendedRequest): Promise<Response> { async function handler(request: ExtendedRequest): Promise<Response> {
const { id } = request.params; const { id } = request.params;
const data: LanyardResponse = await getLanyardData(id || lanyardConfig.userId); const data: LanyardResponse = await getLanyardData(
id || lanyardConfig.userId,
);
if (!data.success) { if (!data.success) {
return await renderEjsTemplate("error", { return await renderEjsTemplate("error", {

View file

@ -17,11 +17,14 @@ async function fetchSteamGridIcon(gameName: string): Promise<string | null> {
const cached = await redis.get(cacheKey); const cached = await redis.get(cacheKey);
if (cached) return cached; if (cached) return cached;
const search = await fetch(`https://www.steamgriddb.com/api/v2/search/autocomplete/${encodeURIComponent(gameName)}`, { const search = await fetch(
headers: { `https://www.steamgriddb.com/api/v2/search/autocomplete/${encodeURIComponent(gameName)}`,
Authorization: `Bearer ${steamGridDbKey}`, {
headers: {
Authorization: `Bearer ${steamGridDbKey}`,
},
}, },
}); );
if (!search.ok) return null; if (!search.ok) return null;
@ -31,11 +34,14 @@ async function fetchSteamGridIcon(gameName: string): Promise<string | null> {
const gameId = data[0]?.id; const gameId = data[0]?.id;
if (!gameId) return null; if (!gameId) return null;
const iconRes = await fetch(`https://www.steamgriddb.com/api/v2/icons/game/${gameId}`, { const iconRes = await fetch(
headers: { `https://www.steamgriddb.com/api/v2/icons/game/${gameId}`,
Authorization: `Bearer ${steamGridDbKey}`, {
headers: {
Authorization: `Bearer ${steamGridDbKey}`,
},
}, },
}); );
if (!iconRes.ok) return null; if (!iconRes.ok) return null;
@ -53,20 +59,26 @@ async function handler(request: ExtendedRequest): Promise<Response> {
if (!steamGridDbKey) { if (!steamGridDbKey) {
return Response.json( return Response.json(
{ status: 503, error: "Route disabled due to missing SteamGridDB key" }, { status: 503, error: "Route disabled due to missing SteamGridDB key" },
{ status: 503 } { status: 503 },
); );
} }
const { game } = request.params; const { game } = request.params;
if (!game || typeof game !== "string" || game.length < 2) { if (!game || typeof game !== "string" || game.length < 2) {
return Response.json({ status: 400, error: "Missing or invalid game name" }, { status: 400 }); return Response.json(
{ status: 400, error: "Missing or invalid game name" },
{ status: 400 },
);
} }
const icon = await fetchSteamGridIcon(game); const icon = await fetchSteamGridIcon(game);
if (!icon) { if (!icon) {
return Response.json({ status: 404, error: "Icon not found" }, { status: 404 }); return Response.json(
{ status: 404, error: "Icon not found" },
{ status: 404 },
);
} }
return Response.json( return Response.json(
@ -75,7 +87,7 @@ async function handler(request: ExtendedRequest): Promise<Response> {
game, game,
icon, icon,
}, },
{ status: 200 } { status: 200 },
); );
} }

View file

@ -4,6 +4,10 @@ export const routeDef = {
...idRouteDef, ...idRouteDef,
}; };
export const handler = async (request: ExtendedRequest, body: unknown, server: BunServer) => { export const handler = async (
request: ExtendedRequest,
body: unknown,
server: BunServer,
) => {
return await idHandler(request); return await idHandler(request);
}; };