Frontend/src/app/common/server.ts
Liam 18a782243e
All checks were successful
Deploy App / docker (ubuntu-latest) (push) Successful in 1m9s
move common dir
2024-04-20 02:35:52 +01:00

18 lines
431 B
TypeScript

import { getServer, ServerPlatform } from "mcutils-library";
/**
* Checks if the server is valid.
*
* @param platform the server's platform
* @param query the hostname for the server
* @returns true if valid, false otherwise
*/
export async function isValidServer(platform: ServerPlatform, query: string): Promise<boolean> {
try {
await getServer(platform, query);
return true;
} catch {
return false;
}
}