fix server showing error on invalid server
Some checks failed
Deploy App / docker (ubuntu-latest) (push) Has been cancelled
Some checks failed
Deploy App / docker (ubuntu-latest) (push) Has been cancelled
This commit is contained in:
parent
15bc010394
commit
50f2e26187
@ -14,7 +14,7 @@ type Params = {
|
|||||||
|
|
||||||
export async function generateMetadata({ params: { id } }: Params): Promise<Metadata> {
|
export async function generateMetadata({ params: { id } }: Params): Promise<Metadata> {
|
||||||
const player = await getData(id);
|
const player = await getData(id);
|
||||||
if (!player) {
|
if (player == null) {
|
||||||
return generateEmbed({ title: "Unknown Player", description: "Player not found" });
|
return generateEmbed({ title: "Unknown Player", description: "Player not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ type Params = {
|
|||||||
|
|
||||||
export async function generateMetadata({ params: { platform, hostname } }: Params): Promise<Metadata> {
|
export async function generateMetadata({ params: { platform, hostname } }: Params): Promise<Metadata> {
|
||||||
const server = await getData(platform, hostname);
|
const server = await getData(platform, hostname);
|
||||||
if (!server) {
|
if (server == null) {
|
||||||
return generateEmbed({ title: "Unknown Server", description: "Server not found" });
|
return generateEmbed({ title: "Unknown Server", description: "Server not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,8 +27,8 @@ export async function generateMetadata({ params: { platform, hostname } }: Param
|
|||||||
|
|
||||||
let favicon = null; // Server favicon
|
let favicon = null; // Server favicon
|
||||||
|
|
||||||
if (platform === ServerPlatform.Java) {
|
|
||||||
// Java specific
|
// Java specific
|
||||||
|
if (platform === ServerPlatform.Java) {
|
||||||
const javaServer = server as JavaMinecraftServer;
|
const javaServer = server as JavaMinecraftServer;
|
||||||
favicon = javaServer.favicon && javaServer.favicon.url;
|
favicon = javaServer.favicon && javaServer.favicon.url;
|
||||||
}
|
}
|
||||||
@ -60,8 +60,8 @@ export default async function Page({ params: { platform, hostname } }: Params) {
|
|||||||
|
|
||||||
let favicon = null; // Server favicon
|
let favicon = null; // Server favicon
|
||||||
|
|
||||||
if (platform === ServerPlatform.Java) {
|
|
||||||
// Java specific
|
// Java specific
|
||||||
|
if (server && platform === ServerPlatform.Java) {
|
||||||
const javaServer = server as JavaMinecraftServer;
|
const javaServer = server as JavaMinecraftServer;
|
||||||
favicon = javaServer.favicon && javaServer.favicon.url;
|
favicon = javaServer.favicon && javaServer.favicon.url;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user