diff --git a/config.json b/config.json index 0d8f1f1..f4b2444 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "siteName": "Minecraft Utilities", "siteDescription": "Minecraft Utilities offers you many endpoints to get information about a minecraft server or a player.", - "siteUrl": "https://mcutils.xyz/" + "siteUrl": "https://mcutils.xyz/", + "apiUrl": "https://api.mcutils.xyz" } diff --git a/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx b/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx index d21e28e..0155973 100644 --- a/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx +++ b/src/app/(pages)/server/[platform]/[[...hostname]]/page.tsx @@ -1,5 +1,4 @@ import { Card } from "@/app/components/card"; -import { CodeDialog } from "@/app/components/code-dialog"; import { CopyButton } from "@/app/components/copy-button"; import { ErrorCard } from "@/app/components/error-card"; import { LookupServer } from "@/app/components/server/lookup-server"; @@ -17,6 +16,7 @@ import { import { Metadata } from "next"; import Image from "next/image"; import { ReactElement } from "react"; +import config from "../../../../../../config.json"; type Params = { params: { @@ -34,10 +34,10 @@ type Params = { */ function getFavicon( platform: ServerPlatform, - server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer, + server: CachedJavaMinecraftServer | CachedBedrockMinecraftServer | undefined, ): string | undefined { if (platform === ServerPlatform.Bedrock) { - return undefined; + return config.apiUrl + "/server/icon/fallback"; } server = server as CachedJavaMinecraftServer; return server.favicon && server.favicon.url; @@ -72,7 +72,7 @@ export async function generateMetadata({ params: { platform, hostname } }: Param const server = await getServer(platform, hostname); const { hostname: serverHostname, players } = server as CachedJavaMinecraftServer | CachedBedrockMinecraftServer; - const favicon = server ? getFavicon(platform, server) : undefined; + const favicon = getFavicon(platform, server); let description = `Hostname: ${serverHostname}\n`; description += `${players.online}/${players.max} players online\n\n`; @@ -108,7 +108,7 @@ export default async function Page({ params: { platform, hostname } }: Params): error = (err as McUtilsAPIError).message; // Set the error message } - const favicon = server ? getFavicon(platform, server) : undefined; + const favicon = getFavicon(platform, server); return (
@@ -124,18 +124,6 @@ export default async function Page({ params: { platform, hostname } }: Params): -
- - - -
-
{favicon && (