17 lines
463 B
TypeScript
17 lines
463 B
TypeScript
import "server-only";
|
|
import forum from "@/shared/forum.json";
|
|
|
|
/** Only expose a public HTTPS destination, never embedded credentials. */
|
|
export function forumUrl() {
|
|
const value = process.env.MINEGEO_FORUM_URL ?? forum.url;
|
|
if (!value.trim()) return null;
|
|
try {
|
|
const url = new URL(value.trim());
|
|
if (url.protocol !== "https:" || url.username || url.password || url.port)
|
|
return null;
|
|
return url.href;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|