Add developer API, Prometheus metrics, and community links
This commit is contained in:
16
lib/forum.ts
Normal file
16
lib/forum.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user