feat: add extensive test suite
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
import { getAmberVh } from "@/lib/api";
|
||||
import { createAmberProxyHandler } from "@/lib/server-handlers";
|
||||
|
||||
export async function GET() {
|
||||
return new Response(
|
||||
await fetch(
|
||||
`https://gi.yatta.moe/api/v2/en/avatar?vh=${await getAmberVh()}`,
|
||||
).then((e) => e.text()),
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
export const GET = createAmberProxyHandler("en/avatar", {
|
||||
getVersionHash: getAmberVh,
|
||||
fetchText: (url) => fetch(url).then((response) => response.text()),
|
||||
});
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import { getAmberVh } from "@/lib/api";
|
||||
import { createAmberProxyHandler } from "@/lib/server-handlers";
|
||||
|
||||
export async function GET() {
|
||||
return new Response(
|
||||
await fetch(
|
||||
`https://gi.yatta.moe/api/v2/static/changelog?vh=${await getAmberVh()}`,
|
||||
).then((e) => e.text()),
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
export const GET = createAmberProxyHandler("static/changelog", {
|
||||
getVersionHash: getAmberVh,
|
||||
fetchText: (url) => fetch(url).then((response) => response.text()),
|
||||
});
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { actionLog } from "@/lib/api";
|
||||
import { adminCheck } from "@/lib/auth";
|
||||
import { createAmberSyncHandler } from "@/lib/server-handlers";
|
||||
import { syncAmber } from "@/util/sync";
|
||||
|
||||
export async function GET() {
|
||||
if (!(await adminCheck()))
|
||||
return new Response("Unauthorized", { status: 401 });
|
||||
await syncAmber();
|
||||
await actionLog("Triggered an Amber sync from API");
|
||||
return new Response(
|
||||
"OK(log is wip, check `kubectl logs -fn buzz deployments/app`)",
|
||||
);
|
||||
}
|
||||
export const GET = createAmberSyncHandler({
|
||||
adminCheck,
|
||||
sync: syncAmber,
|
||||
log: actionLog,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user