feat: profile and backgroud apis

This commit is contained in:
TrèsAbhi committed 2026-01-12 13:12:11 -06:00
1 parent c98271f783
commit 5a1a0c59f1
9 files changed
+92 -44

No files matched your search

@@ -0,0 +1,15 @@
import type { APIContext, GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
export const getStaticPaths = (async () => {
const { avatars } = await api.avatars();
return avatars.map((avatar) => ({
params: { id: avatar.name },
}));
}) satisfies GetStaticPaths;
export async function GET({ params }: APIContext<never, { id: string }>) {
const avatar = await api.avatar(params.id);
return Response.json(avatar);
}
@@ -1,18 +1,9 @@
import type { APIContext, GetStaticPaths } from "astro";
import type { APIContext } from "astro";
import { api } from "../../../core/api/dynamic";
import { imageProxy } from "../../../core/api/imageProxy";
export const getStaticPaths = (async () => {
const { avatars } = await api.avatars();
export { getStaticPaths } from "./[id].json";
return avatars.map((avatar) => ({
params: { id: avatar.name },
}));
}) satisfies GetStaticPaths;
/**
* One day I will write documentation for this
*/
export async function GET({ params }: APIContext<never, { id: string }>) {
const avatar = await api.avatar(params.id);
return await imageProxy(avatar.profile_avatar!.avatar);
@@ -0,0 +1,6 @@
import { api } from "../../../core/api/dynamic";
export async function GET() {
const { avatars } = await api.avatars();
return Response.json(avatars);
}
@@ -0,0 +1,7 @@
import { api } from "../../../core/api/dynamic";
export async function GET() {
const { avatars } = await api.avatars();
const list = avatars.map((avatar) => avatar.name);
return Response.json(list);
}
@@ -0,0 +1,15 @@
import type { APIContext, GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
export const getStaticPaths = (async () => {
const { backgrounds } = await api.backgrounds();
return backgrounds.map((background) => ({
params: { id: background.name },
}));
}) satisfies GetStaticPaths;
export async function GET({ params }: APIContext<never, { id: string }>) {
const background = await api.background(params.id);
return Response.json(background);
}
@@ -1,14 +1,8 @@
import type { APIContext, GetStaticPaths } from "astro";
import type { APIContext } from "astro";
import { api } from "../../../core/api/dynamic";
import { imageProxy } from "../../../core/api/imageProxy";
export const getStaticPaths = (async () => {
const { backgrounds } = await api.backgrounds();
return backgrounds.map((background) => ({
params: { id: background.name },
}));
}) satisfies GetStaticPaths;
export { getStaticPaths } from "./[id].json";
/**
* One day I will write documentation for this
@@ -0,0 +1,6 @@
import { api } from "../../../core/api/dynamic";
export async function GET() {
const { backgrounds } = await api.backgrounds();
return Response.json(backgrounds);
}
@@ -0,0 +1,7 @@
import { api } from "../../../core/api/dynamic";
export async function GET() {
const { backgrounds } = await api.backgrounds();
const list = backgrounds.map((background) => background.name);
return Response.json(list);
}