mojang status embed
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 56s

This commit is contained in:
Lee 2024-04-16 22:53:57 +01:00
parent 46384ed26e
commit 7ad9987cd1

@ -1,15 +1,12 @@
import { Card } from "@/app/components/card";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/app/components/ui/table";
import { generateEmbed } from "@/common/embed";
import { cn } from "@/common/utils";
import { getMojangEndpointStatus } from "mcutils-library";
import { CachedEndpointStatus } from "mcutils-library/dist/types/cache/cachedEndpointStatus";
import { Metadata } from "next";
import Link from "next/link";
async function getData(): Promise<CachedEndpointStatus> {
const status = await getMojangEndpointStatus();
return status;
}
/**
* Gets the color of the status
*
@ -29,6 +26,26 @@ function getColor(status: any): string {
}
}
async function getData(): Promise<CachedEndpointStatus> {
const status = await getMojangEndpointStatus();
return status;
}
export async function generateMetadata(): Promise<Metadata> {
const { endpoints } = await getData();
const description = Object.entries(endpoints)
.map(([url, status]) => {
return `${url}: ${status}`;
})
.join("\n");
return generateEmbed({
title: "Mojang Status",
description: description,
});
}
export default async function Page(): Promise<JSX.Element> {
const { endpoints } = await getData();
const endpointsSize = Object.entries(endpoints).length;